From e2614122d8915de2525ee9648d2981d1c9dcd528 Mon Sep 17 00:00:00 2001 From: Angus Gratton Date: Tue, 10 Nov 2020 17:35:23 +1100 Subject: [PATCH] pre-commit: Exclude expected output files from whitespace fixes These rely on exact whitespace in their content --- .pre-commit-config.yaml | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index b36976339a..8119bfc2a2 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,13 +1,29 @@ # See https://pre-commit.com for more information # See https://pre-commit.com/hooks.html for more hooks +whitespace_excludes: &common_whitespace_excludes + # note: whitespace exclusions use multiline regex, see https://pre-commit.com/#regular-expressions + # items are: + # 1 - some file extensions + # 2 - any file matching *test*/*expected* (for host tests, if possible use this naming pattern always) + # 3 - any directory named 'testdata' + # 4 - IDF monitor test data + exclude: | + (?x)^( + .+\.(md|rst|map|bin)| + .+test.*\/.*expected.*| + .+\/testdata\/.+| + .+test_idf_monitor\/tests\/.+ + )$ + repos: - repo: https://github.com/pre-commit/pre-commit-hooks rev: v3.3.0 hooks: - id: trailing-whitespace - exclude: '.+\.(md|rst)' + <<: *common_whitespace_excludes - id: end-of-file-fixer + <<: *common_whitespace_excludes - id: check-executables-have-shebangs - id: file-contents-sorter files: 'tools/ci/executable-list.txt'