Skip to content

Commit

Permalink
global: add pre-commit with ruff
Browse files Browse the repository at this point in the history
  • Loading branch information
PascalEgn committed Aug 6, 2024
1 parent 0f8ca9f commit fa018cb
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 1 deletion.
17 changes: 17 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
hooks:
- id: check-yaml
- id: end-of-file-fixer
- id: trailing-whitespace
- id: fix-byte-order-marker
- id: mixed-line-ending
- id: name-tests-test
args: [ --pytest-test-first ]
exclude: '^(?!factories/)'
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.5.6
hooks:
- id: ruff
args: [ --fix ]
29 changes: 29 additions & 0 deletions ruff.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
target-version = "py311"
[lint.flake8-tidy-imports]
ban-relative-imports = "all"

[lint]
select = [
# pycodestyle
"E",
# Pyflakes
"F",
# flake8-bugbear
"B",
# flake8-simplify
"SIM",
# isort
"I",
# flake8-tidy-imports
"TID",
# flake8-pytest-style
"PT",
]
ignore = ["B904", "B905"]


[lint.pycodestyle]
ignore-overlong-task-comments = true

[lint.pydocstyle]
convention = "google"
1 change: 0 additions & 1 deletion run-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,4 @@

set -e

flake8 inspire_json_merger tests
pytest tests/
5 changes: 5 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,14 @@
'pytest~=8.0,>=8.0.2;python_version >= "3.6"',
]

dev_require = [
"pre-commit==3.5.0",
]

extras_require = {
'docs': docs_require,
'tests': tests_require,
'dev': dev_require,
}

extras_require['all'] = []
Expand Down

0 comments on commit fa018cb

Please sign in to comment.