Add check to enforce literal syntax for Python builtin types

This check requires authors to initialize empty or zero builtin types
using the literal syntax (e.g., `{}` instead of `dict()`).

Authors may ignore this requirement for certain builtins using the
`--ignore` option.

Authors may also forbid calling `dict()` with keyword arguments
(`dict(a=1, b=2)`) using the `--no-allow-dict-kwargs` flag.
This commit is contained in:
Ben Webber 2017-11-26 00:17:47 +00:00
parent e718847ccb
commit 35996b7a25
8 changed files with 231 additions and 0 deletions

View file

@ -36,6 +36,7 @@ setup(
'autopep8-wrapper = pre_commit_hooks.autopep8_wrapper:main',
'check-added-large-files = pre_commit_hooks.check_added_large_files:main',
'check-ast = pre_commit_hooks.check_ast:check_ast',
'check-builtin-literals = pre_commit_hooks.check_builtin_literals:main',
'check-byte-order-marker = pre_commit_hooks.check_byte_order_marker:main',
'check-case-conflict = pre_commit_hooks.check_case_conflict:main',
'check-docstring-first = pre_commit_hooks.check_docstring_first:main',