Skip to content

Commit

Permalink
feat: replace black and isort with ruff
Browse files Browse the repository at this point in the history
  • Loading branch information
smotornyuk committed Aug 14, 2024
1 parent 1245d7a commit 619522b
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 15 deletions.
2 changes: 1 addition & 1 deletion ckanext/toolbelt/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.4.24"
__version__ = "0.4.25"
10 changes: 1 addition & 9 deletions ckanext/toolbelt/cli/templates/config_pre-commit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,9 @@ repos:
- id: debug-statements
stages: [pre-push]

## Isort
- repo: https://github.com/pycqa/isort
rev: 5.12.0
hooks:
- id: isort
name: isort
stages: [pre-commit]

## Ruff
- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: v0.0.260
rev: v0.5.0
hooks:
- id: ruff
args: [--fix]
Expand Down
28 changes: 23 additions & 5 deletions ckanext/toolbelt/cli/templates/template_ruff.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,27 @@ target-version = "py38"

[tool.ruff.lint]
select = [
# "ANN0", # type annotations for function arguments
# "B", # likely bugs and design problems
# "BLE", # do not catch blind exception
# "C40", # better list/set/dict comprehensions
# "C4", # better list/set/dict comprehensions
# "C90", # check McCabe complexity
# "COM", # trailing commas
# "DTZ", # enforce timezone in date objects
"E", # pycodestyle error
# "W", # pycodestyle warning
"F", # pyflakes
# "FA", # verify annotations from future
# "G", # format strings for logging statements
# "N", # naming conventions
"I", # isort
# "ICN", # import conventions
# "D1", # require doc
# "D2", # doc formatting
# "D4", # doc convention
# "PL", # pylint
# "PERF", # performance anti-patterns
# "PT", # pytest style
# "PIE", # misc lints
# "Q", # preferred quoting style
# "RET", # improvements for return statements
# "RSE", # improvements for rise statements
# "S", # security testing
Expand All @@ -28,14 +35,25 @@ select = [
# "UP", # upgrade syntax for newer versions of the language
]
ignore = [
"RET503", # don't enforce return-None
"E712", # comparison to bool: violated by SQLAlchemy filters
"PT004", # fixture does not return anything, add leading underscore: violated by clean_db
"PLC1901", # simplify comparison to empty string: violated by SQLAlchemy filters
"COM812", # conflicts with `ruff format`
]

[tool.ruff.lint.per-file-ignores]
"ckanext/$PLUGIN/tests*" = ["S", "PL"]
"ckanext/$PLUGIN/tests*" = ["S", "PL", "ANN"]
"ckanext/$PLUGIN/logic/*" = [
"D417", # actions don't describe context and data_dict
]

[tool.ruff.lint.flake8-import-conventions.aliases]
"ckan.plugins" = "p"
"ckan.plugins.toolkit" = "tk"
sqlalchemy = "sa"

[tool.ruff.lint.pydocstyle]
convention = "google"

[tool.ruff.lint.isort]
section-order = [
Expand Down

0 comments on commit 619522b

Please sign in to comment.