diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index dab142c89c067df7af00866d4ab34b0ceb12d5ac..c483214c1d8967c9922d9659f8d3c4f565bac041 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -34,3 +34,13 @@ repos: - repo: meta hooks: - id: check-useless-excludes + - repo: local + hooks: + - id: long-test-files + name: Warn about long unit test files + language: script + entry: ci/long-test-files.sh + # Only run on Arkindex unit test files + files: '^arkindex\/[^\/]*\/tests\/(.*\/)?test_.*\.py' + # Always show output, even when the hook passes, since the hook only warns and doesn't fail + verbose: true diff --git a/ci/long-test-files.sh b/ci/long-test-files.sh new file mode 100755 index 0000000000000000000000000000000000000000..0eac44393b2e74402f28e5d767fa4edff7dc8a8a --- /dev/null +++ b/ci/long-test-files.sh @@ -0,0 +1,2 @@ +#!/bin/sh +wc -l "$@" | awk '$2 != "total" && $1 > 1000 { OFS=""; print $2, " is too long (", $1, " lines)" }'