--- minimum_pre_commit_version: "2.17" default_stages: [pre-commit] default_language_version: python: python3.12 ci: skip: [mypy, pylint] repos: # ---------------------------------------------- # Meta hooks # ---------------------------------------------- - repo: meta hooks: - id: identity stages: [pre-commit, manual] - id: check-hooks-apply stages: [manual] - id: check-useless-excludes stages: [manual] # ---------------------------------------------- # File hooks # ---------------------------------------------- # file checking out-of-the-box hooks - repo: https://github.com/pre-commit/pre-commit-hooks rev: cef0300fd0fc4d2a87a85fa2093c6b283ea36f4b # frozen: v5.0.0 hooks: - id: check-case-conflict - id: check-shebang-scripts-are-executable exclude: '^.*\.rs$' stages: [pre-commit] - id: check-symlinks - id: destroyed-symlinks - id: forbid-new-submodules # #################################################################################### # # FORMATTING # # #################################################################################### # ---------------------------------------------- # Python # ---------------------------------------------- # ruff - python linter with fixing ability - repo: https://github.com/astral-sh/ruff-pre-commit rev: 76e47323a83cd9795e4ff9a1de1c0d2eef610f17 # frozen: v0.11.11 hooks: - id: ruff name: ruff (fix) args: ["--fix-only", "--exit-non-zero-on-fix", "--config=pyproject.toml"] - id: ruff-format name: ruff (format) # blacken-docs - black for python code in docs (rst/md/tex) - repo: https://github.com/asottile/blacken-docs rev: 78a9dcbecf4f755f65d1f3dec556bc249d723600 # frozen: 1.19.1 hooks: - id: blacken-docs args: ["--line-length=100", "--target-version=py312"] exclude: testing|tests # ---------------------------------------------- # JS / TS / HTML / CSS / MD / JSON / YAML # ---------------------------------------------- # prettier - multi formatter - repo: https://github.com/pre-commit/mirrors-prettier rev: f12edd9c7be1c20cfa42420fd0e6df71e42b51ea # frozen: v4.0.0-alpha.8 hooks: - id: prettier additional_dependencies: - "prettier@^3.2.4" # ---------------------------------------------- # Spelling dict # ---------------------------------------------- # Custom hook as python command - repo: local hooks: - id: sort-spelling-dicts name: Sort spelling_dict.txt files description: Sort spelling_dict.txt files language: python entry: python args: - "-c" - | import pathlib; import sys; p = pathlib.Path(sys.argv[1]); p.write_text("\n".join(sorted(set(p.read_text("utf-8").splitlines()))) + "\n", "utf-8") files: "spelling_dict.txt" # ---------------------------------------------- # General (code unspecific) # ---------------------------------------------- # code unspecific out-of-the-box hooks - repo: https://github.com/pre-commit/pre-commit-hooks rev: cef0300fd0fc4d2a87a85fa2093c6b283ea36f4b # frozen: v5.0.0 hooks: - id: end-of-file-fixer stages: [pre-commit] - id: trailing-whitespace stages: [pre-commit] # #################################################################################### # # LINTING # # #################################################################################### # ---------------------------------------------- # General (code unspecific) # ---------------------------------------------- - repo: local hooks: # Find TODO:|FIXME: comments in all files # Inline skip: `#i#` directly after the colon after the tag-word - id: find-todos name: "Find TODO:|FIXME: comments" description: "Check for TODO:|FIXME: comments in all files" language: pygrep entry: '(^|//!?|#|