mirror of
https://github.com/astral-sh/ruff.git
synced 2025-10-03 23:25:14 +00:00
CallPath newtype wrapper (#10201)
## Summary This PR changes the `CallPath` type alias to a newtype wrapper. A newtype wrapper allows us to limit the API and to experiment with alternative ways to implement matching on `CallPath`s. ## Test Plan `cargo test`
This commit is contained in:
parent
fb05d218c3
commit
e725b6fdaf
165 changed files with 551 additions and 433 deletions
|
@ -1,6 +1,6 @@
|
|||
use ruff_python_ast::call_path::CallPath;
|
||||
use std::collections::BTreeSet;
|
||||
|
||||
use ruff_python_ast::call_path::from_qualified_name;
|
||||
use ruff_python_ast::helpers::map_callable;
|
||||
use ruff_python_semantic::{Definition, SemanticModel};
|
||||
use ruff_source_file::UniversalNewlines;
|
||||
|
@ -57,7 +57,7 @@ pub(crate) fn should_ignore_definition(
|
|||
.is_some_and(|call_path| {
|
||||
ignore_decorators
|
||||
.iter()
|
||||
.any(|decorator| from_qualified_name(decorator) == call_path)
|
||||
.any(|decorator| CallPath::from_qualified_name(decorator) == call_path)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@ use once_cell::sync::Lazy;
|
|||
|
||||
use ruff_diagnostics::{Diagnostic, Violation};
|
||||
use ruff_macros::{derive_message_formats, violation};
|
||||
use ruff_python_ast::call_path::{from_qualified_name, CallPath};
|
||||
use ruff_python_ast::call_path::CallPath;
|
||||
use ruff_python_semantic::analyze::visibility::{is_property, is_test};
|
||||
use ruff_source_file::UniversalNewlines;
|
||||
use ruff_text_size::Ranged;
|
||||
|
@ -74,7 +74,7 @@ pub(crate) fn non_imperative_mood(
|
|||
|
||||
let property_decorators = property_decorators
|
||||
.iter()
|
||||
.map(|decorator| from_qualified_name(decorator))
|
||||
.map(|decorator| CallPath::from_qualified_name(decorator))
|
||||
.collect::<Vec<CallPath>>();
|
||||
|
||||
if is_test(&function.name)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue