mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-04-15 10:01:46 +04:00
Add file classification package
This commit is contained in:
parent
2b22a36b1c
commit
cebba0404d
7 changed files with 324 additions and 0 deletions
28
pre_commit/file_classifier/extensions.py
Normal file
28
pre_commit/file_classifier/extensions.py
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
"""List of known filename to file type mappings.
|
||||
|
||||
The list consists of tuples of (filename regex, list of types).
|
||||
|
||||
Most of these are extensions (e.g. *.py -> python), but some just use the
|
||||
filename (e.g. Makefile -> make).
|
||||
"""
|
||||
KNOWN_EXTENSIONS = [
|
||||
(r'\.js$', ['javascript']),
|
||||
(r'\.json$', ['json']),
|
||||
(r'\.py$', ['python']),
|
||||
(r'\.rb$', ['ruby']),
|
||||
(r'\.sh$', ['shell']),
|
||||
(r'\.e?ya?ml$', ['yaml']),
|
||||
(r'\.pp$', ['puppet']),
|
||||
(r'\.erb$', ['erb']),
|
||||
(r'\.json$', ['json']),
|
||||
(r'\.xml$', ['xml']),
|
||||
(r'\.c$', ['c']),
|
||||
(r'^Makefile$', ['make']),
|
||||
(r'\.mk$', ['make']),
|
||||
(r'\.png$', ['png']),
|
||||
(r'\.gif$', ['gif']),
|
||||
(r'\.svg$', ['svg']),
|
||||
(r'\.css$', ['css']),
|
||||
(r'\.html?$', ['html']),
|
||||
(r'\.php\d?$', ['php']),
|
||||
]
|
||||
Loading…
Add table
Add a link
Reference in a new issue