Skip to content

Commit bd51706

Browse files
committed
add pre-commit hooks
1 parent 87ef5fb commit bd51706

25 files changed

+1082
-701
lines changed

.flake8

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
[flake8]
2+
extend-ignore =
3+
# whitespace before ':' (currently conflicts with black formatting):
4+
E203,
5+
# line too long (in docstrings):
6+
E501,
7+
# ‘from module import *’ used; unable to detect undefined names:
8+
F403,
9+
# doc line too long (105 > 80 characters):
10+
W505,
11+
# missing docstring in public module:
12+
D100,
13+
# missing docstring in public class:
14+
D101,
15+
# missing docstring in public method:
16+
D102,
17+
# missing docstring in public function:
18+
D103,
19+
# missing docstring in public package:
20+
D104,
21+
# missing docstring in magic method:
22+
D105,
23+
# missing docstring in __init__:
24+
D107,
25+
# no blank lines allowed after function docstring:
26+
D202,
27+
# 1 blank line required between summary line and description:
28+
D205,
29+
# first line should end with a period:
30+
D400,
31+
# first line should be in imperative mood:
32+
D401,
33+
# first line should not be the function's "signature":
34+
D402,
35+
# first word of the first line should be properly capitalized
36+
D403,
37+
38+
per-file-ignores =
39+
mkl_fft/__init__.py: E402, F401
40+
mkl_fft/interfaces/__init__.py: F401
41+
mkl_fft/interfaces/scipy_fft.py: F401
42+
mkl_fft/interfaces/numpy_fft.py: F401
43+
44+
filename = *.py, *.pyx, *.pxi, *.pxd
45+
max_line_length = 80
46+
max-doc-length = 80
47+
show-source = True
48+
49+
# Print detailed statistic if any issue detected
50+
count = True
51+
statistics = True

.github/workflows/conda-package-cf.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ env:
1313
MODULE_NAME: mkl_fft
1414
TEST_ENV_NAME: test_mkl_fft
1515
VER_SCRIPT1: "import json; f = open('ver.json', 'r'); j = json.load(f); f.close(); d = j['mkl_fft'][0];"
16-
VER_SCRIPT2: "print('='.join((d[s] for s in ('version', 'build'))))"
17-
16+
VER_SCRIPT2: "print('='.join((d[s] for s in ('version', 'build'))))"
17+
1818
jobs:
1919
build:
2020
runs-on: ubuntu-latest
@@ -280,4 +280,3 @@ jobs:
280280
shell: cmd /C CALL {0}
281281
run: >-
282282
conda activate ${{ env.TEST_ENV_NAME }} && python -m pytest -v -s --pyargs ${{ env.MODULE_NAME }}
283-

.github/workflows/conda-package.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ env:
1313
MODULE_NAME: mkl_fft
1414
TEST_ENV_NAME: test_mkl_fft
1515
VER_SCRIPT1: "import json; f = open('ver.json', 'r'); j = json.load(f); f.close(); d = j['mkl_fft'][0];"
16-
VER_SCRIPT2: "print('='.join((d[s] for s in ('version', 'build'))))"
16+
VER_SCRIPT2: "print('='.join((d[s] for s in ('version', 'build'))))"
1717

1818
jobs:
1919
build:
@@ -278,4 +278,3 @@ jobs:
278278
shell: cmd /C CALL {0}
279279
run: >-
280280
conda activate ${{ env.TEST_ENV_NAME }} && python -m pytest -v -s --pyargs ${{ env.MODULE_NAME }}
281-

.pre-commit-config.yaml

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
repos:
2+
- repo: https://github.com/pre-commit/pre-commit-hooks
3+
rev: v5.0.0
4+
hooks:
5+
- id: check-ast
6+
- id: check-builtin-literals
7+
- id: check-case-conflict
8+
- id: check-executables-have-shebangs
9+
- id: check-merge-conflict
10+
- id: check-toml
11+
- id: debug-statements
12+
- id: destroyed-symlinks
13+
- id: end-of-file-fixer
14+
- id: fix-byte-order-marker
15+
- id: mixed-line-ending
16+
- id: trailing-whitespace
17+
18+
- repo: https://github.com/psf/black
19+
rev: 25.1.0
20+
hooks:
21+
- id: black
22+
exclude: "_vendored/conv_template.py"
23+
24+
- repo: https://github.com/pocc/pre-commit-hooks
25+
rev: v1.3.5
26+
hooks:
27+
- id: clang-format
28+
args: ["-i"]
29+
30+
- repo: https://github.com/pycqa/flake8
31+
rev: 7.1.2
32+
hooks:
33+
- id: flake8
34+
args: ["--config=.flake8"]
35+
additional_dependencies:
36+
- flake8-docstrings==1.7.0
37+
- flake8-bugbear==24.4.26
38+
39+
- repo: https://github.com/pycqa/isort
40+
rev: 5.13.2
41+
hooks:
42+
- id: isort
43+
name: isort (python)
44+
- id: isort
45+
name: isort (cython)
46+
types: [cython]
47+
- id: isort
48+
name: isort (pyi)
49+
types: [pyi]
50+
51+
- repo: https://github.com/macisamuele/language-formatters-pre-commit-hooks
52+
rev: v2.14.0
53+
hooks:
54+
- id: pretty-format-toml
55+
args: [--autofix]
56+
57+
- repo: local
58+
hooks:
59+
- id: pylint
60+
name: pylint
61+
entry: pylint
62+
language: system
63+
types: [python]
64+
require_serial: true
65+
args:
66+
[
67+
"-rn", # Only display messages
68+
"-sn", # Don't display the score
69+
"--errors-only",
70+
]
71+
72+
- repo: https://github.com/jumanjihouse/pre-commit-hooks
73+
rev: 3.0.0
74+
hooks:
75+
- id: shellcheck

CHANGES.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ Fix for issue #29.
125125
1.0.7
126126
=====
127127
Improved exception message raised if MKL is signalling an error. The message now includes MKL's own description of the exception.
128-
This partially improves #24.
128+
This partially improves #24.
129129

130130
Improved argument validation for ND transforms aligning with scipy 1.2.0
131131

SECURITY.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Security Policy
2-
Intel is committed to rapidly addressing security vulnerabilities affecting our customers and providing clear guidance on the solution, impact, severity and mitigation.
2+
Intel is committed to rapidly addressing security vulnerabilities affecting our customers and providing clear guidance on the solution, impact, severity and mitigation.
33

44
## Reporting a Vulnerability
5-
Please report any security vulnerabilities in this project utilizing the guidelines [here](https://www.intel.com/content/www/us/en/security-center/vulnerability-handling-guidelines.html).
5+
Please report any security vulnerabilities in this project utilizing the guidelines [here](https://www.intel.com/content/www/us/en/security-center/vulnerability-handling-guidelines.html).

_vendored/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22

33
File `conv_template.py` is copied from NumPy's numpy/distutils folder, since
44
`numpy.distutils` is absent from the installation layout starting with
5-
Python 3.12
5+
Python 3.12

0 commit comments

Comments
 (0)