From b563ea88094430dc1c60a25cebb37b20fd217c4d Mon Sep 17 00:00:00 2001 From: HenningRose Date: Mon, 13 Jan 2025 20:10:54 +0100 Subject: [PATCH] Initial commit 3 --- .pre-commit-config.yaml | 69 +++++++++++++++++++++++++++++++---------- 1 file changed, 53 insertions(+), 16 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 2e5898d..8c4d22e 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,10 +1,11 @@ default_language_version: python: python3 -exclude: 'ach_model.py' + repos: - repo: https://github.com/pre-commit/pre-commit-hooks rev: v4.3.0 hooks: + # list of supported hooks: https://pre-commit.com/hooks.html - id: trailing-whitespace - id: end-of-file-fixer - id: check-docstring-first @@ -13,19 +14,38 @@ repos: - id: detect-private-key - id: check-toml - id: check-case-conflict + # - id: check-executables-have-shebangs + #- id: check-added-large-files + + # python code formatting + # - repo: https://github.com/psf/black + # rev: 22.6.0 + # hooks: + # - id: black + # args: [--line-length, "99"] + # python import sorting - repo: https://github.com/PyCQA/isort rev: 5.12.0 hooks: - id: isort args: ["--profile", "black", "--filter-files"] + # python upgrading syntax to newer version - repo: https://github.com/asottile/pyupgrade rev: v2.32.1 hooks: - id: pyupgrade args: [--py38-plus] + # python docstring formatting + - repo: https://github.com/myint/docformatter + rev: v1.4 + hooks: + - id: docformatter + args: [--in-place, --wrap-summaries=99, --wrap-descriptions=99] + + # python check (PEP8), programming errors and code complexity - repo: https://github.com/PyCQA/flake8 rev: 4.0.1 hooks: @@ -38,28 +58,51 @@ repos: "logs/*,data/*", ] + # python security linter - repo: https://github.com/PyCQA/bandit rev: "1.7.1" hooks: - id: bandit args: ["-s", "B101"] + # yaml formatting + #- repo: https://github.com/pre-commit/mirrors-prettier + # rev: v2.1.0 + # hooks: + # - id: prettier + # types: [yaml] + + # shell scripts linter + # - repo: https://github.com/shellcheck-py/shellcheck-py + # rev: "v0.9.0.5" + # hooks: + # - id: shellcheck + # + - repo: https://github.com/astral-sh/ruff-pre-commit + # Ruff version. rev: v0.1.7 hooks: + # Run the linter. - id: ruff - args: [--fix] + args: [ --fix ] + # Run the formatter. - id: ruff-format + # md formatting - repo: https://github.com/executablebooks/mdformat - rev: 0.7.16 + rev: 0.7.14 hooks: - id: mdformat + args: ["--number"] additional_dependencies: - - mdformat-gfm==0.3.5 - - linkify-it-py==1.0.3 - - markdown-it-py==2.2.0 + - mdformat-gfm + - mdformat-tables + - mdformat_frontmatter + # - mdformat-toc + # - mdformat-black + # word spelling linter - repo: https://github.com/codespell-project/codespell rev: v2.1.0 hooks: @@ -68,12 +111,14 @@ repos: - --skip=logs/**,data/**,*.ipynb - --ignore-words-list=hist,circularly,ot + # jupyter notebook cell output clearing - repo: https://github.com/kynan/nbstripout rev: 0.5.0 hooks: - id: nbstripout - args: ["--strip-empty-cells"] + args: ["--install", "--attributes", ".gitattributes"] + # jupyter notebook linting - repo: https://github.com/nbQA-dev/nbQA rev: 1.4.0 hooks: @@ -86,12 +131,4 @@ repos: [ "--extend-ignore=E203,E402,E501,F401,F841", "--exclude=logs/*,data/*", - ] - - - repo: local # Adding this to handle `docs/requirements.txt` gracefully - hooks: - - id: skip-missing-requirements - name: Skip Missing Requirements - entry: echo "Skipping check for missing docs/requirements.txt" - language: system - files: ^docs/requirements\.txt$ + ] \ No newline at end of file