Skip to content

Commit

Permalink
Update Ruff Config (#2659)
Browse files Browse the repository at this point in the history
* Set line length same as black

* Sync .ruff.toml with astropy

Keeping ANN201, has 22 occurances, TRY300 has 1, UP308 was added but we don't need

* Add ISC001 from astropy project.toml

* Sync astropy pyproject.toml with tardis

* Remove TRY300 from ruff.toml
  • Loading branch information
atharva-2001 authored Jun 19, 2024
1 parent 9aec7a7 commit 26b6005
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 13 deletions.
11 changes: 0 additions & 11 deletions .ruff.toml
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,6 @@ lint.ignore = [
"FIX001", # Line contains FIXME. this should be fixed or at least FIXME replaced with TODO
"FIX004", # Line contains HACK. replace HACK with NOTE.

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

# pep8-naming (N)
# NOTE: some of these can/should be fixed, but this changes the API.
"N801", # invalid-class-name
Expand All @@ -107,14 +104,10 @@ lint.ignore = [
"PERF203", # `try`-`except` within a loop incurs performance overhead
"PERF401", # Use a list comprehension to create a transformed list

# pygrep-hooks (PGH)
"PGH001", # eval

# Pylint (PLC, PLE, PLR, PLW)
"PLE0101", # return-in-init
"PLR0124", # Name compared with itself
"PLR0402", # ConsiderUsingFromImport
"PLR0911", # too-many-return-statements
"PLR0912", # too-many-branches
"PLR0913", # too-many-args
"PLR0915", # too-many-statements
Expand Down Expand Up @@ -163,8 +156,6 @@ lint.ignore = [
"RET502", # implicit-return-value
"RET503", # implicit-return
"RET504", # unnecessary-assign
"RET505", # superfluous-else-return
"RET506", # superfluous-else-raise
"RET507", # superfluous-else-continue

# flake8-raise (RSE)
Expand Down Expand Up @@ -214,9 +205,7 @@ lint.ignore = [
"TRY002", # raise-vanilla-class
"TRY003", # raise-vanilla-args
"TRY004", # prefer-type-error
"TRY200", # reraise-no-cause
"TRY201", # verbose-raise
"TRY300", # Consider `else` block
"TRY301", # raise-within-try

# flake8-quotes (Q)
Expand Down
13 changes: 11 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ verbose = 0
#whitelist-regex = []

[tool.ruff]
line-length = 80
lint.select = ["ALL"]
exclude=[]
lint.ignore = [ # NOTE: non-permanent exclusions should be added to `.ruff.toml` instead.
Expand Down Expand Up @@ -86,6 +87,10 @@ lint.ignore = [ # NOTE: non-permanent exclusions should be added to `.ruff.toml
# flake8-fixme (FIX)
"FIX002", # Line contains TODO | notes for improvements are OK iff the code works

# ISC001 shouldn't be used with ruff format
# https://docs.astral.sh/ruff/formatter/#conflicting-lint-rules
"ISC001",

# pep8-naming (N)
"N803", # invalid-argument-name. Physics variables are often poor code variables
"N806", # non-lowercase-variable-in-function. Physics variables are often poor code variables
Expand All @@ -109,8 +114,6 @@ lint.ignore = [ # NOTE: non-permanent exclusions should be added to `.ruff.toml
"test_*.py" = [
"B018", # UselessExpression
"D", # pydocstyle
"E402", # Module level import not at top of file
"PGH001", # No builtin eval() allowed
"S101", # Use of assert detected
]
".pyinstaller/*.py" = ["INP001"] # Not a package.
Expand All @@ -123,6 +126,12 @@ lint.ignore = [ # NOTE: non-permanent exclusions should be added to `.ruff.toml
ignore-fully-untyped = true
mypy-init-return = true

[tool.ruff.lint.flake8-comprehensions]
allow-dict-calls-with-keyword-arguments = true

[tool.ruff.lint.flake8-type-checking]
exempt-modules = []

[tool.ruff.lint.isort]
known-first-party = ["tardis", "carsus", "stardis"]

Expand Down

0 comments on commit 26b6005

Please sign in to comment.