Skip to content

Commit

Permalink
Replace flake8, isort and black for ruff
Browse files Browse the repository at this point in the history
Replace linters and autoformatters for ruff.
  • Loading branch information
santisoler committed Dec 6, 2024
1 parent 58278ca commit 2bfd65b
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 72 deletions.
40 changes: 0 additions & 40 deletions .flake8

This file was deleted.

9 changes: 4 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -38,19 +38,18 @@ test_numba:
rm -rvf $(TESTDIR)

format:
isort $(CHECK_STYLE)
black $(CHECK_STYLE)
ruff check --select I --fix $(CHECK_STYLE) # fix isort errors
ruff format $(CHECK_STYLE)
burocrata --extension=py $(CHECK_STYLE)

check: check-format check-style

check-format:
isort --check $(CHECK_STYLE)
black --check $(CHECK_STYLE)
ruff format --check $(CHECK_STYLE)
burocrata --check --extension=py $(CHECK_STYLE)

check-style:
flake8 $(CHECK_STYLE)
ruff check $(CHECK_STYLE)

clean:
find . -name "*.pyc" -exec rm -v {} \;
Expand Down
6 changes: 3 additions & 3 deletions choclo/prism/_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ def is_point_on_east_face(
easting,
northing,
upward,
prism_west, # noqa: U100
prism_west, # noqa: ARG001
prism_east,
prism_south,
prism_north,
Expand Down Expand Up @@ -296,7 +296,7 @@ def is_point_on_north_face(
upward,
prism_west,
prism_east,
prism_south, # noqa: U100
prism_south, # noqa: ARG001
prism_north,
prism_bottom,
prism_top,
Expand Down Expand Up @@ -341,7 +341,7 @@ def is_point_on_top_face(
prism_east,
prism_south,
prism_north,
prism_bottom, # noqa: U100
prism_bottom, # noqa: ARG001
prism_top,
):
"""
Expand Down
13 changes: 1 addition & 12 deletions env/requirements-style.txt
Original file line number Diff line number Diff line change
@@ -1,13 +1,2 @@
black
pathspec
isort
flake8
flake8-bugbear
flake8-builtins
flake8-functions
flake8-mutable
flake8-rst-docstrings
flake8-simplify
flake8-unused-arguments
pep8-naming
ruff
burocrata
13 changes: 1 addition & 12 deletions environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,6 @@ dependencies:
- jupyter-sphinx==0.5.*
- matplotlib
# Style
- black
- pathspec
- isort
- flake8
- flake8-bugbear
- flake8-builtins
- flake8-functions
- flake8-mutable
- flake8-rst-docstrings
- flake8-simplify
- flake8-unused-arguments
- pep8-naming
- ruff
- pip:
- burocrata
24 changes: 24 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,27 @@ notice = '''
#
# This code is part of the Fatiando a Terra project (https://www.fatiando.org)
#'''

[tool.ruff]
line-length = 88
exclude = [
"doc/_build",
"choclo/_version.py",
]

[tool.ruff.lint]
select = [
"E", # pycodestyle
"F", # Pyflakes
"UP", # pyupgrade
"B", # flake8-bugbear
"ARG", # unused arguments
# "SIM", # flake8-simplify
"I", # isort
]

[tool.ruff.lint.per-file-ignores]
# disable unused-imports errors on __init__.py
"__init__.py" = ["F401"]
# disable unused arguments in kernel files
"_kernels.py" = ["ARG001"]

0 comments on commit 2bfd65b

Please sign in to comment.