Skip to content

Commit

Permalink
Merge pull request Ericsson#4407 from noraz31/show_avail_checker_conf
Browse files Browse the repository at this point in the history
[fix] Show available checker configs in all cases
  • Loading branch information
bruntib authored Dec 17, 2024
2 parents 39a1a60 + 99b31fc commit a5fc851
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
16 changes: 9 additions & 7 deletions analyzer/codechecker_analyzer/analyzers/analyzer_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ def print_unsupported_analyzers(errored):
analyzer_binary, reason)


def check_available_analyzers(args_analyzers=None):
def check_available_analyzers(args_analyzers=None, exit_on_error=True):
"""
Handle use case when no analyzer can be found or a supported, explicitly
given analyzer cannot be found on the user machine.
Expand All @@ -135,17 +135,19 @@ def check_available_analyzers(args_analyzers=None):
analyzers, errored = check_supported_analyzers(args_analyzers)
if errored:
print_unsupported_analyzers(errored)
LOG.error("Failed to run command because the given analyzer(s) "
"cannot be found on your machine!")
sys.exit(1)
if exit_on_error:
LOG.error("Failed to run command because the given analyzer(s)"
" cannot be found on your machine!")
sys.exit(1)

else:
analyzers, errored = check_supported_analyzers(supported_analyzers)
if not analyzers:
print_unsupported_analyzers(errored)
LOG.error("Failed to run command because no analyzers can be "
"found on your machine!")
sys.exit(1)
if exit_on_error:
LOG.error("Failed to run command because no analyzers can be "
"found on your machine!")
sys.exit(1)
return analyzers, errored


Expand Down
3 changes: 2 additions & 1 deletion analyzer/codechecker_analyzer/cmd/checkers.py
Original file line number Diff line number Diff line change
Expand Up @@ -523,7 +523,8 @@ def __print_checker_config(args: argparse.Namespace):
args.output_format = 'rows'

working_analyzers, errored = \
analyzer_types.check_available_analyzers(args.analyzers)
analyzer_types.check_available_analyzers(args_analyzers=args.analyzers,
exit_on_error=False)

if 'details' in args:
header = ['Option', 'Description']
Expand Down

0 comments on commit a5fc851

Please sign in to comment.