Python scanner (22.214.171.12447) detects unused local variables accumulated with operators like
+=, but failed on variables accumulated with
min()/max() (or may be other functions without side effects):
max_value = 0.0
avg_value = 0.0
for value_tag in value_tags:
value = get_value(value_tag) # arbitrary source of data
max_value = max(max_value, value)
avg_value += voltage
Are you using SonarCloud or SonarQube (if the latter, what version?)
SonarQube Developer Edition Version 9.4 (build 54424).
Sorry for the very late answer.
You’re right, we could improve the rule to catch such cases.
I created SONARPY-1062 to track this improvement.
Thanks a lot for your suggestion!
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.