Closed ronnodas closed 1 year ago
Hello, @ronnodas! Thank you for reporting this bug. I was able to reproduce it and will work on a fix. We will let you know once it is fixed.
Hi, @ronnodas! A fix for this bug has just been merged. It will be available in the next Sourcery release. Thanks again for reporting this issue!
Resolved in 0.12.8
Resolved in 0.12.8
Checklist
Description
When defining a
set
attribute by usingadd
in a loop,set-comprehension
triggers even when there are conditionals involving the set being added to. The equivalent refactoring does not appear for defining variables. Here is some code sample:The suggested refactoring is to replace the
__init__
body by:which raises an
AttributeError
.Debug Information
IDE Version: PyCharm Professional Edition 2022.2.1
Sourcery Version: Sourcery 0.12.7
Operating system and Version: Linux, Fedora 36