--- minimum_pre_commit_version: "2.17" default_stages: [commit] default_language_version: python: python3.12 ci: skip: [mypy, pylint] repos: # ---------------------------------------------- # Meta hooks # ---------------------------------------------- - repo: meta hooks: - id: identity stages: [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: 2c9f875913ee60ca25ce70243dc24d5b6415598c # frozen: v4.6.0 hooks: - id: check-case-conflict - id: check-shebang-scripts-are-executable exclude: '^.*\.rs$' stages: [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: 1dc9eb131c2ea4816c708e4d85820d2cc8542683 # frozen: v0.5.0 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: 4c97c4a0d921007af6fefae92d8447cfbf63720b # frozen: 1.18.0 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: 2c9f875913ee60ca25ce70243dc24d5b6415598c # frozen: v4.6.0 hooks: - id: end-of-file-fixer stages: [commit] - id: trailing-whitespace stages: [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: '(^|//!?|#|