Skip to content

Commit cb59ef8

Browse files
committed
use DiagnosticTag for more pyflakes and panda rules
remove some tags
1 parent db80feb commit cb59ef8

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

crates/ruff_linter/src/checkers/noqa.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@ pub(crate) fn check_noqa(
130130
let edit = delete_comment(directive.range(), locator);
131131
let mut diagnostic = context
132132
.report_diagnostic(UnusedNOQA { codes: None }, directive.range());
133+
diagnostic.add_primary_tag(ruff_db::diagnostic::DiagnosticTag::Unnecessary);
133134
diagnostic.set_fix(Fix::safe_edit(edit));
134135
}
135136
}
@@ -226,6 +227,7 @@ pub(crate) fn check_noqa(
226227
},
227228
directive.range(),
228229
);
230+
diagnostic.add_primary_tag(ruff_db::diagnostic::DiagnosticTag::Unnecessary);
229231
diagnostic.set_fix(Fix::safe_edit(edit));
230232
}
231233
}

crates/ruff_linter/src/rules/pandas_vet/rules/subscript.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -165,16 +165,17 @@ pub(crate) fn subscript(checker: &Checker, value: &Expr, expr: &Expr) {
165165
match attr.as_str() {
166166
// PD007
167167
"ix" if checker.is_rule_enabled(Rule::PandasUseOfDotIx) => {
168-
checker.report_diagnostic(PandasUseOfDotIx, range)
168+
let mut diagnostic = checker.report_diagnostic(PandasUseOfDotIx, range);
169+
diagnostic.add_primary_tag(ruff_db::diagnostic::DiagnosticTag::Deprecated);
169170
}
170171
// PD008
171172
"at" if checker.is_rule_enabled(Rule::PandasUseOfDotAt) => {
172-
checker.report_diagnostic(PandasUseOfDotAt, range)
173+
checker.report_diagnostic(PandasUseOfDotAt, range);
173174
}
174175
// PD009
175176
"iat" if checker.is_rule_enabled(Rule::PandasUseOfDotIat) => {
176-
checker.report_diagnostic(PandasUseOfDotIat, range)
177+
checker.report_diagnostic(PandasUseOfDotIat, range);
177178
}
178-
_ => return,
179-
};
179+
_ => (),
180+
}
180181
}

crates/ruff_linter/src/rules/pyflakes/rules/redefined_while_unused.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,7 @@ pub(crate) fn redefined_while_unused(checker: &Checker, scope_id: ScopeId, scope
191191
},
192192
binding.range(),
193193
);
194+
diagnostic.add_primary_tag(ruff_db::diagnostic::DiagnosticTag::Unnecessary);
194195

195196
diagnostic.secondary_annotation(
196197
format_args!("previous definition of `{name}` here"),

0 commit comments

Comments
 (0)