This is an automated email from the ASF dual-hosted git repository.

tlopex pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tvm.git


The following commit(s) were added to refs/heads/main by this push:
     new c429a2b10d [CI] Update file patterns for specific linting hooks 
(#18484)
c429a2b10d is described below

commit c429a2b10dc8248c6ca7ef551307af58838f85bc
Author: Guan-Ming (Wesley) Chiu <[email protected]>
AuthorDate: Sun Nov 30 13:12:42 2025 +0800

    [CI] Update file patterns for specific linting hooks (#18484)
    
    ## How
    
    - Updat file patterns for specific linting hooks to ensure they only run
    on relevant file types.
    
    **minor update**
    
    - Fix linting commands to handle interactive and non-interactive modes
    - Add 'pre-commit' to default stages in .pre-commit-config.yaml.
    - Add inplace fix flags
---
 .pre-commit-config.yaml | 18 +++++++++---------
 docker/lint.sh          |  6 +++++-
 2 files changed, 14 insertions(+), 10 deletions(-)

diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index d455a14500..13a06a6cb3 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -34,7 +34,7 @@
 default_language_version:
     python: python3.9
 fail_fast: True
-default_stages: [pre-push]
+default_stages: [pre-push, pre-commit]
 repos:
     - repo: https://github.com/pre-commit/pre-commit-hooks
       rev: v6.0.0
@@ -49,9 +49,9 @@ repos:
       hooks:
         -   id: run-black
             name: Running Black...
-            entry: docker/lint.sh python_format
+            entry: docker/lint.sh python_format -i
             language: system
-            always_run: true
+            files: \.py$
             pass_filenames: false
         -   id: run-file-checks
             name: Checking File Types....
@@ -61,25 +61,25 @@ repos:
             pass_filenames: false
         -   id: run-headers-check
             name: Checking ASF License Headers ...
-            entry: docker/lint.sh asf
+            entry: docker/lint.sh asf -i
             language: system
             always_run: true
             pass_filenames: false
-        -   id: run-headers-check
+        -   id: run-cpplint
             name: Linting the C++ code ...
             entry: docker/lint.sh cpplint
             language: system
-            always_run: true
+            files: \.(c|cc|cpp|h|hpp)$
             pass_filenames: false
         -   id: run-clang-format
             name: Checking Clang format ...
-            entry: docker/lint.sh clang_format
+            entry: docker/lint.sh clang_format -i
             language: system
-            always_run: true
+            files: \.(c|cc|cpp|h|hpp)$
             pass_filenames: false
         -   id: run-mypy
             name: Type Checking with MyPY ...
             entry: docker/lint.sh mypy
             language: system
-            always_run: true
+            files: \.py$
             pass_filenames: false
diff --git a/docker/lint.sh b/docker/lint.sh
index f98c272aa9..7225fa981f 100755
--- a/docker/lint.sh
+++ b/docker/lint.sh
@@ -98,7 +98,11 @@ function run_lint_step() {
     shift
 
     if [ $validate_only -eq 0 ]; then
-        run_docker -it "ci_lint" "${cmd[@]}"
+        if [ -t 0 ]; then
+            run_docker -it "ci_lint" "${cmd[@]}"
+        else
+            run_docker "ci_lint" "${cmd[@]}"
+        fi
     fi
 }
 

Reply via email to