mirror of
https://github.com/astral-sh/ruff.git
synced 2025-08-04 10:48:32 +00:00
[ty] Ignore possibly-unresolved-reference
by default (#17934)
This commit is contained in:
parent
067a8ac574
commit
d608eae126
9 changed files with 97 additions and 72 deletions
|
@ -59,7 +59,7 @@ info: revealed-type: Revealed type
|
|||
```
|
||||
|
||||
```
|
||||
warning: lint:possibly-unresolved-reference: Name `x` used when possibly not defined
|
||||
info: lint:possibly-unresolved-reference: Name `x` used when possibly not defined
|
||||
--> src/mdtest_snippet.py:16:17
|
||||
|
|
||||
14 | # revealed: Unknown
|
||||
|
|
|
@ -475,12 +475,26 @@ impl RuleSelection {
|
|||
/// Creates a new rule selection from all known lints in the registry that are enabled
|
||||
/// according to their default severity.
|
||||
pub fn from_registry(registry: &LintRegistry) -> Self {
|
||||
Self::from_registry_with_default(registry, None)
|
||||
}
|
||||
|
||||
/// Creates a new rule selection from all known lints in the registry, including lints that are default by default.
|
||||
/// Lints that are disabled by default use the `default_severity`.
|
||||
pub fn all(registry: &LintRegistry, default_severity: Severity) -> Self {
|
||||
Self::from_registry_with_default(registry, Some(default_severity))
|
||||
}
|
||||
|
||||
fn from_registry_with_default(
|
||||
registry: &LintRegistry,
|
||||
default_severity: Option<Severity>,
|
||||
) -> Self {
|
||||
let lints = registry
|
||||
.lints()
|
||||
.iter()
|
||||
.filter_map(|lint| {
|
||||
Severity::try_from(lint.default_level())
|
||||
.ok()
|
||||
.or(default_severity)
|
||||
.map(|severity| (*lint, (severity, LintSource::Default)))
|
||||
})
|
||||
.collect();
|
||||
|
|
|
@ -851,7 +851,7 @@ declare_lint! {
|
|||
pub(crate) static POSSIBLY_UNRESOLVED_REFERENCE = {
|
||||
summary: "detects references to possibly undefined names",
|
||||
status: LintStatus::preview("1.0.0"),
|
||||
default_level: Level::Warn,
|
||||
default_level: Level::Ignore,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue