mirror of
https://github.com/astral-sh/ruff.git
synced 2025-08-04 18:58:26 +00:00
Add per-file-target-version
option (#16257)
## Summary
This PR is another step in preparing to detect syntax errors in the
parser. It introduces the new `per-file-target-version` top-level
configuration option, which holds a mapping of compiled glob patterns to
Python versions. I intend to use the
`LinterSettings::resolve_target_version` method here to pass to the
parser:
f50849aeef/crates/ruff_linter/src/linter.rs (L491-L493)
## Test Plan
I added two new CLI tests to show that the `per-file-target-version` is
respected in both the formatter and the linter.
This commit is contained in:
parent
42a5f5ef6a
commit
e7a6c19e3a
78 changed files with 820 additions and 274 deletions
|
@ -303,7 +303,7 @@ impl<'a> ParsedModule<'a> {
|
|||
// TODO(konstin): Add an options for py/pyi to the UI (2/2)
|
||||
let options = settings
|
||||
.formatter
|
||||
.to_format_options(PySourceType::default(), self.source_code)
|
||||
.to_format_options(PySourceType::default(), self.source_code, None)
|
||||
.with_source_map_generation(SourceMapGeneration::Enabled);
|
||||
|
||||
format_module_ast(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue