Skip to content

Commit e92fd6d

Browse files
committed
pre-commit: Exclude all image files from trailing whitespace checks
Previously we excluded SVG files from these checks with a regex matching SVG filenames. I learnt that pre-commit uses the “identify” library to determine a set of types for a file. This library already knows that `.svg` files are images: $ identify-cli addons/git_describe/label/icon.svg ["file", "image", "non-executable", "svg", "text", "xml"] SVG is not the only text-based image format. We don't want to run whitespace checks on any kind of image file. Exclude image files by type, not SVGs by filename. https://pypi.org/project/identify/
1 parent c100a78 commit e92fd6d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

.pre-commit-config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ repos:
1414
- id: check-illegal-windows-names
1515
- id: check-yaml
1616
- id: end-of-file-fixer
17-
exclude: \.svg$
17+
exclude_types: [image]
1818
- id: trailing-whitespace
19-
exclude: \.svg$
19+
exclude_types: [image]
2020

2121
- repo: https://github.com/editorconfig-checker/editorconfig-checker
2222
rev: v3.4.0

0 commit comments

Comments
 (0)