Skip to content

Commit 601304c

Browse files
committed
Fix path replacement
Previously we were searching for all instances of "/code" to an empty string for reporting back to Code Climate. This was resulting in any file that had a nested directory called "code" to be replaced which created issues with display. Change the replacement of "/code" to a regular expression that anchors the pattern so that we only replace the first instance.
1 parent 7790bb7 commit 601304c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

engine.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
'description' => $phpcs_issue_data['message'],
4343
'categories' => array('Style'),
4444
'location' => array(
45-
'path' => str_replace('/code/', '', $phpcs_file),
45+
'path' => preg_replace('/^\/code\//', '', $phpcs_file),
4646
'lines' => array(
4747
'begin' => $phpcs_issue_data['line'],
4848
'end' => $phpcs_issue_data['line']

0 commit comments

Comments
 (0)