Skip to content

Commit

Permalink
ENH: Refactor code linter and formatter dependencies
Browse files Browse the repository at this point in the history
Refactor code linter and formatter dependencies:
- Remove `black`, `flake8` and `isort` dependencies from
  `pyproject.toml`: the role has been taken over by `ruff` in commit
  81b3690.
- Transfer the `black` and `isort` rules left behind to `ruff` in
  `pyproject.toml`
- Remove `black`, `flake8` and `isort` from the pre-commit config file
  and use `ruff` instead.

Set explicitly `eddymotion` as the known first party so that the
`import` statements corresponding to `eddymotion` are separated by a
blank line from third-party package `import` statements.

Add `--diff` to the `ruff check` command in the contribution checks
GitHub Actions workflow so that the differences that need to be applied
are actually shown on GitHub.
  • Loading branch information
jhlegarreta committed Mar 28, 2024
1 parent afc5270 commit 2dc2c67
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 40 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/contrib.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ jobs:
with:
python-version: 3
- name: Lint EddyMotion
run: pipx run ruff check
run: pipx run ruff check --diff
16 changes: 5 additions & 11 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,9 @@ repos:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: debug-statements
- repo: https://github.com/timothycrosley/isort
rev: 5.10.1
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.3.4
hooks:
- id: isort
- repo: https://github.com/psf/black
rev: 22.3.0
hooks:
- id: black
- repo: https://github.com/pycqa/flake8
rev: 4.0.1
hooks:
- id: flake8
- id: ruff
args: [ --fix ]
- id: ruff-format
46 changes: 18 additions & 28 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,7 @@ doc = [
]

dev = [
"black",
"flake8",
"flake8-pyproject",
"isort",
"ruff",
"pre-commit",
"pre-commit-hooks",
]
Expand Down Expand Up @@ -113,32 +110,21 @@ version-file = "src/eddymotion/_version.py"
# Developer tool configurations
#

[tool.black]
line-length = 99
target-version = ['py39']
skip-string-normalization = true
exclude = '''
# Directories
/(
\.eggs
| \.git
| \.hg
| \.mypy_cache
| \.tox
| \.venv
| venv
| _build
| build
| dist
)/
'''

[tool.isort]
profile = 'black'
skip_gitignore = true

[tool.ruff]
line-length = 99
target-version = "py39"
exclude = [
".eggs",
".git",
".hg",
".mypy_cache",
".tox",
".venv",
"venv",
"_build",
"build",
"dist",
]

[tool.ruff.lint]
select = [
Expand All @@ -147,6 +133,7 @@ select = [
"C",
"W",
"B",
"I",
]
ignore = [
"E203"
Expand All @@ -164,6 +151,9 @@ inline-quotes = "double"
[tool.ruff.format]
quote-style = "double"

[tool.ruff.lint.isort]
known-first-party=["eddymotion"]

[tool.pytest.ini_options]
pythonpath = "src/ test/"
norecursedirs = [".*", "_*"]
Expand Down

0 comments on commit 2dc2c67

Please sign in to comment.