Skip to content

Commit 1723ff9

Browse files
committed
Update file patterns for specific linting hooks
1 parent 4a60bb2 commit 1723ff9

File tree

2 files changed

+14
-10
lines changed

2 files changed

+14
-10
lines changed

.pre-commit-config.yaml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
default_language_version:
3535
python: python3.9
3636
fail_fast: True
37-
default_stages: [pre-push]
37+
default_stages: [pre-push, pre-commit]
3838
repos:
3939
- repo: https://github.com/pre-commit/pre-commit-hooks
4040
rev: v6.0.0
@@ -49,9 +49,9 @@ repos:
4949
hooks:
5050
- id: run-black
5151
name: Running Black...
52-
entry: docker/lint.sh python_format
52+
entry: docker/lint.sh python_format -i
5353
language: system
54-
always_run: true
54+
files: \.py$
5555
pass_filenames: false
5656
- id: run-file-checks
5757
name: Checking File Types....
@@ -61,25 +61,25 @@ repos:
6161
pass_filenames: false
6262
- id: run-headers-check
6363
name: Checking ASF License Headers ...
64-
entry: docker/lint.sh asf
64+
entry: docker/lint.sh asf -i
6565
language: system
6666
always_run: true
6767
pass_filenames: false
68-
- id: run-headers-check
68+
- id: run-cpplint
6969
name: Linting the C++ code ...
7070
entry: docker/lint.sh cpplint
7171
language: system
72-
always_run: true
72+
files: \.(c|cc|cpp|h|hpp)$
7373
pass_filenames: false
7474
- id: run-clang-format
7575
name: Checking Clang format ...
76-
entry: docker/lint.sh clang_format
76+
entry: docker/lint.sh clang_format -i
7777
language: system
78-
always_run: true
78+
files: \.(c|cc|cpp|h|hpp)$
7979
pass_filenames: false
8080
- id: run-mypy
8181
name: Type Checking with MyPY ...
8282
entry: docker/lint.sh mypy
8383
language: system
84-
always_run: true
84+
files: \.py$
8585
pass_filenames: false

docker/lint.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,11 @@ function run_lint_step() {
9090
shift
9191

9292
if [ $validate_only -eq 0 ]; then
93-
run_docker -it "ci_lint" "${cmd[@]}"
93+
if [ -t 0 ]; then
94+
run_docker -it "ci_lint" "${cmd[@]}"
95+
else
96+
run_docker "ci_lint" "${cmd[@]}"
97+
fi
9498
fi
9599
}
96100

0 commit comments

Comments
 (0)