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

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


The following commit(s) were added to refs/heads/main by this push:
     new 14b8ca5317 GH-41688: [Dev] Include all relevant CMakeLists.txt files 
in cmake-format precommit hook (#41689)
14b8ca5317 is described below

commit 14b8ca53171435113a0f0f0c4ff1063d12543bc4
Author: Joris Van den Bossche <[email protected]>
AuthorDate: Fri May 17 14:35:02 2024 +0200

    GH-41688: [Dev] Include all relevant CMakeLists.txt files in cmake-format 
precommit hook (#41689)
    
    ### Rationale for this change
    
    Some CMakeLists.txt files are not included in the pre-commit hook (causing 
failures on CI through archery if you rely on the pre-commit hook locally)
    
    ### What changes are included in this PR?
    
    Include all CMakeLists.txt files by default anywhere in the repo, and 
explicitly exclude the ones we don't want (vendored files).
    
    In practice, compared to the current set of files covered by the hook, 
those new files are included in the search:
    
    'cpp/CMakeLists.txt',
    'java/CMakeLists.txt',
    'matlab/CMakeLists.txt',
    'python/CMakeLists.txt'
    
    ### Are these changes tested?
    
    Yes
    * GitHub Issue: #41688
    
    Authored-by: Joris Van den Bossche <[email protected]>
    Signed-off-by: Joris Van den Bossche <[email protected]>
---
 .pre-commit-config.yaml           | 7 ++-----
 dev/archery/archery/utils/lint.py | 2 +-
 2 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index 7dcc1c9816..1e4b91e27e 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -116,17 +116,14 @@ repos:
         name: CMake Format
         files: >-
           (
+          ?.*CMakeLists\.txt$|
           ?^ci/.*/.*\.cmake$|
           ?^cpp/.*/.*\.cmake\.in$|
           ?^cpp/.*/.*\.cmake$|
-          ?^cpp/.*/CMakeLists\.txt$|
-          ?^go/.*/CMakeLists\.txt$|
-          ?^java/.*/CMakeLists\.txt$|
-          ?^matlab/.*/CMakeLists\.txt$|
-          ?^python/.*/CMakeLists\.txt$|
           )
         exclude: >-
           (
+          ?^ci/conan/all/.*CMakeLists\.txt$|
           ?^cpp/cmake_modules/FindNumPy\.cmake$|
           ?^cpp/cmake_modules/FindPythonLibsNew\.cmake$|
           ?^cpp/cmake_modules/UseCython\.cmake$|
diff --git a/dev/archery/archery/utils/lint.py 
b/dev/archery/archery/utils/lint.py
index 108c9ded36..92b7f79fc1 100644
--- a/dev/archery/archery/utils/lint.py
+++ b/dev/archery/archery/utils/lint.py
@@ -157,7 +157,7 @@ def cmake_linter(src, fix=False):
             'go/**/CMakeLists.txt',
             'java/**/CMakeLists.txt',
             'matlab/**/CMakeLists.txt',
-            'python/CMakeLists.txt',
+            'python/**/CMakeLists.txt',
         ],
         exclude_patterns=[
             'cpp/cmake_modules/FindNumPy.cmake',

Reply via email to