mirror of
https://github.com/astral-sh/ruff.git
synced 2025-11-03 13:23:10 +00:00
Add support for specifying minimum dots in detected string imports (#19538)
## Summary Defaults to requiring two dots, which matches the Pants default.
This commit is contained in:
parent
d77b7312b0
commit
d9cab4d242
13 changed files with 129 additions and 42 deletions
|
|
@ -3843,6 +3843,12 @@ pub struct AnalyzeOptions {
|
|||
"#
|
||||
)]
|
||||
pub detect_string_imports: Option<bool>,
|
||||
/// The minimum number of dots in a string to consider it a valid import.
|
||||
///
|
||||
/// This setting is only relevant when [`detect-string-imports`](#detect-string-imports) is enabled.
|
||||
/// For example, if this is set to `2`, then only strings with at least two dots (e.g., `"path.to.module"`)
|
||||
/// would be considered valid imports.
|
||||
pub string_imports_min_dots: Option<usize>,
|
||||
/// A map from file path to the list of Python or non-Python file paths or globs that should be
|
||||
/// considered dependencies of that file, regardless of whether relevant imports are detected.
|
||||
#[option(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue