diff --git a/src/static_analysis_python.py b/src/static_analysis_python.py index 0a420b9..a6f996a 100644 --- a/src/static_analysis_python.py +++ b/src/static_analysis_python.py @@ -63,7 +63,6 @@ def create_comment_for_output(tool_output, files_changed_in_pr, output_to_consol Parameters: tool_output (str): The tool output to parse. - prefix (str): The prefix to look for in order to identify issues. files_changed_in_pr (dict): A dictionary containing the files that were changed in the pull request and the lines that were modified. output_to_console (bool): Whether or not to output the results to the console. @@ -75,6 +74,8 @@ def create_comment_for_output(tool_output, files_changed_in_pr, output_to_consol list_of_issues = [] per_issue_string = "" + utils.debug_print(f"PyLint output:\n{tool_output}\n") + for line in tool_output: file_path = line["path"] file_line_start = line["line"] @@ -104,7 +105,11 @@ def create_comment_for_output(tool_output, files_changed_in_pr, output_to_consol ) new_line = utils.generate_output( - False, ("", file_path), file_line_start, file_line_end, description + False, + (utils.WORK_DIR, file_path), + file_line_start, + file_line_end, + description, ) if utils.check_for_char_limit(new_line): diff --git a/test/test_static_analysis_cpp.py b/test/test_static_analysis_cpp.py index d7fad19..d8974d8 100644 --- a/test/test_static_analysis_cpp.py +++ b/test/test_static_analysis_cpp.py @@ -4,13 +4,13 @@ import utils.helper_functions as utils try: - project_path = f"{os.sep}".join(os.path.abspath(__file__).split(os.sep)[:-2]) - sys.path.append(project_path) + PROJECT_PATH = f"{os.sep}".join(os.path.abspath(__file__).split(os.sep)[:-2]) + sys.path.append(PROJECT_PATH) except Exception as exception: print(f"Can not add project path to system path! Exiting!\nERROR: {exception}") raise SystemExit(1) from exception -os.environ["GITHUB_WORKSPACE"] = f"{project_path}/test/utils/dummy_project" +os.environ["GITHUB_WORKSPACE"] = f"{PROJECT_PATH}/test/utils/dummy_project" os.environ["INPUT_VERBOSE"] = "True" os.environ["INPUT_REPORT_PR_CHANGES_ONLY"] = "False" os.environ["INPUT_REPO"] = "RepoName" diff --git a/test/test_static_analysis_python.py b/test/test_static_analysis_python.py index 1d889b1..c1a8894 100644 --- a/test/test_static_analysis_python.py +++ b/test/test_static_analysis_python.py @@ -4,13 +4,13 @@ import sys try: - project_path = f"{os.sep}".join(os.path.abspath(__file__).split(os.sep)[:-2]) - sys.path.append(project_path) + PROJECT_PATH = f"{os.sep}".join(os.path.abspath(__file__).split(os.sep)[:-2]) + sys.path.append(PROJECT_PATH) except Exception as exception: print(f"Can not add project path to system path! Exiting!\nERROR: {exception}") raise SystemExit(1) from exception -os.environ["GITHUB_WORKSPACE"] = f"{project_path}/test/utils/dummy_project" +os.environ["GITHUB_WORKSPACE"] = f"{PROJECT_PATH}/test/utils/dummy_project" os.environ["INPUT_VERBOSE"] = "True" os.environ["INPUT_REPORT_PR_CHANGES_ONLY"] = "False" os.environ["INPUT_REPO"] = "RepoName" diff --git a/test/test_utils.py b/test/test_utils.py index 4ca91e3..adbb77c 100644 --- a/test/test_utils.py +++ b/test/test_utils.py @@ -3,8 +3,8 @@ import sys try: - project_path = f"{os.sep}".join(os.path.abspath(__file__).split(os.sep)[:-2]) - sys.path.append(project_path) + PROJECT_PATH = f"{os.sep}".join(os.path.abspath(__file__).split(os.sep)[:-2]) + sys.path.append(PROJECT_PATH) except Exception as exception: print(f"Can not add project path to system path! Exiting!\nERROR: {exception}") raise SystemExit(1) from exception