Closed
Description
Currently, the pygrep hooks have the "or" |
symbol at the end of the line, which makes diffs longer than necessary and can cause bugs. It would be better to put that symbol at the beginning of the line.
For example, instead of
- id: non-standard-numpy.random-related-imports
name: Check for non-standard numpy.random-related imports excluding pandas/_testing.py
language: pygrep
exclude: pandas/_testing.py
entry: |
(?x)
# Check for imports from np.random.<method> instead of `from numpy import random` or `from numpy.random import <method>`
from\ numpy\ import\ random|
from\ numpy.random\ import
it should be
- id: non-standard-numpy.random-related-imports
name: Check for non-standard numpy.random-related imports excluding pandas/_testing.py
language: pygrep
exclude: pandas/_testing.py
entry: |
(?x)
# Check for imports from np.random.<method> instead of `from numpy import random` or `from numpy.random import <method>`
from\ numpy\ import\ random
|from\ numpy.random\ import
There's even an |
symbol missing in the non-standard-imports-in-tests
, which should be fixed (having the symbol at the beginning of the line would probably have made this easier to spot)
The file that needs changing is .pre-commit-config.yaml