wemake-python-styleguide v0.15.0 Release Notes

  • 🔋 Features

    • ➕ Adds python3.9 support
    • 💅 Forbids to use new-style decorators on python3.9
    • 🔄 Changes how we treat own/foreign attributes, since now we only check assigned attribute names for self/cls/mcs, but not any other ones. So, now writting point.x = 1 will not trigger any violations. Previously, it would raise "too short name".
    • Forbids using non-trivial expressions as an argument to except
    • Forbids using too many variables in a tuple unpacking
    • Forbids using float("NaN").
    • Forbids assigning to a slice
    • Allow __call__ method to be asynchronous
    • 👍 Allows common strings not to be counted against string constant overuse limit
    • Forbids to unpack iterable objects to lists #1259
    • Forbids to use single return None
    • Add __await__ to the list of priority magic methods
    • Forbids to use float zeros (0.0)
    • 👀 Forbids raise Exception and raise BaseException
    • Forbids to use % with zero as the divisor
    • ✅ Forbids testing conditions to just return booleans when it is possible to simply return the condition itself
    • Forbids to use unsafe infinite loops
    • Forbids to use raw strings r'' when not necessary
    • Forbids to use too complex f-strings
    • Forbids to use too many raise statements inside a single function
    • Forbids to compare with float and complex values
    • Forbids single element destruct
    • 🔧 Forbids to ignore some violations (configurable) on a line level
    • Forbids single element unpacking
    • Forbids to unpack lists with side-effects
    • 📄 Forbids to use miltiline strings except for assignments and docstrings
    • Forbids not returning anything in functions and methods starting with get_
    • Forbids to use empty comment
    • Forbids using bitwise operation with boolean operation
    • Forbids inconsistent structuring of multiline comprehensions
    • Forbids to use unpythonic getters and setters such as get_attribute or set_attribute
    • 🆓 Now credits, license, and copyright builtins are free to shadow

    🛠 Bugfixes

    • 🛠 Fixes fails of annotation complexity on Literal[""]
    • 🛠 Fixes how wrong variable names were checked case sensitive with WPS110
    • Fixes false positives DirectMagicAttributeAccessViolation with __mro__, __subclasses__ and __version__
    • 👉 Make WPS326 work when there is comment between string literals
    • 👍 Allowed yield statements in call method
    • 👍 Allow to use ^ with 1
    • 🛠 Fixes false positives in WPS513 and WPS323
    • 🛠 Fixes false positive WPS426 if lambda in loop uses only its arguments
    • 🛠 Fixes false negative WPS421 with pprint.pprint
    • 🛠 Fixes WPS441 triggering when reusing variable names in multiple loops
    • 🛠 Fixes false positive ImplicitEnumerateViolation on range with step #1742
    • 👍 Allows to use _ to declare several unused variables, like: x, _, _ = coordinates()
    • 🛠 Fixes variable reassignment in class context
    • 🛠 Fixes that *'abc' was not counted as pointless star expression
    • 🛠 Fixes that -some was counted as overused expression
    • 🛠 Fixes several bugs with attribute names

    Misc

    • ⚡️ Updates lots of dependenices
    • 🛠 Fixed documentation for TooManyPublicAttributesViolation
    • ⚡️ Updated isort config
    • Introduce helper script to check for missing calls to self.generic_visit(node) in AST visitors
    • ⚡️ Updates poetry version to 1.1
    • ⚡️ Updates reviewdog version to 0.11.0 and adds action-depup