Skip to content

Commit cb94b4e

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 9208a35 commit cb94b4e

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
@@ -23,6 +23,16 @@ repos:
2323
- id: end-of-file-fixer
2424
exclude: \.txt$
2525
- id: trailing-whitespace
26+
- repo: https://github.com/cpplint/cpplint
27+
rev: f7061b1 # the latest tag does not have the hook
28+
hooks:
29+
- id: cpplint
30+
# We don't lint all C files because we don't want to lint any that are built
31+
# from Cython files nor do we want to lint C files that we didn't modify for
32+
# this particular codebase (e.g. src/headers, src/klib). However,
33+
# we can lint all header files since they aren't "generated" like C files are.
34+
exclude: ^pandas/_libs/src/(klib|headers)/
35+
args: [--quiet, '--extensions=c,h', '--headers=h', --recursive, '--filter=-readability/casting,-runtime/int,-build/include_subdir']
2636
- repo: https://gitlab.com/pycqa/flake8
2737
rev: 3.8.4
2838
hooks:

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)