Inside gitignore/Global/macOS.gitignore, there are two \r\r
as shown in the below screenshot:
I use pre-commit==v4.0.1
with its mixed-line-ending
and trailing-whitespace
hooks. Both get triggered on this line.
How can I locally disable those hooks within my .gitignore
file?
My current solution I employ is exclude: .gitignore
within my .pre-commit-config.yaml
for both hooks. However, I don't like this, as it ignores the entire .gitignore
file for these hooks, when I really just want to locally disable those two hooks around lines 6 - 8 of the .gitignore
.
there is no such option for what you want
the pre-commit
framework operates on files so your best bet is to leverage exclude
:
- id: trailing-whitespace
exclude: ^\.gitignore$
or more realistically, just remove the Icon\r
line since it's very unlikely to be hit (only appearing when you customize the icon for a folder on macos). another option is to use Icon?
instead -- it's slightly less precise but you're probably fairly unlikely to match something else with it
disclaimer: I created pre-commit
and pre-commit-hooks