From a822dd526b0594990d3312fd4bce006736611dd6 Mon Sep 17 00:00:00 2001 From: Daniel van der Ploeg Date: Wed, 10 Sep 2025 11:26:05 +0930 Subject: [PATCH] fix: regex issue --- pipe/pipe.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/pipe/pipe.py b/pipe/pipe.py index 63fc014..05f0513 100644 --- a/pipe/pipe.py +++ b/pipe/pipe.py @@ -144,7 +144,7 @@ def filter_paths(path): stderr=subprocess.PIPE, universal_newlines=True) self.standards_failure = False if phpcs.returncode == 0 else True - phpcs_output = phpcs.stdout + phpcs_output = phpcs.stdout.strip() if phpcs_output: with open("test-results/phpcs.xml", 'a') as output_file: @@ -173,13 +173,17 @@ def read_failures_from_file(file): # Covert paths to relative equivalent workspace_path = "/opt/atlassian/pipelines/agent/build/" path = suite.name.replace(workspace_path, '') + + # Extract line number from name if present + # Example: /some/path/to/file (10:11) + line_match = re.search(r"\((\d*):.*\)", case.name) + line = line_match.group(1) if line_match else "1" + results.append({ "path": path, "title": case.name, "summary": result.message, - # Extract line number from name - # Example: /some/path/to/file (10:11) - "line": re.search("\((\d*):.*\)", case.name).group(1) + "line": line }) return results