donate-cpu-server.py: fixed "top x" reports / some cleanups (#5475)

This broke with a late variable name cleanup I did in
`check_library_report()` after testing it locally.
This commit is contained in:
Oliver Stöneberg 2023-09-22 15:18:16 +02:00 committed by GitHub
parent ba23b20264
commit c527af9042
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 14 additions and 18 deletions

View File

@ -26,7 +26,7 @@ from urllib.parse import urlparse
# Version scheme (MAJOR.MINOR.PATCH) should orientate on "Semantic Versioning" https://semver.org/ # Version scheme (MAJOR.MINOR.PATCH) should orientate on "Semantic Versioning" https://semver.org/
# Every change in this script should result in increasing the version number accordingly (exceptions may be cosmetic # Every change in this script should result in increasing the version number accordingly (exceptions may be cosmetic
# changes) # changes)
SERVER_VERSION = "1.3.45" SERVER_VERSION = "1.3.46"
OLD_VERSION = '2.12.0' OLD_VERSION = '2.12.0'
@ -665,11 +665,10 @@ def messageIdReport(resultPath: str, marker: str, messageId: str, query_params:
if line.startswith('ftp://'): if line.startswith('ftp://'):
url = line url = line
continue continue
if not inResults:
if line.startswith(marker): if line.startswith(marker):
inResults = True inResults = True
continue continue
if not inResults:
continue
if line.startswith('diff:'): if line.startswith('diff:'):
break break
if line.endswith(e): if line.endswith(e):
@ -710,11 +709,10 @@ def messageIdTodayReport(resultPath: str, messageId: str, marker: str) -> str:
if line.startswith('ftp://'): if line.startswith('ftp://'):
url = line url = line
continue continue
if not inResults:
if line.startswith(marker): if line.startswith(marker):
inResults = True inResults = True
continue continue
if not inResults:
continue
if line.startswith('diff:'): if line.startswith('diff:'):
break break
if line.endswith(e): if line.endswith(e):
@ -919,22 +917,22 @@ def check_library_report(result_path: str, message_id: str) -> str:
metric = 'macros' metric = 'macros'
m_column = 'macro' m_column = 'macro'
metric_link = 'unknown_macro' metric_link = 'unknown_macro'
marker = HEAD_MARKER start_marker = HEAD_MARKER
elif message_id == 'valueFlowBailoutIncompleteVar': elif message_id == 'valueFlowBailoutIncompleteVar':
metric = 'variables' metric = 'variables'
m_column = 'Variable' m_column = 'Variable'
metric_link = 'incomplete_var' metric_link = 'incomplete_var'
marker = HEAD_MARKER start_marker = HEAD_MARKER
elif message_id == 'checkLibraryCheckType': elif message_id == 'checkLibraryCheckType':
metric = 'types' metric = 'types'
m_column = 'Type' m_column = 'Type'
metric_link = 'check_library' metric_link = 'check_library'
marker = INFO_MARKER start_marker = INFO_MARKER
else: else:
metric = 'functions' metric = 'functions'
m_column = 'Function' m_column = 'Function'
metric_link = 'check_library' metric_link = 'check_library'
marker = INFO_MARKER start_marker = INFO_MARKER
functions_shown_max = 5000 functions_shown_max = 5000
html = '<!DOCTYPE html>\n' html = '<!DOCTYPE html>\n'
@ -960,10 +958,9 @@ def check_library_report(result_path: str, message_id: str) -> str:
else: else:
# Current package, parse on # Current package, parse on
continue continue
if line.startswith(marker):
in_results = True
continue
if not in_results: if not in_results:
if line.startswith(start_marker):
in_results = True
continue continue
if line.startswith('diff:'): if line.startswith('diff:'):
break break
@ -1033,13 +1030,12 @@ def check_library_function_name(result_path: str, function_name: str, query_para
if line.startswith('cppcheck-options:'): if line.startswith('cppcheck-options:'):
cppcheck_options = line cppcheck_options = line
continue continue
if not in_results:
if line.startswith(marker): if line.startswith(marker):
in_results = True in_results = True
continue continue
if line.startswith('diff:'): if line.startswith('diff:'):
break break
if not in_results:
continue
if id not in line: if id not in line:
continue continue
if not (' ' + function_name + ' ') in line: if not (' ' + function_name + ' ') in line: