Skip to content

Commit

Permalink
Update pre-commit hooks and Ruff configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
baptiste-pasquier committed Apr 15, 2024
1 parent 7868535 commit 8f9c34f
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 68 deletions.
25 changes: 10 additions & 15 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,17 @@ repos:
- id: check-toml
- id: check-json
- id: check-added-large-files
- repo: local

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.3.1
hooks:
- id: isort
name: Sorting imports (isort)
entry: isort
types: [python]
language: system
- id: ruff
name: Linting (ruff)
entry: ruff --fix
types: [python]
language: system
args: [ --fix ]
- id: ruff-format

- repo: https://github.com/kynan/nbstripout
rev: 0.7.1
hooks:
- id: nbstripout
name: Strip Jupyter notebook output (nbstripout)
entry: nbstripout
types: [file]
files: (.ipynb)$
language: system

exclude: ^(.svn|CVS|.bzr|.hg|.git|__pycache__|.tox|.ipynb_checkpoints|assets|tests/assets/|venv/|.venv/)
66 changes: 13 additions & 53 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,64 +20,24 @@ requires-python = ">=3.8"
packages = ["lib", "config", "tests"]

[tool.ruff]
target-version = "py310"

[tool.ruff.lint]
select = [
"E",
"W",
"F",
"I",
"N",
"Q",
"PTH",
"PD",
] # See: https://beta.ruff.rs/docs/rules/
"E", # pycodestyle
"W", # pycodestyle
"F", # Pyflakes
"I", # isort
"N", # pep8-naming
"Q", # flake8-quotes
"PTH", # flake8-use-pathlib
"PD", # pandas-vet
] # See: https://docs.astral.sh/ruff/rules/
ignore = ["D100", "D103", "D203", "D213", "ANN101", "ANN102"]
line-length = 140
target-version = "py310"
exclude = [
".bzr",
".direnv",
".eggs",
".git",
".ruff_cache",
".svn",
".tox",
".venv",
"__pypackages__",
"_build",
"buck-out",
"build",
"dist",
"node_modules",
"venv",
]

[tool.ruff.pydocstyle]
[tool.ruff.lint.pydocstyle]
convention = "google"

# https://black.readthedocs.io/en/stable/usage_and_configuration/the_basics.html
[tool.black]
line-length = 100
target-version = ["py310"]
include = '\.pyi?$'
exclude = '''
(
/(
\.direnv
| \.eggs
| \.git
| \.tox
| \.venv
| _build
| build
| dist
| venv
)/
)
'''

[tool.isort]
profile = "black"

[tool.bandit]
exclude_dirs = [".venv", "tests"]
skips = ["B101", "B104"]

0 comments on commit 8f9c34f

Please sign in to comment.