Skip to content

Releases: wemake-services/wemake-python-styleguide

Version 0.11.0 aka The New Violation Codes

18 Jul 14:53
909aa85

Choose a tag to compare

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 Z error code to WPS code
  • Breaking: creates new violation group refactoring.py
  • Breaking: creates new violation group oop.py
  • Breaking: moving a lot of violations
    from best_practices to refactoring, oop, and consistency
  • Adds new wemake formatter (using it now by default)

Bugfixes

  • Fixes error message of OverusedStringViolation for empty strings
  • Now does not count string annotations as strings for OverusedStringViolation
  • Fixes InconsistentReturnVariableViolation was raised twice

Misc

  • Adds migration guide to 0.11
  • Improves legacy guide
  • Adds --show-source to the default recommended configuration
  • Adds better docs about auto-formatters
  • Adds autopep8 to CI to make sure that wps is compatible with it
  • Ensures that --diff mode works for flake8
  • Renames Incorrect to Wrong where possible
  • Renames IncorrectlyNestedTernaryViolation to NestedTernaryViolation
  • Renames IncorectLoopIterTypeViolation to WrongLoopIterTypeViolation

Version 0.10.0 aka The Great Compare

13 Jul 14:51
ceb257b

Choose a tag to 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-executable as a dependency
  • Adds flake8-rst-docstrings as a dependency
  • Validates options that are passed with flake8
  • Forbids to use module level mutable constants
  • Forbids to over-use strings
  • Forbids to use breakpoint function
  • Limits yield tuple lengths
  • Forbids to have too many await statements
  • Forbids to subclass lowercase builtins
  • Forbids to have useless lambdas
  • Forbids to use len(sized) > 0 and if 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 if conditions
  • Forces to use ternary instead of ... and ... or ... expression
  • Forces to use c < b < a instead of a > b and b > c
  • Forces to use c < b < a instead of a > b > c
  • Forbids to use explicit in [] and in (), use sets or variables instead
  • Forces to write isinstance(some, (A, B))
    instead of isinstance(some, A) or isinstance(some, B)
  • Forbids to use isinstance(some (A,))
  • Forces to merge a == b or a == c into a in {b, c} and
    to merge a != b and a != c into a not in {b, c}

Bugfixes

  • Fixes incorrect line number for Z331
  • Fixes that Z311 was not raising for multiple not in cases
  • Fixes a bunch of bugs for rules working with Assign and not AnnAssign
  • Fixes that continue was not triggering UselessReturningElseViolation

Misc

  • Renames logics/ to logic/ since it is grammatically correct
  • Renames Redundant to Useless
  • Renames Comparison to Compare
  • Renames WrongConditionalViolation to ConstantConditionViolation
  • Renames ComplexDefaultValuesViolation to ComplexDefaultValueViolation
  • Refactors UselessOperatorsVisitor
  • Adds compat/ package, getting ready for python3.8
  • Adds Makefile
  • A lot of minor dependency updates

Version 0.9.1

12 Jul 18:58
c5cb215

Choose a tag to compare

Bugfixes

  • Fixes issue with pydocstyle>=4 by glueing its version to pydocstyle<4

Version 0.9.0

20 Jun 11:03
8f3ab49

Choose a tag to compare

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 return statements

Bugfixes

  • Fixes module names for modules like io.py
  • Fixes false positive Z310 for numbers like 0xE
  • Fixes false positive for compare ordering with await
  • Fixes problem with missing _allowed_left_nodes
  • Fixes problem false positive for Z121 when 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 an Ellipsis

Misc

  • Adds py.typed file in case someone will import our code,
    now it will have types
  • Adds several missing @final decorators
  • Enforces typing support
  • Refactors how typing_extensions package is used
  • Adds docs about black
  • Adds big "Star" button
  • Multiple dependencies update
  • Better exclude rule for flake8 check
  • Removed warnings from pytest

Version 0.8.1

13 Jun 12:53
a92e005

Choose a tag to compare

Bugfixes

  • Fixes how wps_context is calculated, so super() calls are now working

Version 0.8.0

03 Mar 16:32
b3c1bfa

Choose a tag to compare

Features

  • Updates flake8 to 3.7+
  • Adds flake8-annotations-complexity as 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 for loop vars definitions
  • Forbids to use anything rather than names in with block 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 cover comments
  • Forbids to use nested try blocks

Bugfixes

  • Fixes problems with empty lines after magic comments, see #492
  • Fixes error message for del keyword: it is now just 'del' not 'delete'

Misc

  • Removes flake8-per-file-ignores plugin, since flake8 now handles it
  • Removes flake8-type-annotations plugin, since flake8 now handles it
  • Improves docs for WrongKeywordViolation
  • Improves docs for EmptyLineAfterCodingViolation
  • Improves docs for ProtectedAttributeViolation
  • Adds docs about .pyi files

Version 0.7.1

08 Feb 12:53
16889fe

Choose a tag to compare

Bugfixes

  • Allows Generic[SomeType] to be a valid superclass
  • Forces to use flake8 version 3.6 instead of 3.7

Misc

  • Improves docs about using # type: some comment in for loops

Version 0.7.0

23 Jan 08:40
4665b77

Choose a tag to compare

Features

  • Now raising a violation for every bool non-keyword argument
    and showing better error message
  • Changes how max-arguments are counted.
    Now self, cls, and mcs count as real arguments
  • Forbids to use yield inside comprehensions
  • Forbids to have single line triple-quoted string assignments
  • Forbids to have same items in set literals
  • Forbids to subclass BaseException
  • Forbids to use simplifiable if expressions and nodes
  • Forbids to have incorrect nodes in class body
  • 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 except cases
  • Enforces to have an empty line after coding comment
  • Forbids to use too many # noqa comments
  • Forbids to use variables declared as unused
  • Forbids to use redundant else blocks
  • Forbids to use inconsistent return and yield statements
  • Forbids to use multiple return path in try/expect/finally
  • Forbids to use implicit string concatenation
  • Forbids to have useless continue nodes inside the loops
  • Forbids to have useless nodes
  • Forbids to have useless raise statements
  • Adds params and parameters to black-listed names

Bugfixes

  • Fixes a lot of rules that were ignoring Bytes node as constant type
  • Fixes location of the BooleanPositionalArgumentViolation
  • Fixes argument count issue with async functions
  • Fixes WrongConditionalVisitor not detecting tuple as constants
  • Fixes WrongConditionalVisitor not 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 safety and other dependency checks to the CI process
  • Improves tests: now tokenize works 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 astor where 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 flake8 is executed, now it is twice as fast
  • Improves docs: now linting conf.py with flake8
  • 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 checker without extra junk
  • Improves docs: we now have a tutorial for creating new rules
  • Refactoring: moves presets package to the root
  • Improves tests: we now lint our layered architecure with layer-lint

Version 0.6.3

23 Jan 08:39
4a77d81

Choose a tag to compare

Bugfixes

  • Fixes an issue-450 with dicts with just values and no keys

Version 0.6.2

05 Jan 15:55
300f257

Choose a tag to compare

Bugfixes

  • Fixes a crash with class attributes assignment