From bbbac2cfa55619e2695ce623adeaea81a9fd0c81 Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Mon, 2 Sep 2024 13:46:14 +0200 Subject: [PATCH] Add pre-commit --- .github/workflows/build.yml | 15 +++++--- .pre-commit-config.yaml | 69 +++++++++++++++++++++++++++++++++++++ 2 files changed, 80 insertions(+), 4 deletions(-) create mode 100644 .pre-commit-config.yaml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index fb48263..10ebf4c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -22,12 +22,19 @@ jobs: - uses: actions/setup-python@v5 with: python-version: 3.11 - # - uses: pre-commit/action@v3.0.1 - - run: pip install pipenv ruff - - run: ruff check --exit-zero --output-format=github --target-version=py311 + - run: pip install pipenv - run: pipenv install --dev - name: Versions run: | python3 --version echo "Node.js $(node --version)" - innd --version || inn2 --version || true + nnptd --version || innd --version || inn2 --version || true + + pre-commit: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: 3.x + - uses: pre-commit/action@v3.0.1 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..f2ba99a --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,69 @@ +# Learn more about this config here: https://pre-commit.com/ + +# To enable these pre-commit hooks run: +# `pipx install pre-commit` or `brew install pre-commit` +# Then in the project root directory run `pre-commit install` + +repos: + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.6.0 + hooks: + - id: check-added-large-files + - id: check-ast + - id: check-builtin-literals + - id: check-byte-order-marker + - id: check-case-conflict + - id: check-docstring-first + - id: check-executables-have-shebangs + - id: check-json + - id: check-merge-conflict + - id: check-shebang-scripts-are-executable + - id: check-symlinks + - id: check-toml + - id: check-vcs-permalinks + - id: check-xml + - id: check-yaml + - id: debug-statements + - id: destroyed-symlinks + - id: detect-private-key + - id: end-of-file-fixer + - id: file-contents-sorter + - id: fix-byte-order-marker + - id: forbid-new-submodules + - id: forbid-submodules + - id: mixed-line-ending + - id: name-tests-test + #- id: pretty-format-json + # exclude: fe/jsconfig.json,Pipfile.lock + - id: requirements-txt-fixer + - id: sort-simple-yaml + - id: trailing-whitespace + + - repo: https://github.com/MarcoGorelli/auto-walrus + rev: 0.3.4 + hooks: + - id: auto-walrus + + - repo: https://github.com/codespell-project/codespell + rev: v2.3.0 + hooks: + - id: codespell # See pyproject.toml for args + args: ["--ignore-words-list=teh"] + additional_dependencies: + - tomli + + - repo: https://github.com/charliermarsh/ruff-pre-commit + rev: v0.6.3 + hooks: # Format before linting + - id: ruff-format + - id: ruff + + - repo: https://github.com/tox-dev/pyproject-fmt + rev: 2.2.1 + hooks: + - id: pyproject-fmt + + - repo: https://github.com/abravalheri/validate-pyproject + rev: v0.19 + hooks: + - id: validate-pyproject