55import functools
66
77from aspy .yaml import ordered_load
8+ from identify .identify import ALL_TAGS
89
910import pre_commit .constants as C
1011from pre_commit import schema
@@ -19,6 +20,14 @@ def check_language(v):
1920 )
2021
2122
23+ def check_type_tag (tag ):
24+ if tag not in ALL_TAGS :
25+ raise schema .ValidationError (
26+ 'Type tag {!r} is not recognized. '
27+ 'Try upgrading identify and pre-commit?' .format (tag ),
28+ )
29+
30+
2231def _make_argparser (filenames_help ):
2332 parser = argparse .ArgumentParser ()
2433 parser .add_argument ('filenames' , nargs = '*' , help = filenames_help )
@@ -36,10 +45,11 @@ def _make_argparser(filenames_help):
3645 'language' , schema .check_and (schema .check_string , check_language ),
3746 ),
3847
39- schema .Conditional (
48+ schema .Optional (
4049 'files' , schema .check_and (schema .check_string , schema .check_regex ),
41- condition_key = 'always_run' , condition_value = False ,
50+ '' ,
4251 ),
52+ schema .Optional ('types' , schema .check_array (check_type_tag ), ['file' ]),
4353
4454 schema .Optional (
4555 'additional_dependencies' , schema .check_array (schema .check_string ), [],
0 commit comments