Releases: wemake-services/wemake-python-styleguide
Releases · wemake-services/wemake-python-styleguide
Version 0.11.0 aka The New Violation Codes
We had a really big problem: all violations inside best_practices
was messed up together with no clear structure.
We had to fix it before it is too late.
So, we broke existing error codes.
And now we can promise not to do it ever again.
We also have this nice migration guide
for you to rename your violations with a script.
Features
- Breaking: replaces
Zerror code toWPScode - Breaking: creates new violation group
refactoring.py - Breaking: creates new violation group
oop.py - Breaking: moving a lot of violations
frombest_practicestorefactoring,oop, andconsistency - Adds new
wemakeformatter (using it now by default)
Bugfixes
- Fixes error message of
OverusedStringViolationfor empty strings - Now does not count string annotations as strings for
OverusedStringViolation - Fixes
InconsistentReturnVariableViolationwas raised twice
Misc
- Adds migration guide to
0.11 - Improves legacy guide
- Adds
--show-sourceto the default recommended configuration - Adds better docs about auto-formatters
- Adds
autopep8to CI to make sure thatwpsis compatible with it - Ensures that
--diffmode works forflake8 - Renames
IncorrecttoWrongwhere possible - Renames
IncorrectlyNestedTernaryViolationtoNestedTernaryViolation - Renames
IncorectLoopIterTypeViolationtoWrongLoopIterTypeViolation
Version 0.10.0 aka The Great Compare
This release is mostly targeted at writing better compares and conditions.
We introduce a lot of new rules related to this topic improving:
consistency, complexity, and general feel from your code.
In this release we have ported a lot of existing pylint rules,
big cudos to the developers of this wonderful tool.
Features
- Adds
flake8-executableas a dependency - Adds
flake8-rst-docstringsas a dependency - Validates options that are passed with
flake8 - Forbids to use module level mutable constants
- Forbids to over-use strings
- Forbids to use
breakpointfunction - Limits yield tuple lengths
- Forbids to have too many
awaitstatements - Forbids to subclass lowercase
builtins - Forbids to have useless
lambdas - Forbids to use
len(sized) > 0andif len(sized)style checks - Forbids to use repeatable conditions:
flag or flag - Forbids to write conditions like
not some > 1 - Forbids to use heterogenous compares like
x == x > 0 - Forbids to use complex compare with several items (
>= 3) - Forbids to have class variables that are shadowed by instance variables
- Forbids to use ternary expressions inside
ifconditions - Forces to use ternary instead of
... and ... or ...expression - Forces to use
c < b < ainstead ofa > b and b > c - Forces to use
c < b < ainstead ofa > b > c - Forbids to use explicit
in []andin (), use sets or variables instead - Forces to write
isinstance(some, (A, B))
instead ofisinstance(some, A) or isinstance(some, B) - Forbids to use
isinstance(some (A,)) - Forces to merge
a == b or a == cintoa in {b, c}and
to mergea != b and a != cintoa not in {b, c}
Bugfixes
- Fixes incorrect line number for
Z331 - Fixes that
Z311was not raising for multiplenot incases - Fixes a bunch of bugs for rules working with
Assignand notAnnAssign - Fixes that
continuewas not triggeringUselessReturningElseViolation
Misc
- Renames
logics/tologic/since it is grammatically correct - Renames
RedundanttoUseless - Renames
ComparisontoCompare - Renames
WrongConditionalViolationtoConstantConditionViolation - Renames
ComplexDefaultValuesViolationtoComplexDefaultValueViolation - Refactors
UselessOperatorsVisitor - Adds
compat/package, getting ready forpython3.8 - Adds
Makefile - A lot of minor dependency updates
Version 0.9.1
Bugfixes
- Fixes issue with
pydocstyle>=4by glueing its version topydocstyle<4
Version 0.9.0
This is mostly a supporting release with several new features
and lots of bug fixes.
Features
- Forbids to use magic module methods
__getattr__and__dir__ - Forbids to use multiline conditions
- Forbids local variables that are only used in
returnstatements
Bugfixes
- Fixes module names for modules like
io.py - Fixes false positive
Z310for numbers like0xE - Fixes false positive for compare ordering with
await - Fixes problem with missing
_allowed_left_nodes - Fixes problem false positive for
Z121when using_for unused var names - Fixes false positive for negative number in default values
- Fixes error text for
ComplexDefaultValuesViolation - Fixes problem with false positive for
Z459
when a default value is anEllipsis
Misc
- Adds
py.typedfile in case someone will import our code,
now it will have types - Adds several missing
@finaldecorators - Enforces typing support
- Refactors how
typing_extensionspackage is used - Adds docs about
black - Adds big "Star" button
- Multiple dependencies update
- Better
excluderule forflake8check - Removed warnings from
pytest
Version 0.8.1
Bugfixes
- Fixes how
wps_contextis calculated, sosuper()calls are now working
Version 0.8.0
Features
- Updates
flake8to3.7+ - Adds
flake8-annotations-complexityas a dependency, forbids complex annotations - Forbids to use redundant
+,~,not, and-operators before numbers - Forbids to use complex default values
- Forbids to use anything rather than names in
forloop vars definitions - Forbids to use anything rather than names in
withblock vars definitions - Forbids to use anything rather than names in comprehension vars definitions
- Forbids to use direct magic attributes access
- Forbids to use negated conditions
- Forbids to use too many
# pragma: no covercomments - Forbids to use nested
tryblocks
Bugfixes
- Fixes problems with empty lines after magic comments, see #492
- Fixes error message for
delkeyword: it is now just'del'not'delete'
Misc
- Removes
flake8-per-file-ignoresplugin, sinceflake8now handles it - Removes
flake8-type-annotationsplugin, sinceflake8now handles it - Improves docs for
WrongKeywordViolation - Improves docs for
EmptyLineAfterCodingViolation - Improves docs for
ProtectedAttributeViolation - Adds docs about
.pyifiles
Version 0.7.1
Bugfixes
- Allows
Generic[SomeType]to be a valid superclass - Forces to use
flake8version3.6instead of3.7
Misc
- Improves docs about using
# type: somecomment inforloops
Version 0.7.0
Features
- Now raising a violation for every
boolnon-keyword argument
and showing better error message - Changes how
max-argumentsare counted.
Nowself,cls, andmcscount as real arguments - Forbids to use
yieldinside comprehensions - Forbids to have single line triple-quoted string assignments
- Forbids to have same items in
setliterals - Forbids to subclass
BaseException - Forbids to use simplifiable
ifexpressions and nodes - Forbids to have incorrect nodes in
classbody - Forbids to have methods without any arguments
- Forbids to have incorrect base classes nodes
- Enforces consistent
__slots__syntax - Forbids to use names with trailing
_without a reason - Forbids to use
super()with arguments or outside of methods - Forbids to have too many
exceptcases - Enforces to have an empty line after
codingcomment - Forbids to use too many
# noqacomments - Forbids to use variables declared as unused
- Forbids to use redundant
elseblocks - Forbids to use inconsistent
returnandyieldstatements - Forbids to use multiple
returnpath intry/expect/finally - Forbids to use implicit string concatenation
- Forbids to have useless
continuenodes inside the loops - Forbids to have useless nodes
- Forbids to have useless
raisestatements - Adds
paramsandparametersto black-listed names
Bugfixes
- Fixes a lot of rules that were ignoring
Bytesnode as constant type - Fixes location of the
BooleanPositionalArgumentViolation - Fixes argument count issue with
asyncfunctions - Fixes
WrongConditionalVisitornot detectingtupleas constants - Fixes
WrongConditionalVisitornot detecting negative numbers as constants - Fixes some magic number that were not detected based on their location
- Fixes error when regular functions named as blacklisted
magic methods were forbidden, now we check for methods only - Fixes error when strings like
U'some'was not triggering unicode violation - Fixes error when string like
U'some'was not triggering modifier violation
Misc
- Adds
safetyand other dependency checks to the CI process - Improves tests: now
tokenizeworks differently inside tests - Improves tests: now testing more brackets cases aka "magic coverage bug"
- Improves docs: adds new badge about our code style
- Refactoring: trying to use
astorwhere possible to simplify the codebase - Refactoring: introduces some new
transformations - Refactoring: now we do not have any magical text casts for violations
- Improves tests: changes how
flake8is executed, now it is twice as fast - Improves docs: now linting
conf.pywithflake8 - Improves tests: now we check that ignored violation are raised with
noqa - Improves docs: we have added a special graph to show our architecure
- Improves docs: we now have a clean page for
checkerwithout extra junk - Improves docs: we now have a tutorial for creating new rules
- Refactoring: moves
presetspackage to the root - Improves tests: we now lint our layered architecure with
layer-lint
Version 0.6.3
Bugfixes
- Fixes an issue-450 with
dicts with just values and no keys
Version 0.6.2
Bugfixes
- Fixes a crash with class attributes assignment