Skip to content

Commit

Permalink
Add news
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobtylerwalls committed Jan 20, 2024
1 parent 9b42d21 commit f17a83c
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions doc/whatsnew/fragments/1727.false_negative.1
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
``used-before-assignment`` is now emitted when relying on variable assignments
that were not exhaustively made in every if/else branch.

If you rely on a pattern like this:
```
if guarded():
var = 1

if guarded():
print(var) # now emits used-before-assignment
```

...you may be concerned that ``used-before-assignment`` is not totally useful
in this instance. However, consider that pylint, as a static analysis tool, does
not know if ``guarded()`` is deterministic, has side effects, or talks to
a database. (Likewise, for ``guarded`` instead of ``guarded()``, any other
part of your program may have changed the value in the meantime.)

Closes #1727

0 comments on commit f17a83c

Please sign in to comment.