Skip to content

Commit

Permalink
Add pre-commit hook to repo and to CI.
Browse files Browse the repository at this point in the history
  • Loading branch information
orionarcher committed May 7, 2024
1 parent 7fe6f7e commit eb20fd8
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 0 deletions.
13 changes: 13 additions & 0 deletions .github/workflows/CI.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,19 @@ concurrency:
cancel-in-progress: true

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: actions/setup-python@v5
with:
python-version: "3.9"
cache: pip
cache-dependency-path: pyproject.toml

- uses: pre-commit/action@v3.0.0

test:
name: Test on ${{ matrix.os }}, Python ${{ matrix.python-version }}
runs-on: ${{ matrix.os }}
Expand Down
46 changes: 46 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
default_language_version:
python: python3
exclude: ^(.github/|tests/test_data/abinit/)
repos:
- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: v0.4.2
hooks:
- id: ruff
args: [--fix]
- id: ruff-format
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
hooks:
- id: check-yaml
- id: fix-encoding-pragma
args: [--remove]
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/asottile/blacken-docs
rev: 1.16.0
hooks:
- id: blacken-docs
additional_dependencies: [black]
exclude: README.md
- repo: https://github.com/pre-commit/pygrep-hooks
rev: v1.10.0
hooks:
- id: python-use-type-annotations
- id: rst-backticks
- id: rst-directive-colons
- id: rst-inline-touching-normal
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.10.0
hooks:
- id: mypy
files: ^src/
additional_dependencies:
- tokenize-rt==4.1.0
- types-paramiko
- repo: https://github.com/codespell-project/codespell
rev: v2.2.6
hooks:
- id: codespell
stages: [commit, commit-msg]
args: [--ignore-words-list, 'titel,statics,ba,nd,te,atomate']
types_or: [python, rst, markdown]

0 comments on commit eb20fd8

Please sign in to comment.