mirror of
https://github.com/astral-sh/ruff.git
synced 2025-09-29 13:25:17 +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
|
@ -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();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue