Skip to content

Commit 54e477e

Browse files
committed
BLD: Run flake8 check on Cython files in pre-commit
1 parent 6437f5e commit 54e477e

File tree

4 files changed

+23
-2
lines changed

4 files changed

+23
-2
lines changed

.flake8.cython

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[flake8]
2+
filename = *.pyx,*.pxd,*.pxi
3+
select=E501,E302,E203,E111,E114,E221,E303,E128,E231,E126,E265,E305,E301,E127,E261,E271,E129,W291,E222,E241,E123,F403,C400,C401,C402,C403,C404,C405,C406,C407,C408,C409,C410,C411

.flake8.cython-header

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[flake8]
2+
filename = *.pxd,*.pxi,*.pxi.in
3+
select = E501,E302,E203,E111,E114,E221,E303,E231,E126,F403
4+

.pre-commit-config.yaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,20 @@ repos:
1010
- id: flake8
1111
language: python_venv
1212
additional_dependencies: [flake8-comprehensions>=3.1.0]
13+
- id: flake8
14+
name: flake8-pyx
15+
language: python_venv
16+
files: \.pyx$
17+
types:
18+
- file
19+
args: [--append-config=.flake8.cython]
20+
- id: flake8
21+
name: flake8-pxd
22+
language: python_venv
23+
files: \.(pxd|pxi\.in)$
24+
types:
25+
- file
26+
args: [--append-config=.flake8.cython-header]
1327
- repo: https://github.com/pre-commit/mirrors-isort
1428
rev: v4.3.21
1529
hooks:

ci/code_checks.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,11 @@ if [[ -z "$CHECK" || "$CHECK" == "lint" ]]; then
6666
RET=$(($RET + $?)) ; echo $MSG "DONE"
6767

6868
MSG='Linting .pyx code' ; echo $MSG
69-
flake8 --format="$FLAKE8_FORMAT" pandas --filename=*.pyx --select=E501,E302,E203,E111,E114,E221,E303,E128,E231,E126,E265,E305,E301,E127,E261,E271,E129,W291,E222,E241,E123,F403,C400,C401,C402,C403,C404,C405,C406,C407,C408,C409,C410,C411
69+
flake8 --format="$FLAKE8_FORMAT" pandas --append-config=.flake8.cython
7070
RET=$(($RET + $?)) ; echo $MSG "DONE"
7171

7272
MSG='Linting .pxd and .pxi.in' ; echo $MSG
73-
flake8 --format="$FLAKE8_FORMAT" pandas/_libs --filename=*.pxi.in,*.pxd --select=E501,E302,E203,E111,E114,E221,E303,E231,E126,F403
73+
flake8 --format="$FLAKE8_FORMAT" pandas/_libs --append-config=.flake8.cython-header
7474
RET=$(($RET + $?)) ; echo $MSG "DONE"
7575

7676
echo "flake8-rst --version"

0 commit comments

Comments
 (0)