mirror of https://github.com/astral-sh/ruff
[red-knot] Don't check non-python files (#17021)
## Summary Fixes https://github.com/astral-sh/ruff/issues/17018 ## Test Plan I renamed a python file to `knot.toml` and verified that there are no diagnostics. Renaming back the file to `*.py` brings back the diagnostics
This commit is contained in:
parent
f9bc80ad55
commit
4067a7e50c
|
|
@ -214,6 +214,10 @@ impl FileHandle {
|
||||||
pub fn js_to_string(&self) -> String {
|
pub fn js_to_string(&self) -> String {
|
||||||
format!("file(id: {:?}, path: {})", self.file, self.path)
|
format!("file(id: {:?}, path: {})", self.file, self.path)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn path(&self) -> String {
|
||||||
|
self.path.to_string()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[wasm_bindgen]
|
#[wasm_bindgen]
|
||||||
|
|
|
||||||
|
|
@ -220,7 +220,9 @@ function useCheckResult(
|
||||||
|
|
||||||
const currentHandle = files.handles[files.selected];
|
const currentHandle = files.handles[files.selected];
|
||||||
|
|
||||||
if (currentHandle == null) {
|
const extension =
|
||||||
|
currentHandle?.path()?.toLowerCase().split(".").pop() ?? "";
|
||||||
|
if (currentHandle == null || !["py", "pyi", "pyw"].includes(extension)) {
|
||||||
return {
|
return {
|
||||||
diagnostics: [],
|
diagnostics: [],
|
||||||
error: null,
|
error: null,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue