Skip to content

Commit

Permalink
chore: Switch from flake8+isort to ruff (#60)
Browse files Browse the repository at this point in the history
* chore: Switch from flake8+isort to ruff

* Updated pre-commit config to use local commands for lint and formatting

* cargo fmt was run twice

Signed-off-by: Luka Peschke <[email protected]>

* Run pre-commit for python AND rust

Signed-off-by: Luka Peschke <[email protected]>
  • Loading branch information
lukapeschke authored Nov 25, 2022
1 parent ec920d0 commit 5ce9b5b
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 21 deletions.
28 changes: 14 additions & 14 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,21 @@ repos:
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- repo: https://github.com/psf/black
rev: 22.8.0
hooks:
- id: black
- repo: http://github.com/PyCQA/isort
rev: 5.10.1
hooks:
- id: isort
- repo: http://github.com/PyCQA/flake8
rev: 5.0.4
hooks:
- id: flake8
exclude: test.py
- repo: http://github.com/doublify/pre-commit-rust
rev: v1.0
hooks:
- id: fmt
- id: cargo-check
- repo: local
hooks:
- id: lint
name: Lint
entry: make lint
types_or: [python, rust]
language: system
pass_filenames: false
- id: format
name: Format
entry: make format
types_or: [python, rust]
language: system
pass_filenames: false
8 changes: 3 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@

# Commands
## Python
flake8 = flake8 python/fastexcel *.py
isort = isort python/fastexcel *.py
ruff = ruff python/fastexcel *.py
black = black python/fastexcel *.py
mypy = mypy python/fastexcel *.py
pytest = python -m pytest
Expand All @@ -12,14 +11,13 @@ clippy = cargo clippy
fmt = cargo fmt

lint:
$(flake8)
$(isort) --check-only --df
$(ruff)
$(black) --check --diff
$(mypy)
$(clippy)
format:
$(black)
$(isort)
$(ruff) --fix
$(fmt)

install-test-requirements:
Expand Down
6 changes: 6 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,9 @@ warn_unused_ignores = true
testpaths = [
"python/tests"
]

[tool.ruff]
line-length = 100

# Enable Pyflakes `E` and `F` codes by default.
select = ["E", "F", "Q"]
3 changes: 1 addition & 2 deletions test-requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
mypy>=0.982,<1
flake8>=5.0.4,<6
black>=22.8.0,<23
isort>=5.10.1,<6
pre-commit>=2.20.0,<3
pytest>=7.1.3
ruff>=0.0.138,<0.1

0 comments on commit 5ce9b5b

Please sign in to comment.