- Made
C408
only apply when no arguments are passed todict
/list
/tuple
.
- Remove check for dict comprehensions in rule C407 as it would also change the results for certain builtins such as
sum()
.
- Remove check for set comprehensions in rule C407 as it would change the results for certain builtins such as
sum()
.
- Add
filter
andmap
to rule C407. - Check for dict and set comprehensions in rules C407 and C412.
- Remove the tuple/unpacking check from C416 to prevent false positives where the type of the iterable is changed from some iterable to a tuple.
- Ensure the fix for false positives in
C416
rule for asynchronous comprehensions runs on Python 3.6 too.
- Fix false positives in
C416
rule for list comprehensions returning tuples.
- Fix false positives in
C416
rule for asynchronous comprehensions.
- Update Python support to 3.5-3.8.
- Fix false positives for C404 for list comprehensions not directly creating tuples.
- Add
C413
rule that checks for unnecessary use oflist()
orreversed()
aroundsorted()
. - Add
C414
rule that checks for unnecessary use of the following: list()
,reversed()
,sorted()
, ortuple()
withinset
orsorted()
list()
ortuple()
withinlist()
ortuple()
set()
withinset
- Add
- Add
C415
rule that checks for unnecessary reversal of an iterable via subscript withinreversed()
,set()
, orsorted()
. - Add
C416
rule that checks for unnecessary list or set comprehensions that can be rewritten usinglist()
orset()
.
- Fix version display on
flake8 --version
(removing dependency oncached-property
). Thanks to Jon Dufresne.
- Update Flake8 support to 3.0+ only. 3.0.0 was released in 2016 and the plugin hasn't been tested with it since.
- Converted setuptools metadata to configuration file. This meant removing the
__version__
attribute from the package. If you want to inspect the installed version, useimportlib.metadata.version("flake8-comprehensions")
(docs / backport). - Add dependencies on
cached-property
andimportlib-metadata
. - Fix false negatives in
C407
for cases whenenumerate
andsum()
are passed more than one argument.
- Update Python support to 3.5-3.7, as 3.4 has reached its end of life.
C412
rule that complains about using list comprehension within
.
- Add missing builtin
enumerate
toC407
.
- Drop Python 2 support, only Python 3.4+ is supported now.
- Fix false positives in
C408
for calls using*args
or**kwargs
.
- Plugin now reserves the full
C4XX
code space rather than justC40X
C408
rule that complains about usingtuple()
,list()
, ordict()
instead of a literal.C409
andC410
rules that complain about an unnecessary list or tuple that could be rewritten as a literal.C411
rule that complains about using list comprehension inside alist()
call.
- Don't allow installation with Flake8 3.2.0 which doesn't enable the plugin. This bug was fixed in Flake8 3.2.1.
- Prevent false positives of
C402
from generators of expressions that aren't two-tuples. C405
andC406
now also complain about unnecessary tuple literals.
C407
rule that complains about unnecessary list comprehensions inside builtins that can work on generators.
- Split all rule codes by type. This allows granular selection of the rules in flake8 configuration.
- Fix crash on method calls
C401
rule that complains about unnecessary list comprehensions inside calls toset()
ordict()
.C402
rule that complains about unnecessary list literals inside calls toset()
ordict()
.
C400
rule that complains about an unnecessary usage of a generator when a list/set/dict comprehension would do.