mirror of
https://github.com/pre-commit/pre-commit-hooks.git
synced 2026-04-04 19:26:52 +00:00
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:
parent
e718847ccb
commit
35996b7a25
8 changed files with 231 additions and 0 deletions
|
|
@ -30,6 +30,10 @@ Add this to your `.pre-commit-config.yaml`
|
|||
- `check-added-large-files` - Prevent giant files from being committed.
|
||||
- Specify what is "too large" with `args: ['--maxkb=123']` (default=500kB).
|
||||
- `check-ast` - Simply check whether files parse as valid python.
|
||||
- `check-builtin-literals` - Require literal syntax when initializing empty or zero Python builtin types.
|
||||
- Allows calling constructors with positional arguments (e.g., `list('abc')`).
|
||||
- Ignore this requirement for specific builtin types with `--ignore=type1,type2,…`.
|
||||
- Forbid `dict` keyword syntax with `--no-allow-dict-kwargs`.
|
||||
- `check-byte-order-marker` - Forbid files which have a UTF-8 byte-order marker
|
||||
- `check-case-conflict` - Check for files with names that would conflict on a
|
||||
case-insensitive filesystem like MacOS HFS+ or Windows FAT.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue