From d4bf5ed0261b4b71acb5c796351497082a16dd79 Mon Sep 17 00:00:00 2001 From: pythoninthegrass <4097471+pythoninthegrass@users.noreply.github.com> Date: Wed, 21 Feb 2024 00:48:48 -0600 Subject: [PATCH] ci: add pre-commit hooks ruff foremost among them. Otherwise better code quality with minimal annoyances locally --- .pre-commit-config.yaml | 43 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 .pre-commit-config.yaml diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..8c59274 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,43 @@ +fail_fast: true + +repos: + - repo: https://github.com/astral-sh/ruff-pre-commit + rev: v0.2.2 + hooks: + - id: ruff + args: [--fix, --exit-non-zero-on-fix] + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.5.0 + hooks: + - id: check-yaml + - id: check-added-large-files + args: ['--maxkb=1024'] + - id: check-docstring-first + exclude: | + (?x)^( + hello.py + )$ + - id: check-executables-have-shebangs + - id: check-merge-conflict + - id: check-shebang-scripts-are-executable + - id: check-symlinks + - id: check-toml + - id: check-yaml + args: [--unsafe] + - id: debug-statements + - id: destroyed-symlinks + - id: detect-private-key + - id: end-of-file-fixer + - id: fix-byte-order-marker + - id: mixed-line-ending + - id: pretty-format-json + # https://pre-commit.com/#regular-expressions + exclude: | + (?x)^( + .devcontainer/devcontainer.json| + .vscode/launch.json| + .vscode/settings.json| + .vscode/extensions.json + )$ + args: ['--autofix', '--indent=2', '--no-sort-keys'] + - id: requirements-txt-fixer