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

@ -0,0 +1,7 @@
c1 = complex()
d1 = dict()
f1 = float()
i1 = int()
l1 = list()
s1 = str()
t1 = tuple()

View file

@ -0,0 +1,7 @@
c1 = 0j
d1 = {}
f1 = 0.0
i1 = 0
l1 = []
s1 = ''
t1 = ()