Skip to content

Commit

Permalink
pre-commit autoupdate; add to Makefile; use ruff
Browse files Browse the repository at this point in the history
ruff is really fast and has the rules of most of the linters we were
using so far.
  • Loading branch information
yagebu committed Sep 15, 2024
1 parent 1b12989 commit 5438391
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 32 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,10 @@ jobs:
python-version: ${{ matrix.python-version }}
- name: Install Dependencies
run: |
pip install tox wheel setuptools
pip install tox wheel setuptools pre-commit
- name: Run lint
run: >-
pre-commit run -a
tox -e lint
- name: Run tests
run: >-
Expand Down
26 changes: 5 additions & 21 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,30 +17,14 @@ repos:
- id: mixed-line-ending
args: ['--fix=auto']

- repo: https://github.com/pycqa/isort
rev: 5.13.2
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.6.5
hooks:
- id: isort

- repo: https://github.com/psf/black
rev: 24.8.0
hooks:
- id: black
language_version: python3

- repo: https://github.com/PyCQA/flake8
rev: 7.1.1
hooks:
- id: flake8

- repo: https://github.com/asottile/pyupgrade
rev: v3.15.0
hooks:
- id: pyupgrade
args: ["--py37-plus"]
- id: ruff
- id: ruff-format

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.11.1
rev: v1.11.2
hooks:
- id: mypy
args: [--install-types, --non-interactive, --ignore-missing-imports]
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ test:

.PHONY: lint
lint:
tox -e format
pre-commit run -a
tox -e lint

.PHONY: install
Expand Down
10 changes: 10 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,13 @@ build-backend = "setuptools.build_meta"

[tool.black]
line-length = 79

[tool.ruff]
target-version = "py38"
line-length = 79

[tool.ruff.lint]
extend-select = [
"I", # isort
"UP", # pyupgrade
]
9 changes: 0 additions & 9 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,10 @@ deps =
jieba
commands = pytest -v tests

[testenv:format]
skip_install = True
deps = black
commands = black .

[testenv:lint]
deps =
black
flake8
pylint
pytest
jieba
commands =
black --check smart_importer tests
flake8 smart_importer tests
pylint smart_importer tests

0 comments on commit 5438391

Please sign in to comment.