mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-04-18 11:31:46 +04:00
Adds a test for python and bash `types` using identify per interpreter interpretation. The python test succeeds with a false positive. The bash test identifies the bug, where a comparison happens between `tags >= types`. Tags is the tag list from identify, types is the value passed in from configuration file as `acceptable types`. The `tags(List) >= types(FrozenSet)` does a sort comparison of the two sequences as evidenced by this code sample (which should return True): ``` >>> types = frozenset(['a']) >>> tags = ['bash'] >>> tags >= types True ``` Note: In 2.7, I cannot get this to return anything other than True. Including the empty case: ``` >>> [] > frozenset() True ``` Which means to me that a list is always >= a frozenset in Python 2.7. In Python 3.5, I see errors when comparing a List to a FrozenSet. So thankfully the interpreter is stricter in this case. ``` >>> [] >= frozenset() TypeError: unorderable types: list() >= frozenset() ``` |
||
|---|---|---|
| .. | ||
| commands | ||
| languages | ||
| meta_hooks | ||
| resources | ||
| __init__.py | ||
| __main__.py | ||
| clientlib.py | ||
| color.py | ||
| color_windows.py | ||
| constants.py | ||
| envcontext.py | ||
| error_handler.py | ||
| file_lock.py | ||
| five.py | ||
| git.py | ||
| logging_handler.py | ||
| main.py | ||
| make_archives.py | ||
| output.py | ||
| parse_shebang.py | ||
| prefix.py | ||
| repository.py | ||
| runner.py | ||
| staged_files_only.py | ||
| store.py | ||
| util.py | ||
| xargs.py | ||