Skip to content

Commit

Permalink
Sort into permanent and TODO
Browse files Browse the repository at this point in the history
  • Loading branch information
nstarman committed May 3, 2023
1 parent 2f06ccf commit 3c2124a
Showing 1 changed file with 142 additions and 123 deletions.
265 changes: 142 additions & 123 deletions .ruff.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,125 +7,140 @@ exclude=[
"*_lextab.py"
]
extend-ignore = [
# ---------------------------------------------------------------
# Permanent

# flake8-builtins (A) : shadowing a Python built-in.
# New ones should be avoided and is up to maintainers to enforce.
"A00",

# flake8-bugbear (B)
"B008", # FunctionCallArgumentDefault

# flake8-commas (COM)
"COM812", # TrailingCommaMissing
"COM819", # TrailingCommaProhibited

# pydocstyle (D)
# Missing Docstrings
"D105", # Missing docstring in magic method. Don't check b/c class docstring.
"D107", # Missing docstring in __init__. Don't check b/c class docstring.
"D213", # multi-line-summary-second-line
# Whitespace Issues
"D200", # FitsOnOneLine
"D203", # OneBlankLineBeforeClass.
# Docstring Content Issues
"D410", # BlankLineAfterSection. Using D412 instead.
"D400", # EndsInPeriod. Using D415 instead.
"D413", # BlankLineAfterLastSection.
"D416", # SectionNameEndsInColon.

# pycodestyle (E, W)
"E711", # NoneComparison (see unfixable)
"E741", # AmbiguousVariableName | physics variables are often poor code variables

# Pyflakes (F)
"F403", # ImportStarUsed

# pandas-vet (PD)
"PD",

# flake8-self
"SLF001", # private member access

# Ruff-specific rules (RUF)
"RUF005", # unpack-instead-of-concatenating-to-collection-literal -- it's not clearly faster.

# ---------------------------------------------------------------
# TODO

# flake8-annotations (ANN) : static typing
# TODO: revisit this when Astropy implements typing.
"ANN",

# flake8-unused-arguments (ARG)
# TODO: fix all of these.
"ARG001", "ARG002", "ARG003", "ARG004", "ARG005",

# flake8-bugbear (B)
"B004", # UnreliableCallableCheck # TODO: fix
"B005", # StripWithMultiCharacters # NOTE: low priority fix
"B006", # MutableArgumentDefault # NOTE: low priority fix
"B007", # UnusedLoopControlVariable # TODO: autofix
"B008", # FunctionCallArgumentDefault
"B015", # UselessComparison # TODO: fix
"B018", # UselessExpression # TODO: fix
"B020", # LoopVariableOverridesIterator # TODO: fix
"B023", # FunctionUsesLoopVariable # TODO: fix
"B024", # AbstractBaseClassWithoutAbstractMethod # TODO: fix
"B026", # StarArgUnpackingAfterKeywordArg # NOTE: low priority fix
"B028", # No-explicit-stacklevel # TODO: fix
"B904", # RaiseWithoutFromInsideExcept # TODO: fix
"B905", # ZipWithoutExplicitStrict # TODO: fix
"B004", # UnreliableCallableCheck
"B005", # StripWithMultiCharacters
"B006", # MutableArgumentDefault
"B007", # UnusedLoopControlVariable
"B015", # UselessComparison
"B018", # UselessExpression
"B020", # LoopVariableOverridesIterator
"B023", # FunctionUsesLoopVariable
"B024", # AbstractBaseClassWithoutAbstractMethod
"B026", # StarArgUnpackingAfterKeywordArg
"B028", # No-explicit-stacklevel
"B904", # RaiseWithoutFromInsideExcept
"B905", # ZipWithoutExplicitStrict # requires 3.10+

# flake8-blind-except (BLE)
"BLE001", # BlindExcept # TODO: fix
"BLE001", # BlindExcept

# flake8-comprehensions (C4)
# these detect if there are better and faster list/set/dict comprehensions.
"C400", "C406", "C408", "C413", "C416", # TODO: autofix
"C414", # UnnecessaryDoubleCastOrProcess # TODO: fix
"C417", # UnnecessaryMap (over a comprehension) # NOTE: low priority fix
"C400", "C406", "C408", "C413", "C416",
"C414", # UnnecessaryDoubleCastOrProcess
"C417", # UnnecessaryMap (over a comprehension)

# mccabe (C90) : code complexity
# TODO: fix, but probably pretty challenging.
"C901",

# flake8-commas (COM)
"COM812", # TrailingCommaMissing
"COM818", # TrailingCommaOnBareTupleProhibited
"COM819", # TrailingCommaProhibited

# pydocstyle (D)
# Missing Docstrings
"D100", # PublicModule # TODO: fix
"D101", # PublicClass # TODO: fix
"D100", # PublicModule
"D101", # PublicClass
"D102", # Missing docstring in public method. Don't check b/c docstring inheritance.
"D103", # PublicFunction # TODO: fix
"D104", # PublicPackage # TODO: fix
"D105", # Missing docstring in magic method. Don't check b/c class docstring.
"D107", # Missing docstring in __init__. Don't check b/c class docstring.
# Whitespace Issues
"D200", # FitsOnOneLine
"D203", # OneBlankLineBeforeClass. Don't check.
"D205", # BlankLineAfterSummary # TODO: fix
"D212", "D213", # MultiLineSummaryFirst/Second Line # TODO: fix one of these
"D103", # PublicFunction
"D104", # PublicPackage
"D205", # BlankLineAfterSummary
# Quotes Issues
"D300", # UsesTripleQuotes # TODO: fix
"D301", # UsesRPrefixForBackslashedContent # TODO: fix
"D300", # UsesTripleQuotes
"D301", # UsesRPrefixForBackslashedContent
# Docstring Content Issues
"D402", # NoSignature # TODO: fix
"D403", # FirstLineCapitalized
"D404", # NoThisPrefix
"D410", # BlankLineAfterSection. Using D412 instead.
"D400", # EndsInPeriod. Using D415 instead.
"D401", # non-imperative-mood.
"D413", # BlankLineAfterLastSection. Don't check.
"D414", # NonEmptySection # TODO: fix
"D416", # SectionNameEndsInColon. Don't check.
"D417", # DocumentAllArguments # TODO: fix
"D419", # docstring is empty # TODO: fix
"D414", # NonEmptySection
"D419", # docstring is empty

# flake8-datetimez (DTZ)
# TODO: fix by including the tzinfo.
"DTZ001", "DTZ003", "DTZ005", "DTZ007",

# pycodestyle (E, W)
"E501", # LineTooLong # TODO! fix
"E711", # NoneComparison (see unfixable)
"E721", # TypeComparison # TODO: fix
"E731", # DoNotAssignLambda # TODO: autofix
"E741", # AmbiguousVariableName
"E999", # SyntaxError # TODO: fix
"E501", # LineTooLong
"E721", # TypeComparison
"E731", # DoNotAssignLambda

# flake8-errmsg (EM) : nicer error tracebacks
# NOTE: low priority fix
"EM",
"EM101", # raw-string-in-exception
"EM102", # f-string-in-exception
"EM103", # dot-format-in-exception

# eradicate (ERA)
# NOTE: autofix, but be careful that some developer notes are kept.
"ERA001", # CommentedOutCode
"ERA001", # CommentedOutCode # be careful that some developer notes are kept.

# flake8-executable (EXE)
"EXE002", # shebang-missing-executable-file

# Pyflakes (F)
"F403", # ImportStarUsed
"F821", # UndefinedName # TODO: fix
"F841", # UnusedVariable # TODO: autofix
"F821", # UndefinedName
"F841", # UnusedVariable

# flake8-boolean-trap (FBT) : boolean flags should be kwargs, not args
# NOTE: a good thing to fix, but changes API.
"FBT001", "FBT002", "FBT003",

# flake8-logging-format (G)
"G001", # logging-string-format # TODO: fix
"G003", # logging-string-concat # TODO: fix
"G004", # logging-f-string # TODO: fix
"G001", # logging-string-format
"G004", # logging-f-string

# isort (I)
# TODO: replace isort with this.
"I001",

# flake8-import-conventions (ICN) : use conventional import aliases
# TODO: fix.
"ICN001",

# flake8-implicit-str-concat (ISC)
Expand All @@ -139,100 +154,104 @@ extend-ignore = [
"NPY002", # Replace legacy `np.random.rand` call with `np.random.Generator`

# flake8-pie (PIE)
"PIE790", # NoUnnecessaryPass # TODO: autofix
"PIE794", # DupeClassFieldDefinitions # TODO: autofix
"PIE804", # no-unnecessary-dict-kwargs # TODO: fix
"PIE810", # single-starts-ends-with # TODO: fix

# pandas-vet (PD)
"PD",
"PIE790", # NoUnnecessaryPass
"PIE794", # DupeClassFieldDefinitions
"PIE804", # no-unnecessary-dict-kwargs
"PIE810", # single-starts-ends-with

# pygrep-hooks (PGH)
"PGH001", # TODO: fix in astropy.utils.introspection
"PGH001",

# Pylint (PLC, PLE, PLR, PLW)
"PLC1901", # compare-to-empty-string # TODO: fix
"PLE0101", # return-in-init # TODO: fix
"PLE0605", # invalid-all-format # TODO: fix
"PLR0402", # ConsiderUsingFromImport # TODO: fix
"PLR1701", # ConsiderMergingIsinstance # TODO: fix
"PLR2004", # MagicValueComparison # Note: low priority fix
"PLC1901", # compare-to-empty-string
"PLE0101", # return-in-init
"PLE0605", # invalid-all-format
"PLR0402", # ConsiderUsingFromImport
"PLR2004", # MagicValueComparison
"PLR0911", # too-many-return-statements
"PLR0912", # too-many-branches
"PLR5501", # collapsible-else-if # TODO: fix
"PLR5501", # collapsible-else-if
"PLR0913", # too-many-args
"PLR0915", # too-many-statements
"PLW0120", # UselessElseOnLoop # Note: low priority fix
"PLW0129", # assert-on-string-literal # TODO: fix
"PLW0602", # GlobalVariableNotAssigned # TODO: fix
"PLW2901", # redefined-loop-name # TODO: fix. Easy source of bugs!
"PLW0603", # global-statement # Maybe fix?
"PLW0120", # UselessElseOnLoop
"PLW0129", # assert-on-string-literal
"PLW0602", # GlobalVariableNotAssigned
"PLW2901", # redefined-loop-name
"PLW0603", # global-statement

# flake8-pytest-style (PT)
# TODO: fix many of these.
"PT",
"PT001", # pytest-fixture-incorrect-parentheses-style
"PT003", # pytest-extraneous-scope-function
"PT004", # pytest-missing-fixture-name-underscore
"PT006", # pytest-parametrize-names-wrong-type
"PT007", # pytest-parametrize-values-wrong-type
"PT011", # pytest-raises-too-broad
"PT012", # pytest-raises-with-multiple-statements
"PT013", # pytest-incorrect-pytest-import
"PT015", # pytest-assert-always-false
"PT017", # pytest-assert-in-exceptinstead
"PT018", # pytest-composite-assertion
"PT019", # pytest-fixture-param-without-value
"PT021", # pytest-fixture-finalizer-callback
"PT022", # pytest-useless-yield-fixture
"PT023", # pytest-incorrect-mark-parentheses-style

# flake8-use-pathlib (PTH)
# TODO: fix many / all of these. ``pathlib`` is often preferred.
"PTH",

# flake8-return (RET)
"RET",

# flake8-raise (RSE)
"RSE102", # unnecessary-paren-on-raise-exception # TODO: fix
"RSE102", # unnecessary-paren-on-raise-exception

# Ruff-specific rules (RUF)
"RUF001", "RUF002", "RUF003", # AmbiguousUnicode, maybe fix?
"RUF005", # unpack-instead-of-concatenating-to-collection-literal -- it's not clearly faster.

# flake8-bandit (S)
"S101", # UseOfAssert # TODO: fix
"S105", # HardcodedPasswordString # TODO: fix by adding noqa
"S110", # TryExceptPass # TODO: fix
"S112", # try-except-continue # TODO: fix
"S301", # suspeciious-pickle-usage # TODO: fix
"S311", # Suspecious-non-cryptographic-randomness # TODO: fix
"S101", # UseOfAssert
"S105", # HardcodedPasswordString
"S110", # TryExceptPass
"S112", # try-except-continue
"S301", # suspeciious-pickle-usage
"S311", # Suspecious-non-cryptographic-randomness
"S324", # hashlib-insecure-hash-function
"S506", # UnsafeYAMLLoad # TODO: fix
"S310", # Suspicious-url-open-usage # TODO: fix
"S321", # Suspecious-ftp-lib-usage # TODO: fix
"S506", # UnsafeYAMLLoad
"S310", # Suspicious-url-open-usage
"S321", # Suspecious-ftp-lib-usage
"S603", # `subprocess` call: check for execution of untrusted input
"S605", # Starting a process with a shell, possible injection detected # TODO: fix
"S605", # Starting a process with a shell, possible injection detected
"S607", # Starting a process with a partial executable path
"S608", # Posslibe SQL injection # TODO: fix
"S608", # Posslibe SQL injection

# flake8-simplify (SIM)
"SIM102", # NestedIfStatements # TODO: fixable with `pass`.
"SIM102", # NestedIfStatements
"SIM105", # UseContextlibSuppress
"SIM108", # UseTernaryOperator # TODO? autofix. Impact on readability?
"SIM114", # if-with-same-arms # TODO: fix by combining with `or`
"SIM115", # OpenFileWithContextHandler # TODO: fix to prevent resource leak
"SIM117", # MultipleWithStatements # TODO: fix
"SIM118", # KeyInDict # TODO: autofix, but be careful of Mapping
"SIM201", # NegateEqualOp # TODO: autofix, ensure neq is implemented
"SIM202", # NegateNotEqualOp # TODO: autofix, ensure eq is implemented
"SIM300", # yoda condition # TODO: partially on & not aggressive

# flake8-self
"SLF001", # private member access
"SIM108", # UseTernaryOperator # Impact on readability?
"SIM114", # if-with-same-arms
"SIM115", # OpenFileWithContextHandler
"SIM117", # MultipleWithStatements
"SIM118", # KeyInDict # be careful of Mapping
"SIM201", # NegateEqualOp # ensure neq is implemented
"SIM202", # NegateNotEqualOp # ensure eq is implemented
"SIM300", # yoda condition # wait until not too aggressive

# flake8-print (T20)
"T201", # PrintUsed # TODO: change to logging
"T201", # PrintUsed # change to logging

# tryceratops (TRY)
"TRY002", # raise-vanilla-class # NOTE: low priority fix, requiring API change
"TRY002", # raise-vanilla-class
"TRY003", # raise-vanilla-args
"TRY004", # prefer-type-error # TODO: fix, but breaks API
"TRY200", # reraise-no-cause # TODO: fix
"TRY201", # verbose-raise # TODO: fix
"TRY300", # Consider `else` block # TODO: fix
"TRY301", # raise-within-try # TODO: fix
"TRY400", # error-instead-of-exception # TODO: fix
"TRY004", # prefer-type-error
"TRY200", # reraise-no-cause
"TRY201", # verbose-raise
"TRY300", # Consider `else` block
"TRY301", # raise-within-try
"TRY400", # error-instead-of-exception

# flake8-quotes (Q)
"Q000", # use double quotes # TODO: fix
"Q002", # double quote docstring (D300) # TODO: fix
"Q000", # use double quotes
"Q002", # double quote docstring (D300)
]
unfixable = [
"E711" # NoneComparison. Hard to fix b/c numpy has it's own None.
Expand Down

0 comments on commit 3c2124a

Please sign in to comment.