mirror of
https://github.com/astral-sh/ruff.git
synced 2026-10-28 10:45:37 +08:00
Update default rules for v0.17 (#28786)
Summary -- This makes a few modifications to our default rule set for v0.17. As the snapshots show, these had already been incorporated into our preview defaults via rule recategorization. This just ports them back to the stable default rules. This closes #27197, which brought the problems with the DTZ rules to our attention. F406 being a syntax error was raised in [this comment]. [this comment]: https://github.com/astral-sh/ruff/issues/27199#issuecomment-5093309966 Test Plan -- Updated snapshots
This commit is contained in:
1 parent
28ae9fbc68
commit
c94a19d3bc
3 files changed
+4
-36
No files matched your search
@@ -5084,16 +5084,9 @@ fn default_rules() -> Result<()> {
|
||||
unnecessary-map (C417),
|
||||
unnecessary-literal-within-dict-call (C418),
|
||||
unnecessary-comprehension-in-call (C419),
|
||||
call-datetime-without-tzinfo (DTZ001),
|
||||
call-datetime-today (DTZ002),
|
||||
call-datetime-utcnow (DTZ003),
|
||||
call-datetime-utcfromtimestamp (DTZ004),
|
||||
call-datetime-now-without-tzinfo (DTZ005),
|
||||
call-datetime-fromtimestamp (DTZ006),
|
||||
call-datetime-strptime-without-zone (DTZ007),
|
||||
call-date-today (DTZ011),
|
||||
call-date-fromtimestamp (DTZ012),
|
||||
datetime-min-max (DTZ901),
|
||||
debugger (T100),
|
||||
shebang-not-executable (EXE001),
|
||||
shebang-missing-executable-file (EXE002),
|
||||
@@ -5216,6 +5209,7 @@ fn default_rules() -> Result<()> {
|
||||
unused-import (F401),
|
||||
import-shadowed-by-loop-var (F402),
|
||||
late-future-import (F404),
|
||||
undefined-local-with-nested-import-star-usage (F406),
|
||||
future-feature-not-defined (F407),
|
||||
percent-format-invalid-format (F501),
|
||||
percent-format-expected-mapping (F502),
|
||||
|
||||
@@ -139,16 +139,9 @@ linter.rules.enabled = [
|
||||
unnecessary-map (C417),
|
||||
unnecessary-literal-within-dict-call (C418),
|
||||
unnecessary-comprehension-in-call (C419),
|
||||
call-datetime-without-tzinfo (DTZ001),
|
||||
call-datetime-today (DTZ002),
|
||||
call-datetime-utcnow (DTZ003),
|
||||
call-datetime-utcfromtimestamp (DTZ004),
|
||||
call-datetime-now-without-tzinfo (DTZ005),
|
||||
call-datetime-fromtimestamp (DTZ006),
|
||||
call-datetime-strptime-without-zone (DTZ007),
|
||||
call-date-today (DTZ011),
|
||||
call-date-fromtimestamp (DTZ012),
|
||||
datetime-min-max (DTZ901),
|
||||
debugger (T100),
|
||||
shebang-not-executable (EXE001),
|
||||
shebang-missing-executable-file (EXE002),
|
||||
@@ -271,6 +264,7 @@ linter.rules.enabled = [
|
||||
unused-import (F401),
|
||||
import-shadowed-by-loop-var (F402),
|
||||
late-future-import (F404),
|
||||
undefined-local-with-nested-import-star-usage (F406),
|
||||
future-feature-not-defined (F407),
|
||||
percent-format-invalid-format (F501),
|
||||
percent-format-expected-mapping (F502),
|
||||
@@ -554,16 +548,9 @@ linter.rules.should_fix = [
|
||||
unnecessary-map (C417),
|
||||
unnecessary-literal-within-dict-call (C418),
|
||||
unnecessary-comprehension-in-call (C419),
|
||||
call-datetime-without-tzinfo (DTZ001),
|
||||
call-datetime-today (DTZ002),
|
||||
call-datetime-utcnow (DTZ003),
|
||||
call-datetime-utcfromtimestamp (DTZ004),
|
||||
call-datetime-now-without-tzinfo (DTZ005),
|
||||
call-datetime-fromtimestamp (DTZ006),
|
||||
call-datetime-strptime-without-zone (DTZ007),
|
||||
call-date-today (DTZ011),
|
||||
call-date-fromtimestamp (DTZ012),
|
||||
datetime-min-max (DTZ901),
|
||||
debugger (T100),
|
||||
shebang-not-executable (EXE001),
|
||||
shebang-missing-executable-file (EXE002),
|
||||
@@ -686,6 +673,7 @@ linter.rules.should_fix = [
|
||||
unused-import (F401),
|
||||
import-shadowed-by-loop-var (F402),
|
||||
late-future-import (F404),
|
||||
undefined-local-with-nested-import-star-usage (F406),
|
||||
future-feature-not-defined (F407),
|
||||
percent-format-invalid-format (F501),
|
||||
percent-format-expected-mapping (F502),
|
||||
|
||||
@@ -413,16 +413,9 @@ pub const DEFAULT_SELECTORS: &[RuleSelector] = &[
|
||||
RuleSelector::rule(Rule::UnnecessaryLiteralWithinDictCall), // C418
|
||||
RuleSelector::rule(Rule::UnnecessaryComprehensionInCall), // C419
|
||||
RuleSelector::rule(Rule::EmptyDocstring), // D419
|
||||
RuleSelector::rule(Rule::CallDatetimeWithoutTzinfo), // DTZ001
|
||||
RuleSelector::rule(Rule::CallDatetimeToday), // DTZ002
|
||||
RuleSelector::rule(Rule::CallDatetimeUtcnow), // DTZ003
|
||||
RuleSelector::rule(Rule::CallDatetimeUtcfromtimestamp), // DTZ004
|
||||
RuleSelector::rule(Rule::CallDatetimeNowWithoutTzinfo), // DTZ005
|
||||
RuleSelector::rule(Rule::CallDatetimeFromtimestamp), // DTZ006
|
||||
RuleSelector::rule(Rule::CallDatetimeStrptimeWithoutZone), // DTZ007
|
||||
RuleSelector::rule(Rule::CallDateToday), // DTZ011
|
||||
RuleSelector::rule(Rule::CallDateFromtimestamp), // DTZ012
|
||||
RuleSelector::rule(Rule::DatetimeMinMax), // DTZ901
|
||||
RuleSelector::rule(Rule::BareExcept), // E722
|
||||
RuleSelector::rule(Rule::IOError), // E902
|
||||
RuleSelector::rule(Rule::ShebangNotExecutable), // EXE001
|
||||
@@ -432,6 +425,7 @@ pub const DEFAULT_SELECTORS: &[RuleSelector] = &[
|
||||
RuleSelector::rule(Rule::UnusedImport), // F401
|
||||
RuleSelector::rule(Rule::ImportShadowedByLoopVar), // F402
|
||||
RuleSelector::rule(Rule::LateFutureImport), // F404
|
||||
RuleSelector::rule(Rule::UndefinedLocalWithNestedImportStarUsage), // F406
|
||||
RuleSelector::rule(Rule::FutureFeatureNotDefined), // F407
|
||||
RuleSelector::rule(Rule::PercentFormatInvalidFormat), // F501
|
||||
RuleSelector::rule(Rule::PercentFormatExpectedMapping), // F502
|
||||
@@ -1013,7 +1007,6 @@ mod tests {
|
||||
pandas-use-of-dot-read-table (PD012),
|
||||
pandas-use-of-pd-merge (PD015),
|
||||
escape-sequence-in-docstring (D301),
|
||||
undefined-local-with-nested-import-star-usage (F406),
|
||||
missing-maxsplit-arg (PLC0207),
|
||||
unnecessary-dunder-call (PLC2801),
|
||||
duplicate-bases (PLE0241),
|
||||
@@ -1071,13 +1064,6 @@ mod tests {
|
||||
Removed in preview:
|
||||
[
|
||||
exec-builtin (S102),
|
||||
call-datetime-without-tzinfo (DTZ001),
|
||||
call-datetime-now-without-tzinfo (DTZ005),
|
||||
call-datetime-fromtimestamp (DTZ006),
|
||||
call-datetime-strptime-without-zone (DTZ007),
|
||||
call-date-today (DTZ011),
|
||||
call-date-fromtimestamp (DTZ012),
|
||||
datetime-min-max (DTZ901),
|
||||
]
|
||||
");
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user