From e6cb6b199824f39c606304036594975e91c2c7ff Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Fri, 10 Mar 2023 13:33:45 +1000 Subject: [PATCH] Add a pre-commit hook Moving my local hooks into a pre-commit hook set that others can find useful too: - remove trailing whitespaces and newlines - don't allow commits to the "main" branch - python black and python ruff (same args as in the CI) --- .pre-commit-config.yaml | 18 ++++++++++++++++++ 1 file changed, 18 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..765da0c --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,18 @@ +repos: +- repo: https://github.com/pre-commit/pre-commit-hooks + rev: v2.3.0 + hooks: + - id: end-of-file-fixer + - id: trailing-whitespace + - id: no-commit-to-branch + args: ['--branch', 'main'] +- repo: https://github.com/psf/black + rev: 22.10.0 + hooks: + - id: black + args: ['--check', '--diff', '.', 'proto/ei-scanner'] +- repo: https://github.com/charliermarsh/ruff-pre-commit + rev: v0.0.254 + hooks: + - id: ruff + args: ['--ignore=E741,E501', '.', 'proto/ei-scanner']