SCR109: self-assignment
Variable assigned to itself
| Code | SCR109 |
| Name | self-assignment |
| Category | Scripts (SCR) |
| Default severity | warning |
| Enabled by default | yes |
| Fix available | no |
| ign-lint equivalent | none |
What it does
Section titled “What it does”Reports x = x and the matching positions of a, b = a, b.
Not reported in class bodies (x = x there copies a module variable into
the class) and when the value is a builtin or an Ignition global
(len = len makes a module-level alias).
Why is this bad?
Section titled “Why is this bad?”The statement does nothing. Usually another name was meant on one side
(self.value = value written as value = value).
Example
Section titled “Example”def valueChanged(self, previousValue, currentValue, origin, missedEvents): currentValue = currentValueUse instead:
def valueChanged(self, previousValue, currentValue, origin, missedEvents): self.custom.current = currentValuepylint
Section titled “pylint”Corresponds to W0127 self-assigning-variable.
Generated from the rule metadata by iglint generate-docs; iglint rule SCR109 prints the same page in the terminal. Source: docs/rules/SCR109.md.