Skip to content

Commit

Permalink
apacheGH-41688: [Dev] Include all relevant CMakeLists.txt files in cm…
Browse files Browse the repository at this point in the history
…ake-format precommit hook (apache#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: apache#41688

Authored-by: Joris Van den Bossche <[email protected]>
Signed-off-by: Joris Van den Bossche <[email protected]>
  • Loading branch information
jorisvandenbossche authored May 17, 2024
1 parent 2dbc5e2 commit 14b8ca5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
7 changes: 2 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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$|
Expand Down
2 changes: 1 addition & 1 deletion dev/archery/archery/utils/lint.py
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down

0 comments on commit 14b8ca5

Please sign in to comment.