Skip to content

v0.22.2 - Quick fixes for .count() > 0 no longer produce broken code

Choose a tag to compare

@github-actions github-actions released this 21 Nov 19:18
· 19 commits to main since this release
ac40f8d

Quick fixes for .count() > 0 no longer produce broken code.

Fixed

  • DOL006 no longer marks snapshot removal safe to apply
    (#313). The VS Code rule
    skips dictionary views such as cache.keys() and offers a manual suggestion
    for possible QuerySets.

  • VS Code rules DOL001-DOL004 skip a match that is an operand of an operator
    (#293).
    In if event.capacity - event.registrations.count() > 0: Python tests the
    whole difference, so the safe fix event.capacity - event.registrations.exists()
    made a full event look open, and DOL002's rewrite
    event.capacity - not event.registrations.exists() was a SyntaxError. Matches after an arithmetic, bitwise or comparison operator are
    now left alone; assignment and augmented assignment still get the finding.

  • VS Code rules DOL001-DOL004 skip a match that continues on its right
    (#296).
    if qs.count() > 0.5: was rewritten to qs.exists().5 (a SyntaxError), and
    > 0 + offset or == 0 == other changed meaning. A match followed by a
    fraction, an arithmetic or bitwise operator, another comparison, is or in
    is now left alone.