misra.py: Possible fix for problematic code (#1613)

Without the `for scope in data.scopes:` loop, scope is not assigned anything.
From the context a loop over `data.scopes` could be intended. But other things like indentation would be possibly correct too. Not sure how this code should be.
We try this fix.
This commit is contained in:
Sebastian 2019-01-22 07:28:29 +01:00 committed by GitHub
parent 149d688e9a
commit 72c9646be9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 5 deletions

View File

@ -731,11 +731,12 @@ class MisraChecker:
self.reportError(scope.bodyStart, 5, 3)
for e in enum:
if scope.className and innerVar.nameToken.str[:31] == e[:31]:
if int(innerVar.nameToken.linenr) > int(innerScope.bodyStart.linenr):
self.reportError(innerVar.nameToken, 5, 3)
else:
self.reportError(innerScope.bodyStart, 5, 3)
for scope in data.scopes:
if scope.className and innerVar.nameToken.str[:31] == e[:31]:
if int(innerVar.nameToken.linenr) > int(innerScope.bodyStart.linenr):
self.reportError(innerVar.nameToken, 5, 3)
else:
self.reportError(innerScope.bodyStart, 5, 3)
for e in enum:
for scope in data.scopes:
if scope.className and scope.className[:31] == e[:31]: