Last active
November 29, 2025 23:45
-
-
Save GatlenCulp/6052e4d60607edd1d879de084ad701e0 to your computer and use it in GitHub Desktop.
Standalone .pre-commit-config from gatlens-opinionated-template
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Documentation: https://gatlenculp.github.io/gatlens-opinionated-template/precommit/ | |
| exclude: | | |
| (?x)^( | |
| .*\{\{.*\}\}.*| # Exclude any files with cookiecutter variables | |
| docs/site/.*| # Exclude mkdocs compiled files | |
| \.history/.*| # Exclude history files | |
| .*cache.*/.*| # Exclude cache directories | |
| .*venv.*/.*| # Exclude virtual environment directories | |
| )$ | |
| fail_fast: true | |
| default_language_version: | |
| python: python{{ cookiecutter.python_version_number }} | |
| default_install_hook_types: | |
| - pre-commit | |
| - commit-msg | |
| repos: | |
| # ---------------------------------------------------------------------------- # | |
| # 🔄 Pre-Commit Hooks # | |
| # ---------------------------------------------------------------------------- # | |
| # ----------------------------- 🔒 Security Tools ---------------------------- # | |
| - repo: https://github.com/gitleaks/gitleaks | |
| rev: v8.24.2 | |
| hooks: | |
| - id: gitleaks | |
| name: "🔒 security · Detect hardcoded secrets" | |
| # --------------------------- 🔍 Code Quality Tools -------------------------- # | |
| ### Python Tools ### | |
| - repo: https://github.com/astral-sh/ruff-pre-commit | |
| rev: v0.14.7 | |
| hooks: | |
| - id: ruff-format | |
| name: "🐍 python · Format with Ruff" | |
| # {% if cookiecutter._qa_level == "strict" %} | |
| - id: ruff | |
| name: "🐍 python · Lint and perform safe auto-fixes with Ruff" | |
| args: [--fix] | |
| # {% else %} | |
| # - id: ruff | |
| # name: "🐍 python · Lint and perform safe auto-fixes with Ruff" | |
| # args: [--fix] | |
| # {% endif %} | |
| # {% if cookiecutter._qa_level == "strict" %} | |
| - repo: https://github.com/RobertCraigie/pyright-python | |
| rev: v1.1.407 | |
| hooks: | |
| - id: pyright | |
| name: "🐍 python · Check types" | |
| # {% else %} | |
| # - repo: https://github.com/RobertCraigie/pyright-python | |
| # rev: v1.1.407 | |
| # hooks: | |
| # - id: pyright | |
| # name: "🐍 python · Check types" | |
| # {% endif %} | |
| - repo: https://github.com/abravalheri/validate-pyproject | |
| rev: v0.24.1 | |
| hooks: | |
| - id: validate-pyproject | |
| name: "🐍 python · Validate pyproject.toml" | |
| additional_dependencies: ["validate-pyproject-schema-store[all]"] | |
| ### Javascript & Web Tools ### | |
| - repo: https://github.com/biomejs/pre-commit | |
| rev: "v2.3.8" | |
| hooks: | |
| - id: biome-check | |
| name: "🟨 javascript · Lint, format, and safe fixes with Biome" | |
| additional_dependencies: ["@biomejs/biome@1.9.4"] | |
| ### Data & Config Validation ### | |
| - repo: https://github.com/python-jsonschema/check-jsonschema | |
| rev: 0.35.0 | |
| hooks: | |
| - id: check-github-workflows | |
| name: "🐙 github-actions · Validate gh workflow files" | |
| args: ["--verbose"] | |
| - id: check-taskfile | |
| name: "✅ taskfile · Validate Task configuration" | |
| ### Markdown ### | |
| - repo: https://github.com/hukkin/mdformat | |
| rev: 0.7.22 | |
| hooks: | |
| - id: mdformat | |
| name: "📝 markdown · Format markdown" | |
| additional_dependencies: | |
| - mdformat-gfm | |
| - mdformat-ruff | |
| - mdformat-frontmatter | |
| - ruff | |
| # {% if cookiecutter._qa_level == "strict" %} | |
| - repo: https://github.com/markdownlint/markdownlint | |
| rev: v0.15.0 | |
| hooks: | |
| - id: markdownlint | |
| name: "📝 markdown · Lint markdown" | |
| # {% else %} | |
| # - repo: https://github.com/markdownlint/markdownlint | |
| # rev: v0.15.0 | |
| # hooks: | |
| # - id: markdownlint | |
| # name: "📝 markdown · Lint markdown" | |
| # {% endif %} | |
| ### Shell ### | |
| # {% if cookiecutter._qa_level == "strict" %} | |
| - repo: https://github.com/shellcheck-py/shellcheck-py | |
| rev: v0.11.0.1 | |
| hooks: | |
| - id: shellcheck | |
| name: "🐚 shell · Lint shell scripts" | |
| - repo: https://github.com/openstack/bashate | |
| rev: 2.1.1 | |
| hooks: | |
| - id: bashate | |
| name: "🐚 shell · Check shell script code style" | |
| # {% else %} | |
| # - repo: https://github.com/shellcheck-py/shellcheck-py | |
| # rev: v0.11.0.1 | |
| # hooks: | |
| # - id: shellcheck | |
| # name: "🐚 shell · Lint shell scripts" | |
| # - repo: https://github.com/openstack/bashate | |
| # rev: 2.1.1 | |
| # hooks: | |
| # - id: bashate | |
| # name: "🐚 shell · Check shell script code style" | |
| # {% endif %} | |
| ### Makefile ### | |
| - repo: https://github.com/mrtazz/checkmake.git | |
| rev: 0.2.2 | |
| hooks: | |
| - id: checkmake | |
| name: "🐮 Makefile · Lint Makefile" | |
| ### SQL ### | |
| - repo: https://github.com/sqlfluff/sqlfluff | |
| rev: 3.5.0 | |
| hooks: | |
| - id: sqlfluff-fix | |
| name: "📊 SQL · Attempts to fix rule violations." | |
| # {% if cookiecutter._qa_level == "strict" %} | |
| - id: sqlfluff-lint | |
| name: "📊 SQL · Lint SQL code files" | |
| # {% else %} | |
| # - id: sqlfluff-lint | |
| # name: "📊 SQL · Lint SQL code files" | |
| # {% endif %} | |
| ### Notebooks ### | |
| - repo: https://github.com/nbQA-dev/nbQA | |
| rev: 1.9.1 | |
| hooks: | |
| - id: nbqa | |
| entry: nbqa mdformat | |
| name: "📓 notebook · Format markdown cells" | |
| args: ["--nbqa-md"] | |
| types: [jupyter] | |
| additional_dependencies: | |
| - mdformat | |
| - mdformat-gfm | |
| - mdformat-ruff | |
| - mdformat-frontmatter | |
| - ruff | |
| # {# TODO: Convert to pyright #} | |
| # {% if cookiecutter._qa_level == "strict" %} | |
| - id: nbqa-mypy | |
| name: "📓 notebook · Type-check cells" | |
| # {% else %} | |
| # - id: nbqa-mypy | |
| # name: "📓 notebook · Type-check cells" | |
| # {% endif %} | |
| ### Typst Files ### | |
| - repo: https://github.com/typstyle-rs/pre-commit-typstyle | |
| rev: v0.13.19 | |
| hooks: | |
| - id: typstyle | |
| name: "📝 typst · Format typst documents" | |
| ### PNG Images ### | |
| - repo: https://github.com/shssoichiro/oxipng | |
| rev: v9.1.5 | |
| hooks: | |
| - id: oxipng | |
| name: "🖼️ images · Optimize PNG files" | |
| args: ["-o", "4", "--strip", "safe", "--alpha"] | |
| ### Additional File Types ### | |
| # "prettier made some changes that breaks plugins entirely" | |
| # - repo: https://github.com/pre-commit/mirrors-prettier | |
| # rev: v4.0.0-alpha.8 | |
| # hooks: | |
| # - id: prettier | |
| # name: "✨ misc-files · Format misc web files" | |
| # types_or: [yaml, html, scss] | |
| # additional_dependencies: | |
| # - prettier@3.4.2 | |
| # {% if cookiecutter.environment_manager == "uv" %} | |
| # ----------------------------- ⚡️ uv Build Tools ---------------------------- # | |
| # This helps ensure cross-compatibility with people who don't wish to use uv | |
| - repo: https://github.com/astral-sh/uv-pre-commit | |
| rev: 0.9.13 | |
| hooks: | |
| # {% if cookiecutter._qa_level == "strict" %} | |
| - id: uv-sync | |
| name: "⚡️ uv · Sync dependencies with uv" | |
| # {% else %} | |
| # - id: uv-sync | |
| # name: "⚡️ uv · Sync dependencies with uv" | |
| # {% endif %} | |
| - id: uv-lock | |
| name: "⚡️ uv · Update dependency lockfile" | |
| - id: uv-export | |
| name: "⚡️ uv · Export dependencies to requirements.txt" | |
| # {% endif %} | |
| # ---------------------------- 📁 Filesystem Tools --------------------------- # | |
| - repo: https://github.com/pre-commit/pre-commit-hooks | |
| rev: v6.0.0 | |
| hooks: | |
| # Filesystem Checks | |
| - id: check-executables-have-shebangs | |
| name: "📁 filesystem/⚙️ exec · Verify shebang presence" | |
| - id: check-shebang-scripts-are-executable | |
| name: "📁 filesystem/⚙️ exec · Verify script permissions" | |
| - id: check-case-conflict | |
| name: "📁 filesystem/📝 names · Check case sensitivity" | |
| - id: check-illegal-windows-names | |
| name: "📁 filesystem/📝 names · Validate Windows filenames" | |
| - id: check-symlinks | |
| name: "📁 filesystem/🔗 symlink · Check symlink validity" | |
| - id: destroyed-symlinks | |
| name: "📁 filesystem/🔗 symlink · Detect broken symlinks" | |
| # ------------------------------- 🌳 Git Tools ------------------------------- # | |
| - id: check-merge-conflict | |
| name: "🌳 git · Detect conflict markers" | |
| - id: forbid-new-submodules | |
| name: "🌳 git · Prevent submodule creation" | |
| - id: check-added-large-files | |
| name: "🌳 git · Block large file commits" | |
| args: ["--maxkb=5000"] | |
| # {% if cookiecutter.include_code_scaffold != "course" %} | |
| - id: no-commit-to-branch | |
| alias: protect-main | |
| name: "🌳 git · Protect main branches" | |
| args: ["--branch", "main", "--branch", "master"] | |
| # {% endif %} | |
| # ---------------------------------------------------------------------------- # | |
| # 📝 Commit Message Hooks # | |
| # ---------------------------------------------------------------------------- # | |
| # | |
| # --------------------------- ✍️ Git Commit Quality -------------------------- # | |
| ### Commit Message Standards ### | |
| - repo: https://github.com/commitizen-tools/commitizen | |
| rev: v4.10.0 | |
| hooks: | |
| - id: commitizen | |
| name: "🌳 git · Validate commit message" | |
| stages: [commit-msg] | |
| additional_dependencies: [cz-conventional-gitmoji] | |
| # ---------------------------------------------------------------------------- # | |
| # 🧪 Fast Tests (Local) # | |
| # ---------------------------------------------------------------------------- # | |
| - repo: local | |
| hooks: | |
| - id: pytest-collect | |
| name: 🧪 test · Validate test formatting | |
| entry: ./.venv/bin/pytest tests | |
| language: system | |
| types: [python] | |
| args: ["--collect-only"] | |
| pass_filenames: false | |
| always_run: true | |
| # {% if cookiecutter._qa_level == "strict" %} | |
| - id: pytest-fast | |
| name: 🧪 test · Run fast tests | |
| entry: ./.venv/bin/pytest tests | |
| language: system | |
| types: [python] | |
| args: ["--max-timeout=3"] | |
| pass_filenames: false | |
| always_run: true | |
| # {% else %} | |
| # - id: pytest-fast | |
| # name: 🧪 test · Run fast tests | |
| # entry: ./.venv/bin/pytest tests | |
| # language: system | |
| # types: [python] | |
| # args: ["--max-timeout=3"] | |
| # pass_filenames: false | |
| # always_run: true | |
| # {% endif %} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment