Skip to content

Commit

Permalink
Add Ruff config to pre-commit
Browse files Browse the repository at this point in the history
  • Loading branch information
larrybradley committed Aug 8, 2024
1 parent 839f7e5 commit 44c628c
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 2 deletions.
7 changes: 7 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,13 @@ repos:
- id: python-check-blanket-noqa
# Enforce that all noqa annotations always occur with specific codes.

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: "v0.4.7"
hooks:
- id: ruff
# args: ["--fix", "--show-fixes"]
args: ["--show-fixes"]

- repo: https://github.com/asottile/pyupgrade
rev: v3.17.0
hooks:
Expand Down
37 changes: 35 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -161,12 +161,10 @@ exclude_lines = [
[tool.repo-review]
ignore = [
'MY', # ignore MyPy
'RF', # ignore flake8-bugbear
'PC110', # ignore using black or ruff-format in pre-commit
'PC111', # ignore using blacken-docs in pre-commit
'PC140', # ignore using mypy in pre-commit
'PC180', # ignore using prettier in pre-commit
'PC190', # ignore using pre-commit in pre-commit
'PC901', # ignore using custom pre-commit update message
'PY005', # ignore having a tests/ folder
]
Expand Down Expand Up @@ -198,3 +196,38 @@ skips = ['*_test.py', '*/test_*.py', '*/tests/helpers.py']
wrap-summaries = 72
pre-summary-newline = true
make-summary-multi-line = true

[tool.ruff.lint]
select = ['E', 'F', 'UP', 'B', 'SIM', 'PL', 'FLY', 'NPY', 'PERF', 'INT',
'RSE', 'Q', 'N', 'W', 'D', 'I']
ignore = [
'E501',
'B028',
'B905', # revisit
'D100',
'D101',
'D102',
'D103',
'D105',
'D107',
'D200',
'D205',
'D212',
'D404',
'I001',
'PLR0912',
'PLR0913',
'PLR0915',
'PLR2004',
'PLW2901',
'Q000',
'SIM910',
'UP038',
]

[tool.ruff.lint.per-file-ignores]
'__init__.py' = ['D104', 'I']
'docs/conf.py' = ['ERA001', 'INP001', 'TRY400']

[tool.ruff.lint.pydocstyle]
convention = 'numpy'

0 comments on commit 44c628c

Please sign in to comment.