-
Notifications
You must be signed in to change notification settings - Fork 405
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CodeChecker cmd runs #4468
base: master
Are you sure you want to change the base?
CodeChecker cmd runs #4468
Conversation
a83c3a5
to
6dc01b9
Compare
analyzers = info.checkers.keys() | ||
for analyzer in analyzers: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
analyzers = info.checkers.keys() | |
for analyzer in analyzers: | |
for analyzer in info.checkers: |
@@ -682,6 +725,7 @@ def handle_list_runs(args): | |||
codechecker_version)) | |||
|
|||
print(twodim.to_str(args.output_format, header, rows)) | |||
return |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The explicit 'return' at the end of the function is unnecessary in Python.
return |
print(twodim.to_str(args.output_format, header, rows)) | ||
else: | ||
LOG.error("Unsupported output format: %s", args.output_format) | ||
return |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding return here is totally unnecessary.
return |
if hasattr(args, 'enabled_checkers') and args.enabled_checkers: | ||
enabled_checkers: Dict[str, List[str]] = {} | ||
for run in runs: | ||
info_list: List[ttypes.AnalysisInfo] = client.getAnalysisInfo( | ||
ttypes.AnalysisInfoFilter(runId=run.runId), | ||
constants.MAX_QUERY_SIZE, | ||
0) | ||
for info in info_list: | ||
analyzers = info.checkers.keys() | ||
for analyzer in analyzers: | ||
if analyzer not in enabled_checkers: | ||
enabled_checkers[analyzer] = [] | ||
|
||
checkers = info.checkers.get(analyzer, {}) | ||
for checker in checkers: | ||
if checkers[checker].enabled: | ||
enabled_checkers[analyzer].append(checker) | ||
|
||
if args.output_format == 'plaintext': | ||
for analyzer, checkers in enabled_checkers.items(): | ||
print(analyzer + ":") | ||
for checker in checkers: | ||
print(" " + checker) | ||
elif args.output_format == 'csv': | ||
separator = ';' | ||
print("Analyzer" + separator + "Checker") | ||
for analyzer, checkers in enabled_checkers.items(): | ||
for checker in checkers: | ||
print(analyzer + separator + checker) | ||
elif args.output_format == 'json': | ||
print(json.dumps(enabled_checkers, indent=4)) | ||
elif args.output_format == 'table': | ||
header = ['Analyzer', 'Checker'] | ||
rows = [ | ||
(analyzer, checker) | ||
for analyzer, checkers in enabled_checkers.items() | ||
for checker in checkers] | ||
print(twodim.to_str(args.output_format, header, rows)) | ||
else: | ||
LOG.error("Unsupported output format: %s", args.output_format) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of introducing a separate if block for enabled_checkers
handling, consider integrating it into the existing structure, similar to how 'details' is handled. This avoids redundant checks on args.output_format
.
Additionally, rather than using direct print statements for plaintext and CSV formats, it would be better to use twodim.to_str()
for consistency with the existing output formatting.
This PR implements the feature requested in issue #4355