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:
Micha Reiser 2024-03-03 16:54:24 +01:00 committed by GitHub
parent fb05d218c3
commit e725b6fdaf
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
165 changed files with 551 additions and 433 deletions

View file

@ -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)
})
})
}

View file

@ -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)