diff --git a/analyzer/codechecker_analyzer/analyzer.py b/analyzer/codechecker_analyzer/analyzer.py index 878f10be29..9b83037315 100644 --- a/analyzer/codechecker_analyzer/analyzer.py +++ b/analyzer/codechecker_analyzer/analyzer.py @@ -355,7 +355,8 @@ def perform_analysis(args, skip_handlers, rs_handler: ReviewStatusHandler, end_time = time.time() LOG.info("Analysis length: %s sec.", end_time - start_time) - analyzer_types.print_unsupported_analyzers(errored) + if args.analyzers: + analyzer_types.print_unsupported_analyzers(errored) metadata_tool['timestamps'] = {'begin': start_time, 'end': end_time} diff --git a/analyzer/codechecker_analyzer/analyzers/analyzer_types.py b/analyzer/codechecker_analyzer/analyzers/analyzer_types.py index a8bbfc93a3..130288c728 100644 --- a/analyzer/codechecker_analyzer/analyzers/analyzer_types.py +++ b/analyzer/codechecker_analyzer/analyzers/analyzer_types.py @@ -115,7 +115,7 @@ def is_ignore_conflict_supported(): def print_unsupported_analyzers(errored): """ Print error messages which occured during analyzer detection. """ for analyzer_binary, reason in errored: - LOG.warning("Analyzer '%s' is enabled but CodeChecker is failed to " + LOG.warning("Analyzer '%s' is enabled but CodeChecker failed to " "execute analysis with it: '%s'. Please check your " "'PATH' environment variable and the " "'config/package_layout.json' file!", diff --git a/analyzer/codechecker_analyzer/analyzers/clangtidy/analyzer.py b/analyzer/codechecker_analyzer/analyzers/clangtidy/analyzer.py index e6ebac9d25..a6a6e17da6 100644 --- a/analyzer/codechecker_analyzer/analyzers/clangtidy/analyzer.py +++ b/analyzer/codechecker_analyzer/analyzers/clangtidy/analyzer.py @@ -237,11 +237,11 @@ def analyzer_binary(cls): @classmethod def get_binary_version(cls, details=False) -> str: + if not cls.analyzer_binary(): + return None # No need to LOG here, we will emit a warning later anyway. environ = analyzer_context.get_context().get_env_for_bin( cls.analyzer_binary()) - if not cls.analyzer_binary(): - return None version = [cls.analyzer_binary(), '--version'] try: diff --git a/analyzer/codechecker_analyzer/analyzers/cppcheck/analyzer.py b/analyzer/codechecker_analyzer/analyzers/cppcheck/analyzer.py index 12db634ef9..efd4c2eef9 100644 --- a/analyzer/codechecker_analyzer/analyzers/cppcheck/analyzer.py +++ b/analyzer/codechecker_analyzer/analyzers/cppcheck/analyzer.py @@ -85,10 +85,10 @@ def analyzer_binary(cls): def get_binary_version(cls, details=False) -> str: """ Get analyzer version information. """ # No need to LOG here, we will emit a warning later anyway. - environ = analyzer_context.get_context().get_env_for_bin( - cls.analyzer_binary()) if not cls.analyzer_binary(): return None + environ = analyzer_context.get_context().get_env_for_bin( + cls.analyzer_binary()) version = [cls.analyzer_binary(), '--version'] try: output = subprocess.check_output(version, diff --git a/analyzer/codechecker_analyzer/analyzers/gcc/analyzer.py b/analyzer/codechecker_analyzer/analyzers/gcc/analyzer.py index 6ed3b15352..505194353f 100644 --- a/analyzer/codechecker_analyzer/analyzers/gcc/analyzer.py +++ b/analyzer/codechecker_analyzer/analyzers/gcc/analyzer.py @@ -153,11 +153,11 @@ def get_binary_version(cls, details=False) -> str: """ Return the analyzer version. """ - environ = analyzer_context.get_context().get_env_for_bin( - cls.analyzer_binary()) # No need to LOG here, we will emit a warning later anyway. if not cls.analyzer_binary(): return None + environ = analyzer_context.get_context().get_env_for_bin( + cls.analyzer_binary()) if details: version = [cls.analyzer_binary(), '--version'] else: diff --git a/analyzer/codechecker_analyzer/cmd/checkers.py b/analyzer/codechecker_analyzer/cmd/checkers.py index 0ca603e48b..c567870497 100644 --- a/analyzer/codechecker_analyzer/cmd/checkers.py +++ b/analyzer/codechecker_analyzer/cmd/checkers.py @@ -555,7 +555,10 @@ def __print_checker_config(args: argparse.Namespace): if rows: print(twodim.to_str(args.output_format, header, rows)) - analyzer_types.print_unsupported_analyzers(errored) + # Don't print this warning unless the analyzer list is + # given by the user. + if args.analyzers: + analyzer_types.print_unsupported_analyzers(errored) if analyzer_failures: LOG.error("Failed to get checker configuration options for '%s' "