green-code-initiative / creedengo-python

Reduce the environmental footprint of your Python software programs
https://green-code-initiative.org/
GNU General Public License v3.0
7 stars 9 forks source link

Rule EC7 detects object (__init__) with one argument as a setter #17

Closed AghilesAzzoug closed 9 months ago

AghilesAzzoug commented 10 months ago

Rule EC7 (AvoidGettersAndSetters) detects __init__ methods with one argument and assignment as a setter.

To Reproduce Code that can reproduce the error:

class Something:
    def __init__(self, value):
        self.value = value
...

Expected behavior It shouldn't be detected as a code smell since init method is used to assign values to object properties.

Software Versions

dedece35 commented 9 months ago

Hi @AghilesAzzoug ,

thank you for your issue. you agree it's a bug. the correction is done in related PR. I'm waiting for core team reviewer.