Skip to content

Commit

Permalink
enabled and fixed no-else-break pylint warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
firewave committed Oct 7, 2024
1 parent c9665a2 commit cad4d9c
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 41 deletions.
1 change: 0 additions & 1 deletion .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ disable=
comparison-with-itself,
too-many-return-statements,
no-else-continue,
no-else-break,
inconsistent-return-statements,
consider-using-in,
too-many-nested-blocks,
Expand Down
6 changes: 3 additions & 3 deletions addons/misra.py
Original file line number Diff line number Diff line change
Expand Up @@ -2757,10 +2757,10 @@ def misra_12_3(self, data):
if prev.str == ';':
self.reportError(token, 12, 3)
break
elif prev.str in ')}]':
prev = prev.link
elif prev.str in '({[':
if prev.str in '({[':
break
if prev.str in ')}]':
prev = prev.link
prev = prev.previous

def misra_12_4_check_expr(self, expr):
Expand Down
26 changes: 13 additions & 13 deletions addons/misra_9.py
Original file line number Diff line number Diff line change
Expand Up @@ -376,22 +376,22 @@ def unwindAndContinue(self):

self.token = self.token.astParent.astOperand2
break
else:
self.token = self.token.astParent
if self.token.str == '{':
if self.root:
self.ed = self.root.getLastValueElement()
self.ed.markAsCurrent()

# Cleanup if root is dummy node representing excess levels in initializer
if self.root.name == '<-':
self.root.children[0].parent = self.root.parent
self.token = self.token.astParent
if self.token.str == '{':
if self.root:
self.ed = self.root.getLastValueElement()
self.ed.markAsCurrent()

self.root = self.root.parent
# Cleanup if root is dummy node representing excess levels in initializer
if self.root.name == '<-':
self.root.children[0].parent = self.root.parent

if self.token.astParent is None:
self.token = None
break
self.root = self.root.parent

if self.token.astParent is None:
self.token = None
break

def misra_9_x(self, data, rule, rawTokens = None):

Expand Down
40 changes: 16 additions & 24 deletions tools/donate-cpu-server.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,9 +222,8 @@ def crashReport(results_path: str, query_params: dict):
if OLD_VERSION not in line:
# Package results seem to be too old, skip
break
else:
# Current package, parse on
continue
# Current package, parse on
continue
if datestr is None and line.startswith(str(current_year) + '-') or line.startswith(str(current_year - 1) + '-'):
datestr = line
elif pkgs is not None and package_url is None and line.startswith('ftp://'):
Expand Down Expand Up @@ -323,9 +322,8 @@ def timeoutReport(results_path: str) -> str:
if OLD_VERSION not in line:
# Package results seem to be too old, skip
break
else:
# Current package, parse on
continue
# Current package, parse on
continue
if datestr is None and line.startswith(str(current_year) + '-') or line.startswith(str(current_year - 1) + '-'):
datestr = line
elif line.startswith('count:'):
Expand Down Expand Up @@ -611,9 +609,8 @@ def summaryReport(resultsPath: str, name: str, prefix: str, marker: str) -> str:
if OLD_VERSION not in line:
# Package results seem to be too old, skip
break
else:
# Current package, parse on
continue
# Current package, parse on
continue
if line.startswith(marker):
inResults = True
continue
Expand Down Expand Up @@ -675,9 +672,8 @@ def messageIdReport(resultPath: str, marker: str, messageId: str, query_params:
if OLD_VERSION not in line:
# Package results seem to be too old, skip
break
else:
# Current package, parse on
continue
# Current package, parse on
continue
if line.startswith('ftp://'):
url = line
continue
Expand Down Expand Up @@ -782,9 +778,8 @@ def timeReport(resultPath: str, show_gt: bool, query_params: dict):
if OLD_VERSION not in line:
# Package results seem to be too old, skip
break
else:
# Current package, parse on
continue
# Current package, parse on
continue
if datestr is None and line.startswith(str(current_year) + '-') or line.startswith(str(current_year - 1) + '-'):
datestr = line
continue
Expand Down Expand Up @@ -883,9 +878,8 @@ def timeReportSlow(resultPath: str) -> str:
if OLD_VERSION not in line:
# Package results seem to be too old, skip
break
else:
# Current package, parse on
continue
# Current package, parse on
continue
if datestr is None and line.startswith(str(current_year) + '-') or line.startswith(str(current_year - 1) + '-'):
datestr = line
continue
Expand Down Expand Up @@ -971,9 +965,8 @@ def check_library_report(result_path: str, message_id: str) -> str:
if OLD_VERSION not in line:
# Package results seem to be too old, skip
break
else:
# Current package, parse on
continue
# Current package, parse on
continue
if not in_results:
if line.startswith(start_marker):
in_results = True
Expand Down Expand Up @@ -1037,9 +1030,8 @@ def check_library_function_name(result_path: str, function_name: str, query_para
if OLD_VERSION not in line:
# Package results seem to be too old, skip
break
else:
# Current package, parse on
continue
# Current package, parse on
continue
if line.startswith('ftp://'):
package_url = line
continue
Expand Down

0 comments on commit cad4d9c

Please sign in to comment.