Skip to content

Commit

Permalink
Much more errors to be fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
Szelethus committed Oct 19, 2023
1 parent d6a9728 commit 60bf00b
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 11 deletions.
3 changes: 2 additions & 1 deletion analyzer/codechecker_analyzer/analyzer.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,8 @@ def perform_analysis(args, skip_handlers, actions, metadata_tool,

# TODO: cppcheck may require a different environment than clang.
version = analyzer_types.supported_analyzers[analyzer] \
.get_binary_version(context.analyzer_env)
.get_binary_version(context.analyzer_binaries[analyzer],
context.analyzer_env)
metadata_info['analyzer_statistics']['version'] = version

metadata_tool['analyzers'][analyzer] = metadata_info
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ def get_binary_version(self, configured_binary, environ, details=False) \
encoding="utf-8",
errors="ignore")
if details:
return output
return output.strip()
return parse_version(output)
except (subprocess.CalledProcessError, OSError) as oerr:
LOG.warning("Failed to get analyzer version: %s",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ def get_binary_version(self, configured_binary, environ, details=False) \
encoding="utf-8",
errors="ignore")
if details:
return output
return output.strip()
return parse_version(output)
except (subprocess.CalledProcessError, OSError) as oerr:
LOG.warning("Failed to get analyzer version: %s",
Expand Down
31 changes: 23 additions & 8 deletions analyzer/codechecker_analyzer/cmd/analyzers.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ def main(args):
logger.setup_logger(args.verbose if 'verbose' in args else None, stream)

context = analyzer_context.get_context()
working_analyzers, errored = \
_, errored = \
analyzer_types.check_supported_analyzers(
analyzer_types.supported_analyzers)

Expand Down Expand Up @@ -163,16 +163,21 @@ def uglify(text):

configs = analyzer_class.get_analyzer_config()
if not configs:
LOG.warning(f"No analyzer configurations found for '{analyzer}'. "
"If you suspsect this shouldn't be the case, try to "
"update your analyzer or check whether CodeChecker "
"found the intended binary.")
LOG.warning("No analyzer configurations found for "
f"'{analyzer_name}'. If you suspsect this shouldn't "
"be the case, try to update your analyzer or check "
"whether CodeChecker found the intended binary.")

rows = [(':'.join((analyzer_name, c[0])), c[1]) if 'details' in args
else (':'.join((analyzer_name, c[0])),) for c in configs]

print(twodim.to_str(args.output_format, header, rows))

for err_analyzer_name, err_reason in errored:
if analyzer_name == err_analyzer_name:
LOG.warning(
f"Can't analyze with '{analyzer_name}': {err_reason}")

return

header = ['Name', 'Version', 'Path']
Expand All @@ -195,9 +200,19 @@ def uglify(text):

rows.append([analyzer_name, version, binary])

if rows:
assert rows
if 'details' not in args:
print(twodim.to_str(args.output_format, header, rows))
else:
for row in rows:
print(''.join(f"""
Analyzer name: {row[0]}
Path to binary: {row[2]}
Version info:
{row[1]}
---------
"""))

for analyzer_name, err_reason in errored:
if 'details' not in args:
print(f"Can't analyze with '{analyzer_name}': {err_reason}")
LOG.warning(f"Can't analyze with '{analyzer_name}': {err_reason}")

0 comments on commit 60bf00b

Please sign in to comment.