Skip to content

Commit

Permalink
misra.py: close file in getAddonRules()
Browse files Browse the repository at this point in the history
  • Loading branch information
firewave committed Sep 26, 2023
1 parent 054d1a7 commit 3d3d597
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions addons/misra.py
Original file line number Diff line number Diff line change
Expand Up @@ -1106,11 +1106,12 @@ def getAddonRules():
"""Returns dict of MISRA rules handled by this addon."""
addon_rules = []
compiled = re.compile(r'.*def[ ]+misra_([0-9]+)_([0-9]+)[(].*')
for line in open(__file__):
res = compiled.match(line)
if res is None:
continue
addon_rules.append(res.group(1) + '.' + res.group(2))
with open(__file__) as f:
for line in f:
res = compiled.match(line)
if res is None:
continue
addon_rules.append(res.group(1) + '.' + res.group(2))
return addon_rules


Expand Down

0 comments on commit 3d3d597

Please sign in to comment.