Skip to content

SCR119: return-in-finally

return or break in a finally clause

Code SCR119
Name return-in-finally
Category Scripts (SCR)
Default severity warning
Enabled by default yes
Fix available no
ign-lint equivalent none

Reports return in a finally clause, and break in a finally clause that leaves a loop outside the try.

When the try body raises, the finally clause runs and the return or break discards the exception: the error vanishes without a trace, not even in the gateway log.

def readSetpoint(path):
try:
return system.tag.readBlocking([path])[0].value
finally:
return None

Use instead:

def readSetpoint(path):
try:
return system.tag.readBlocking([path])[0].value
except Exception:
return None

Corresponds to W0150 lost-exception.


Generated from the rule metadata by iglint generate-docs; iglint rule SCR119 prints the same page in the terminal. Source: docs/rules/SCR119.md.