mirror of
https://github.com/astral-sh/ruff.git
synced 2025-09-30 05:45:24 +00:00
Improve display of rules in --show-settings
(#11003)
Closes https://github.com/astral-sh/ruff/issues/11002
This commit is contained in:
parent
0a6327418d
commit
16cc9bd78d
2 changed files with 123 additions and 121 deletions
|
@ -68,128 +68,128 @@ file_resolver.project_root = "[BASEPATH]"
|
||||||
linter.exclude = []
|
linter.exclude = []
|
||||||
linter.project_root = "[BASEPATH]"
|
linter.project_root = "[BASEPATH]"
|
||||||
linter.rules.enabled = [
|
linter.rules.enabled = [
|
||||||
MultipleImportsOnOneLine,
|
multiple-imports-on-one-line (E401),
|
||||||
ModuleImportNotAtTopOfFile,
|
module-import-not-at-top-of-file (E402),
|
||||||
MultipleStatementsOnOneLineColon,
|
multiple-statements-on-one-line-colon (E701),
|
||||||
MultipleStatementsOnOneLineSemicolon,
|
multiple-statements-on-one-line-semicolon (E702),
|
||||||
UselessSemicolon,
|
useless-semicolon (E703),
|
||||||
NoneComparison,
|
none-comparison (E711),
|
||||||
TrueFalseComparison,
|
true-false-comparison (E712),
|
||||||
NotInTest,
|
not-in-test (E713),
|
||||||
NotIsTest,
|
not-is-test (E714),
|
||||||
TypeComparison,
|
type-comparison (E721),
|
||||||
BareExcept,
|
bare-except (E722),
|
||||||
LambdaAssignment,
|
lambda-assignment (E731),
|
||||||
AmbiguousVariableName,
|
ambiguous-variable-name (E741),
|
||||||
AmbiguousClassName,
|
ambiguous-class-name (E742),
|
||||||
AmbiguousFunctionName,
|
ambiguous-function-name (E743),
|
||||||
IOError,
|
io-error (E902),
|
||||||
SyntaxError,
|
syntax-error (E999),
|
||||||
UnusedImport,
|
unused-import (F401),
|
||||||
ImportShadowedByLoopVar,
|
import-shadowed-by-loop-var (F402),
|
||||||
UndefinedLocalWithImportStar,
|
undefined-local-with-import-star (F403),
|
||||||
LateFutureImport,
|
late-future-import (F404),
|
||||||
UndefinedLocalWithImportStarUsage,
|
undefined-local-with-import-star-usage (F405),
|
||||||
UndefinedLocalWithNestedImportStarUsage,
|
undefined-local-with-nested-import-star-usage (F406),
|
||||||
FutureFeatureNotDefined,
|
future-feature-not-defined (F407),
|
||||||
PercentFormatInvalidFormat,
|
percent-format-invalid-format (F501),
|
||||||
PercentFormatExpectedMapping,
|
percent-format-expected-mapping (F502),
|
||||||
PercentFormatExpectedSequence,
|
percent-format-expected-sequence (F503),
|
||||||
PercentFormatExtraNamedArguments,
|
percent-format-extra-named-arguments (F504),
|
||||||
PercentFormatMissingArgument,
|
percent-format-missing-argument (F505),
|
||||||
PercentFormatMixedPositionalAndNamed,
|
percent-format-mixed-positional-and-named (F506),
|
||||||
PercentFormatPositionalCountMismatch,
|
percent-format-positional-count-mismatch (F507),
|
||||||
PercentFormatStarRequiresSequence,
|
percent-format-star-requires-sequence (F508),
|
||||||
PercentFormatUnsupportedFormatCharacter,
|
percent-format-unsupported-format-character (F509),
|
||||||
StringDotFormatInvalidFormat,
|
string-dot-format-invalid-format (F521),
|
||||||
StringDotFormatExtraNamedArguments,
|
string-dot-format-extra-named-arguments (F522),
|
||||||
StringDotFormatExtraPositionalArguments,
|
string-dot-format-extra-positional-arguments (F523),
|
||||||
StringDotFormatMissingArguments,
|
string-dot-format-missing-arguments (F524),
|
||||||
StringDotFormatMixingAutomatic,
|
string-dot-format-mixing-automatic (F525),
|
||||||
FStringMissingPlaceholders,
|
f-string-missing-placeholders (F541),
|
||||||
MultiValueRepeatedKeyLiteral,
|
multi-value-repeated-key-literal (F601),
|
||||||
MultiValueRepeatedKeyVariable,
|
multi-value-repeated-key-variable (F602),
|
||||||
ExpressionsInStarAssignment,
|
expressions-in-star-assignment (F621),
|
||||||
MultipleStarredExpressions,
|
multiple-starred-expressions (F622),
|
||||||
AssertTuple,
|
assert-tuple (F631),
|
||||||
IsLiteral,
|
is-literal (F632),
|
||||||
InvalidPrintSyntax,
|
invalid-print-syntax (F633),
|
||||||
IfTuple,
|
if-tuple (F634),
|
||||||
BreakOutsideLoop,
|
break-outside-loop (F701),
|
||||||
ContinueOutsideLoop,
|
continue-outside-loop (F702),
|
||||||
YieldOutsideFunction,
|
yield-outside-function (F704),
|
||||||
ReturnOutsideFunction,
|
return-outside-function (F706),
|
||||||
DefaultExceptNotLast,
|
default-except-not-last (F707),
|
||||||
ForwardAnnotationSyntaxError,
|
forward-annotation-syntax-error (F722),
|
||||||
RedefinedWhileUnused,
|
redefined-while-unused (F811),
|
||||||
UndefinedName,
|
undefined-name (F821),
|
||||||
UndefinedExport,
|
undefined-export (F822),
|
||||||
UndefinedLocal,
|
undefined-local (F823),
|
||||||
UnusedVariable,
|
unused-variable (F841),
|
||||||
UnusedAnnotation,
|
unused-annotation (F842),
|
||||||
RaiseNotImplemented,
|
raise-not-implemented (F901),
|
||||||
]
|
]
|
||||||
linter.rules.should_fix = [
|
linter.rules.should_fix = [
|
||||||
MultipleImportsOnOneLine,
|
multiple-imports-on-one-line (E401),
|
||||||
ModuleImportNotAtTopOfFile,
|
module-import-not-at-top-of-file (E402),
|
||||||
MultipleStatementsOnOneLineColon,
|
multiple-statements-on-one-line-colon (E701),
|
||||||
MultipleStatementsOnOneLineSemicolon,
|
multiple-statements-on-one-line-semicolon (E702),
|
||||||
UselessSemicolon,
|
useless-semicolon (E703),
|
||||||
NoneComparison,
|
none-comparison (E711),
|
||||||
TrueFalseComparison,
|
true-false-comparison (E712),
|
||||||
NotInTest,
|
not-in-test (E713),
|
||||||
NotIsTest,
|
not-is-test (E714),
|
||||||
TypeComparison,
|
type-comparison (E721),
|
||||||
BareExcept,
|
bare-except (E722),
|
||||||
LambdaAssignment,
|
lambda-assignment (E731),
|
||||||
AmbiguousVariableName,
|
ambiguous-variable-name (E741),
|
||||||
AmbiguousClassName,
|
ambiguous-class-name (E742),
|
||||||
AmbiguousFunctionName,
|
ambiguous-function-name (E743),
|
||||||
IOError,
|
io-error (E902),
|
||||||
SyntaxError,
|
syntax-error (E999),
|
||||||
UnusedImport,
|
unused-import (F401),
|
||||||
ImportShadowedByLoopVar,
|
import-shadowed-by-loop-var (F402),
|
||||||
UndefinedLocalWithImportStar,
|
undefined-local-with-import-star (F403),
|
||||||
LateFutureImport,
|
late-future-import (F404),
|
||||||
UndefinedLocalWithImportStarUsage,
|
undefined-local-with-import-star-usage (F405),
|
||||||
UndefinedLocalWithNestedImportStarUsage,
|
undefined-local-with-nested-import-star-usage (F406),
|
||||||
FutureFeatureNotDefined,
|
future-feature-not-defined (F407),
|
||||||
PercentFormatInvalidFormat,
|
percent-format-invalid-format (F501),
|
||||||
PercentFormatExpectedMapping,
|
percent-format-expected-mapping (F502),
|
||||||
PercentFormatExpectedSequence,
|
percent-format-expected-sequence (F503),
|
||||||
PercentFormatExtraNamedArguments,
|
percent-format-extra-named-arguments (F504),
|
||||||
PercentFormatMissingArgument,
|
percent-format-missing-argument (F505),
|
||||||
PercentFormatMixedPositionalAndNamed,
|
percent-format-mixed-positional-and-named (F506),
|
||||||
PercentFormatPositionalCountMismatch,
|
percent-format-positional-count-mismatch (F507),
|
||||||
PercentFormatStarRequiresSequence,
|
percent-format-star-requires-sequence (F508),
|
||||||
PercentFormatUnsupportedFormatCharacter,
|
percent-format-unsupported-format-character (F509),
|
||||||
StringDotFormatInvalidFormat,
|
string-dot-format-invalid-format (F521),
|
||||||
StringDotFormatExtraNamedArguments,
|
string-dot-format-extra-named-arguments (F522),
|
||||||
StringDotFormatExtraPositionalArguments,
|
string-dot-format-extra-positional-arguments (F523),
|
||||||
StringDotFormatMissingArguments,
|
string-dot-format-missing-arguments (F524),
|
||||||
StringDotFormatMixingAutomatic,
|
string-dot-format-mixing-automatic (F525),
|
||||||
FStringMissingPlaceholders,
|
f-string-missing-placeholders (F541),
|
||||||
MultiValueRepeatedKeyLiteral,
|
multi-value-repeated-key-literal (F601),
|
||||||
MultiValueRepeatedKeyVariable,
|
multi-value-repeated-key-variable (F602),
|
||||||
ExpressionsInStarAssignment,
|
expressions-in-star-assignment (F621),
|
||||||
MultipleStarredExpressions,
|
multiple-starred-expressions (F622),
|
||||||
AssertTuple,
|
assert-tuple (F631),
|
||||||
IsLiteral,
|
is-literal (F632),
|
||||||
InvalidPrintSyntax,
|
invalid-print-syntax (F633),
|
||||||
IfTuple,
|
if-tuple (F634),
|
||||||
BreakOutsideLoop,
|
break-outside-loop (F701),
|
||||||
ContinueOutsideLoop,
|
continue-outside-loop (F702),
|
||||||
YieldOutsideFunction,
|
yield-outside-function (F704),
|
||||||
ReturnOutsideFunction,
|
return-outside-function (F706),
|
||||||
DefaultExceptNotLast,
|
default-except-not-last (F707),
|
||||||
ForwardAnnotationSyntaxError,
|
forward-annotation-syntax-error (F722),
|
||||||
RedefinedWhileUnused,
|
redefined-while-unused (F811),
|
||||||
UndefinedName,
|
undefined-name (F821),
|
||||||
UndefinedExport,
|
undefined-export (F822),
|
||||||
UndefinedLocal,
|
undefined-local (F823),
|
||||||
UnusedVariable,
|
unused-variable (F841),
|
||||||
UnusedAnnotation,
|
unused-annotation (F842),
|
||||||
RaiseNotImplemented,
|
raise-not-implemented (F901),
|
||||||
]
|
]
|
||||||
linter.per_file_ignores = {}
|
linter.per_file_ignores = {}
|
||||||
linter.safety_table.forced_safe = []
|
linter.safety_table.forced_safe = []
|
||||||
|
|
|
@ -291,7 +291,9 @@ impl Display for RuleSet {
|
||||||
} else {
|
} else {
|
||||||
writeln!(f, "[")?;
|
writeln!(f, "[")?;
|
||||||
for rule in self {
|
for rule in self {
|
||||||
writeln!(f, "\t{rule:?},")?;
|
let name = rule.as_ref();
|
||||||
|
let code = rule.noqa_code();
|
||||||
|
writeln!(f, "\t{name} ({code}),")?;
|
||||||
}
|
}
|
||||||
write!(f, "]")?;
|
write!(f, "]")?;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue