Treat attribute constants as constant for yoda-conditions (#2266)

Accessed attributes that are Python constants should be considered for yoda-conditions


```py
## Error
JediOrder.YODA == age  # SIM300

## OK
age == JediOrder.YODA
```

~~PS: This PR will fail CI, as the `main` branch currently failing.~~
This commit is contained in:
Franck Nijhof
2023-01-27 18:55:12 +01:00
committed by GitHub
parent 2c415016a6
commit 8149c8cbc4
3 changed files with 22 additions and 0 deletions

View File

@@ -9,6 +9,7 @@
YODA == age # SIM300
YODA > age # SIM300
YODA >= age # SIM300
JediOrder.YODA == age # SIM300
# OK
compare == "yoda"
@@ -22,3 +23,4 @@ age == YODA
age < YODA
age <= YODA
YODA == YODA
age == JediOrder.YODA