diff --git a/Cargo.lock b/Cargo.lock index e4ee07522f..07a799ca95 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1700,7 +1700,7 @@ dependencies = [ [[package]] name = "rust-python-linter" -version = "0.0.12" +version = "0.0.13" dependencies = [ "anyhow", "bincode", @@ -1727,16 +1727,16 @@ dependencies = [ [[package]] name = "rustpython-ast" version = "0.1.0" -source = "git+https://github.com/RustPython/RustPython.git?rev=f1c7aebfad707526602c8162c8094a67129b6731#f1c7aebfad707526602c8162c8094a67129b6731" +source = "git+https://github.com/RustPython/RustPython.git?rev=e9970edd775a617226007d3d3cb0fbbc39ed3948#e9970edd775a617226007d3d3cb0fbbc39ed3948" dependencies = [ "num-bigint", - "rustpython-bytecode", + "rustpython-compiler-core", ] [[package]] -name = "rustpython-bytecode" +name = "rustpython-compiler-core" version = "0.1.2" -source = "git+https://github.com/RustPython/RustPython.git?rev=f1c7aebfad707526602c8162c8094a67129b6731#f1c7aebfad707526602c8162c8094a67129b6731" +source = "git+https://github.com/RustPython/RustPython.git?rev=e9970edd775a617226007d3d3cb0fbbc39ed3948#e9970edd775a617226007d3d3cb0fbbc39ed3948" dependencies = [ "bincode", "bitflags", @@ -1747,12 +1747,13 @@ dependencies = [ "num-complex", "serde", "static_assertions", + "thiserror", ] [[package]] name = "rustpython-parser" version = "0.1.2" -source = "git+https://github.com/RustPython/RustPython.git?rev=f1c7aebfad707526602c8162c8094a67129b6731#f1c7aebfad707526602c8162c8094a67129b6731" +source = "git+https://github.com/RustPython/RustPython.git?rev=e9970edd775a617226007d3d3cb0fbbc39ed3948#e9970edd775a617226007d3d3cb0fbbc39ed3948" dependencies = [ "ahash", "anyhow", @@ -1765,6 +1766,8 @@ dependencies = [ "phf 0.10.1", "phf_codegen 0.10.0", "rustpython-ast", + "rustpython-compiler-core", + "thiserror", "tiny-keccak", "unic-emoji-char", "unic-ucd-ident", diff --git a/Cargo.toml b/Cargo.toml index 5bda01349f..85e50d2cb8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "rust-python-linter" -version = "0.0.12" +version = "0.0.13" edition = "2021" [lib] @@ -23,7 +23,7 @@ notify = { version = "4.0.17" } pyo3 = { version = "0.16.5", features = ["extension-module", "abi3-py37"] } rayon = { version = "1.5.3" } regex = { version = "1.6.0" } -rustpython-parser = { features=["lalrpop"], git = "https://github.com/RustPython/RustPython.git", rev = "f1c7aebfad707526602c8162c8094a67129b6731" } +rustpython-parser = { features=["lalrpop"], git = "https://github.com/RustPython/RustPython.git", rev = "e9970edd775a617226007d3d3cb0fbbc39ed3948" } serde = { version = "1.0.143", features = ["derive"] } serde_json = { version = "1.0.83" } toml = { version = "0.5.9"} diff --git a/src/linter.rs b/src/linter.rs index f1d667e670..034b03a28b 100644 --- a/src/linter.rs +++ b/src/linter.rs @@ -30,7 +30,7 @@ pub fn check_path(path: &Path, settings: &Settings, mode: &cache::Mode) -> Resul .iter() .any(|check_code| matches!(CheckKind::new(check_code).lint_source(), LintSource::AST)) { - let python_ast = parser::parse_program(&contents)?; + let python_ast = parser::parse_program(&contents, &path.to_string_lossy())?; checks.extend(check_ast(&python_ast, settings)); }