Skip to content

Commit a822dd5

Browse files
committed
fix: regex issue
1 parent d5ab5ef commit a822dd5

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

pipe/pipe.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ def filter_paths(path):
144144
stderr=subprocess.PIPE, universal_newlines=True)
145145
self.standards_failure = False if phpcs.returncode == 0 else True
146146

147-
phpcs_output = phpcs.stdout
147+
phpcs_output = phpcs.stdout.strip()
148148

149149
if phpcs_output:
150150
with open("test-results/phpcs.xml", 'a') as output_file:
@@ -173,13 +173,17 @@ def read_failures_from_file(file):
173173
# Covert paths to relative equivalent
174174
workspace_path = "/opt/atlassian/pipelines/agent/build/"
175175
path = suite.name.replace(workspace_path, '')
176+
177+
# Extract line number from name if present
178+
# Example: /some/path/to/file (10:11)
179+
line_match = re.search(r"\((\d*):.*\)", case.name)
180+
line = line_match.group(1) if line_match else "1"
181+
176182
results.append({
177183
"path": path,
178184
"title": case.name,
179185
"summary": result.message,
180-
# Extract line number from name
181-
# Example: /some/path/to/file (10:11)
182-
"line": re.search("\((\d*):.*\)", case.name).group(1)
186+
"line": line
183187
})
184188

185189
return results

0 commit comments

Comments
 (0)