Skip to content

Commit

Permalink
chore: bump ruff and move config to ruff.toml
Browse files Browse the repository at this point in the history
  • Loading branch information
cpcloud committed Feb 4, 2024
1 parent 4f62118 commit 817cfaa
Show file tree
Hide file tree
Showing 4 changed files with 131 additions and 129 deletions.
38 changes: 20 additions & 18 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

110 changes: 0 additions & 110 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -399,116 +399,6 @@ skip = "*.lock,.direnv,.git,./docs/_freeze,docs/_freeze/**,*.svg,*.css,*.html,*.
ignore-regex = '\b(i[if]f|I[IF]F|AFE)\b'
builtin = "clear,rare,names"

[tool.ruff]
line-length = 88
select = [
"B", # flake8-bugbear
"BLE", # flake8-blind-except
"C4", # comprehensions
"D", # pydocstyle
"E", # pycodestyle
"EXE", # flake8-executable
"F", # pyflakes
"FA", # flake8-future-annotations
"G", # flake8-logging-format
"FLY", # flynt (format string conversion)
"I", # isort
"ICN", # flake8-import-conventions
"INP", # flake8-no-pep420 (implicit namespace packages)
"ISC", # flake8-implicit-str-concat
"PGH", # pygrep-hooks
"PIE", # flake8-pie
"PL", # pylint
"RET", # flake8-return
"RUF", # ruff-specific rules
"SIM", # flake8-simplify
"T10", # flake8-debugger
"T20", # flake8-print
"TCH", # flake8-type-checking
"TID", # flake8-tidy-imports
"UP", # pyupgrade
"W", # pycodestyle
"YTT", # flake8-2020
]
respect-gitignore = true
ignore = [
"B028", # required stacklevel argument to warn
"B904", # raise from e or raise from None in exception handlers
"C408", # dict(...) as literal
"D100", # public module
"D101", # public class
"D102", # public method
"D103", # public function
"D104", # public package
"D105", # magic methods
"D106", # nested class
"D107", # init
"D202", # blank lines after function docstring
"D203", # blank line before class docstring
"D213", # Multi-line docstring summary should start at the second line
"D401", # Imperative mood
"D402", # First line should not be the function's signature
"D413", # Blank line required after last section
"E501", # line-too-long, this is automatically enforced by ruff format
"E731", # lambda-assignment
"ISC001", # single line implicit string concat, handled by ruff format
"PGH003", # blanket-type-ignore
"PLC0105", # covariant type parameters should have a _co suffix
"PLR0124", # name compared with self, e.g., a == a
"PLR0911", # too many return statements
"PLR0912", # too many branches
"PLR0913", # too many arguments
"PLR0915", # too many statements
"PLR2004", # forces everything to be a constant
"PLW2901", # overwriting loop variable
"RET504", # unnecessary-assign, these are useful for debugging
"RET505", # superfluous-else-return, stylistic choice
"RET506", # superfluous-else-raise, stylistic choice
"RET507", # superfluous-else-continue, stylistic choice
"RET508", # superfluous-else-break, stylistic choice
"RUF005", # splat instead of concat
"RUF012", # Mutable class attributes should be annotated with `typing.ClassVar`
"SIM102", # nested ifs
"SIM108", # convert everything to ternary operator
"SIM114", # combine `if` branches using logical `or` operator
"SIM116", # dictionary instead of `if` statements
"SIM117", # nested with statements
"SIM118", # remove .keys() calls from dictionaries
"SIM300", # yoda conditions
"UP007", # Optional[str] -> str | None
]
exclude = ["*_py310.py"]
target-version = "py39"
# none of these codes will be automatically fixed by ruff
unfixable = [
"T201", # print statements
"F401", # unused imports
"RUF100", # unused noqa comments
"F841", # unused variables
]

[tool.ruff.pyupgrade]
keep-runtime-typing = true

[tool.ruff.isort]
required-imports = ["from __future__ import annotations"]

[tool.ruff.per-file-ignores]
"*test*.py" = [
"D", # ignore all docstring lints in tests
]
"{docs,ci}/**/*.py" = ["INP001"]
"*/decompiled.py" = ["ALL"]
"{ci/release/verify_release,docs/**/*_impl}.py" = [
"T201",
] # prints output using `print`
"docs/**/{datafusion,polars}_*.py" = ["T201"] # prints output using `print`

[tool.ruff.format]
exclude = [".direnv", "result-*", "_py310.py", "decompiled.py"]
docstring-code-format = true
docstring-code-line-length = 88

[tool.conda-lock]
channels = ["conda-forge"]

