Skip to content

Commit c70aae7

Browse files
committed
Move cpplint check to pre-commit
Currently, cpplint runs from https://github.com/pandas-dev/pandas/blob/master/ci/code_checks.sh However, cpplint have a pre-commit hook which can be used.
1 parent 4ef033f commit c70aae7

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

.pre-commit-config.yaml

+10
Original file line numberDiff line numberDiff line change
@@ -219,3 +219,13 @@ repos:
219219
hooks:
220220
- id: absolufy-imports
221221
files: ^pandas/
222+
- repo: https://github.com/cpplint/cpplint
223+
rev: f7061b1 # the latest tag does not have the hook
224+
hooks:
225+
- id: cpplint
226+
# We don't lint all C files because we don't want to lint any that are built
227+
# from Cython files nor do we want to lint C files that we didn't modify for
228+
# this particular codebase (e.g. src/headers, src/klib). However,
229+
# we can lint all header files since they aren't "generated" like C files are.
230+
exclude: ^pandas/_libs/src/(klib|headers)/
231+
args: [--quiet, '--extensions=c,h', '--headers=h', --recursive, '--filter=-readability/casting,-runtime/int,-build/include_subdir']

ci/code_checks.sh

-8
Original file line numberDiff line numberDiff line change
@@ -59,14 +59,6 @@ if [[ -z "$CHECK" || "$CHECK" == "lint" ]]; then
5959
# runtime/int: Warnings about using C number types instead of C++ ones
6060
# build/include_subdir: Warnings about prefacing included header files with directory
6161

62-
# We don't lint all C files because we don't want to lint any that are built
63-
# from Cython files nor do we want to lint C files that we didn't modify for
64-
# this particular codebase (e.g. src/headers, src/klib). However,
65-
# we can lint all header files since they aren't "generated" like C files are.
66-
MSG='Linting .c and .h' ; echo $MSG
67-
cpplint --quiet --extensions=c,h --headers=h --recursive --filter=-readability/casting,-runtime/int,-build/include_subdir pandas/_libs/src/*.h pandas/_libs/src/parser pandas/_libs/src/ujson pandas/_libs/tslibs/src/datetime pandas/_libs/*.cpp
68-
RET=$(($RET + $?)) ; echo $MSG "DONE"
69-
7062
fi
7163

7264
### PATTERNS ###

0 commit comments

Comments
 (0)