diff --git a/.pytool/Plugin/UncrustifyCheck/UncrustifyCheck.py b/.pytool/Plugin/UncrustifyCheck/UncrustifyCheck.py index 0956c34e21..337339f537 100644 --- a/.pytool/Plugin/UncrustifyCheck/UncrustifyCheck.py +++ b/.pytool/Plugin/UncrustifyCheck/UncrustifyCheck.py @@ -384,9 +384,9 @@ def _get_template_file_contents(self) -> None: file_template_path = pathlib.Path(os.path.join(self._plugin_path, file_template_name)) self._file_template_contents = file_template_path.read_text() except KeyError: - logging.warning("A file header template is not specified in the config file.") + logging.info("A file header template is not specified in the config file.") except FileNotFoundError: - logging.warning("The specified file header template file was not found.") + logging.info("The specified file header template file was not found.") try: func_template_name = parser["dummy_section"]["cmt_insert_func_header"] @@ -396,9 +396,9 @@ def _get_template_file_contents(self) -> None: func_template_path = pathlib.Path(os.path.join(self._plugin_path, func_template_name)) self._func_template_contents = func_template_path.read_text() except KeyError: - logging.warning("A function header template is not specified in the config file.") + logging.info("A function header template is not specified in the config file.") except FileNotFoundError: - logging.warning("The specified function header template file was not found.") + logging.info("The specified function header template file was not found.") def _initialize_app_info(self) -> None: """ @@ -574,14 +574,12 @@ def _process_uncrustify_results(self) -> None: self._formatted_file_error_count = len(formatted_files) if self._formatted_file_error_count > 0: - logging.warning(f'Uncrustify found {self._formatted_file_error_count} files with formatting errors') + logging.error(f'Uncrustify found {self._formatted_file_error_count} files with formatting errors\n') self._tc.LogStdError(f"Uncrustify found {self._formatted_file_error_count} files with formatting errors:\n") - logging.critical( + logging.warning( "Visit the following instructions to learn " - "how to find the detailed formatting errors in Azure " - "DevOps CI: " - "https://github.com/tianocore/tianocore.github.io/wiki/EDK-II-Code-Formatting#how-to-find-uncrustify-formatting-errors-in-continuous-integration-ci") - + "more about uncrustify setup instructions and CI:" + "https://github.com/tianocore/tianocore.github.io/wiki/EDK-II-Code-Formatting\n") if self._output_file_diffs: logging.info("Calculating file diffs. This might take a while...") @@ -589,8 +587,8 @@ def _process_uncrustify_results(self) -> None: for formatted_file in formatted_files: pre_formatted_file = formatted_file[:-len(UncrustifyCheck.FORMATTED_FILE_EXTENSION)] + logging.error(f"Formatting errors in {os.path.relpath(pre_formatted_file, self._abs_package_path)}") self._tc.LogStdError(f"Formatting errors in {os.path.relpath(pre_formatted_file, self._abs_package_path)}\n") - logging.info(f"Formatting errors in {os.path.relpath(pre_formatted_file, self._abs_package_path)}") if (self._output_file_diffs or self._file_template_contents is not None or @@ -601,10 +599,12 @@ def _process_uncrustify_results(self) -> None: if (self._file_template_contents is not None and self._file_template_contents in formatted_file_text): + logging.info(f"File header is missing in {os.path.relpath(pre_formatted_file, self._abs_package_path)}") self._tc.LogStdError(f"File header is missing in {os.path.relpath(pre_formatted_file, self._abs_package_path)}\n") if (self._func_template_contents is not None and self._func_template_contents in formatted_file_text): + logging.info(f"A function header is missing in {os.path.relpath(pre_formatted_file, self._abs_package_path)}") self._tc.LogStdError(f"A function header is missing in {os.path.relpath(pre_formatted_file, self._abs_package_path)}\n") if self._output_file_diffs: @@ -612,8 +612,10 @@ def _process_uncrustify_results(self) -> None: pre_formatted_file_text = pf.read() for line in difflib.unified_diff(pre_formatted_file_text.split('\n'), formatted_file_text.split('\n'), fromfile=pre_formatted_file, tofile=formatted_file, n=3): + logging.error(line) self._tc.LogStdError(line) + logging.error('\n') self._tc.LogStdError('\n') def _remove_tree(self, dir_path: str, ignore_errors: bool = False) -> None: