Skip to content

Commit

Permalink
update ruff commands due to deprecation (to use ruff check)
Browse files Browse the repository at this point in the history
  • Loading branch information
arbakker committed Jun 19, 2024
1 parent cead7b5 commit a4679f3
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 41 deletions.
2 changes: 1 addition & 1 deletion .githooks/pre-commit
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ black .

command_available "ruff"
print_message "running ruff linting" 2 "" true
ruff --fix .
ruff check --fix .

command_available "prettier"
print_message "running prettier formatting" 2 "" true
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/linting-and-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ jobs:
- name: Lint with ruff
run: |
python${{ matrix.python-version }} -m ruff -v .
python${{ matrix.python-version }} -m ruff check -v .
- name: Run Mypy
run: |
Expand Down
77 changes: 38 additions & 39 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,42 @@ namespaces = false # to disable scanning PEP 420 namespaces (true by default)
[tool.setuptools_scm]

[tool.ruff]
# see https://beta.ruff.rs/docs/rules/

# Exclude a variety of commonly ignored directories.
exclude = [
".bzr",
".direnv",
".eggs",
".git",
".git-rewrite",
".hg",
".mypy_cache",
".nox",
".pants.d",
".pytype",
".ruff_cache",
".svn",
".tox",
".venv",
"__pypackages__",
"_build",
"buck-out",
"build",
"dist",
"node_modules",
"venv",
"build"
]

line-length = 120

# Allow unused variables when underscore-prefixed.
target-version = "py39"

[tool.ruff.lint]

dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"

select = [
"E",
"F",
Expand Down Expand Up @@ -99,53 +134,17 @@ fixable = [
]
unfixable = []

# Exclude a variety of commonly ignored directories.
exclude = [
".bzr",
".direnv",
".eggs",
".git",
".git-rewrite",
".hg",
".mypy_cache",
".nox",
".pants.d",
".pytype",
".ruff_cache",
".svn",
".tox",
".venv",
"__pypackages__",
"_build",
"buck-out",
"build",
"dist",
"node_modules",
"venv",
"build"
]

line-length = 120

# Allow unused variables when underscore-prefixed.
dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"

target-version = "py39"

# disable rules for tests
[tool.ruff.per-file-ignores]
[tool.ruff.lint.per-file-ignores]
"tests/**/*.py" = [
"S101", # asserts allowed
"ANN", # no type annotation required
]

"src/coordinate_transformation_api/cityjson/models.py" = [
"N815", # non-snakecase variables allowed
]

"src/coordinate_transformation_api/util.py" = ["ANN"]


[tool.ruff.mccabe]
[tool.ruff.lint.mccabe]
# Unlike Flake8, default to a complexity level of 10.
max-complexity = 10

0 comments on commit a4679f3

Please sign in to comment.