Expand Down
2 changes: 1 addition & 1 deletion requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ requests[socks]==2.31.0 ; python_version >= "3.10" and python_version < "3.13"
rich==13.7.0 ; python_version >= "3.9" and python_version < "4.0"
rpds-py==0.17.1 ; python_version >= "3.10" and python_version < "3.13"
rsa==4.9 ; python_version >= "3.9" and python_version < "4"
ruff==0.1.13 ; python_version >= "3.9" and python_version < "4.0"
ruff==0.2.0 ; python_version >= "3.9" and python_version < "4.0"
scikit-learn==1.3.2 ; python_version >= "3.10" and python_version < "3.13"
scipy==1.11.4 ; python_version >= "3.10" and python_version < "3.13"
scooby==0.9.2 ; python_version >= "3.10" and python_version < "3.13"
Expand Down
110 changes: 110 additions & 0 deletions ruff.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
line-length = 88
respect-gitignore = true
exclude = ["*_py310.py"]
target-version = "py39"

[lint]
select = [
"B", # flake8-bugbear
"BLE", # flake8-blind-except
"C4", # comprehensions
"D", # pydocstyle
"E", # pycodestyle
"EXE", # flake8-executable
"F", # pyflakes
"FA", # flake8-future-annotations
"G", # flake8-logging-format
"FLY", # flynt (format string conversion)
"I", # isort
"ICN", # flake8-import-conventions
"INP", # flake8-no-pep420 (implicit namespace packages)
"ISC", # flake8-implicit-str-concat
"PGH", # pygrep-hooks
"PIE", # flake8-pie
"PL", # pylint
"RET", # flake8-return
"RUF", # ruff-specific rules
"SIM", # flake8-simplify
"T10", # flake8-debugger
"T20", # flake8-print
"TCH", # flake8-type-checking
"TID", # flake8-tidy-imports
"UP", # pyupgrade
"W", # pycodestyle
"YTT", # flake8-2020
]
ignore = [
"B028", # required stacklevel argument to warn
"B904", # raise from e or raise from None in exception handlers
"C408", # dict(...) as literal
"D100", # public module
"D101", # public class
"D102", # public method
"D103", # public function
"D104", # public package
"D105", # magic methods
"D106", # nested class
"D107", # init
"D202", # blank lines after function docstring
"D203", # blank line before class docstring
"D213", # Multi-line docstring summary should start at the second line
"D401", # Imperative mood
"D402", # First line should not be the function's signature
"D413", # Blank line required after last section
"E501", # line-too-long, this is automatically enforced by ruff format
"E731", # lambda-assignment
"ISC001", # single line implicit string concat, handled by ruff format
"PGH003", # blanket-type-ignore
"PLC0105", # covariant type parameters should have a _co suffix
"PLR0124", # name compared with self, e.g., a == a
"PLR0911", # too many return statements
"PLR0912", # too many branches
"PLR0913", # too many arguments
"PLR0915", # too many statements
"PLR2004", # forces everything to be a constant
"PLW2901", # overwriting loop variable
"RET504", # unnecessary-assign, these are useful for debugging
"RET505", # superfluous-else-return, stylistic choice
"RET506", # superfluous-else-raise, stylistic choice
"RET507", # superfluous-else-continue, stylistic choice
"RET508", # superfluous-else-break, stylistic choice
"RUF005", # splat instead of concat
"RUF012", # Mutable class attributes should be annotated with `typing.ClassVar`
"SIM102", # nested ifs
"SIM108", # convert everything to ternary operator
"SIM114", # combine `if` branches using logical `or` operator
"SIM116", # dictionary instead of `if` statements
"SIM117", # nested with statements
"SIM118", # remove .keys() calls from dictionaries
"SIM300", # yoda conditions
"UP007", # Optional[str] -> str | None
]
# none of these codes will be automatically fixed by ruff
unfixable = [
"T201", # print statements
"F401", # unused imports
"RUF100", # unused noqa comments
"F841", # unused variables
]

[lint.pyupgrade]
keep-runtime-typing = true

[lint.isort]
required-imports = ["from __future__ import annotations"]

[lint.per-file-ignores]
"*test*.py" = [
"D", # ignore all docstring lints in tests
]
"{docs,ci}/**/*.py" = ["INP001"]
"*/decompiled.py" = ["ALL"]
"{ci/release/verify_release,docs/**/*_impl}.py" = [
"T201",
] # prints output using `print`
"docs/**/{datafusion,polars}_*.py" = ["T201"] # prints output using `print`

[format]
exclude = [".direnv", "result-*", "_py310.py", "decompiled.py"]
docstring-code-format = true
docstring-code-line-length = 88

0 comments on commit 817cfaa

Please sign in to comment.