-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Description
Describe the enhancement
When using Problem Matcher, regex must match the exact path of the file to annotate. But in some case this isn't possible.
For example, if using the working-directory in the step for a linting tool, most of the time, the output will result into the working directory being cropped out of the output.
Without working-directory
src/
test.lua
And output of the linting tool would be:
src/test.lua: An error occured
With the following problem matcher configuration:
{
"problemMatcher": [
{
"owner": "test",
"pattern": [
{
"regexp": "^(.*): (.*)$",
"file": 1,
"message": 2
}
]
}
]
}The annotation will be generated correctly as problem matcher will search for src/test.lua.
With working-directory = src/
src/
test.lua
And output of the linting tool would be:
test.lua: An error occured
With the same problem matcher configuration as above, the annotation will not be generated correctly as problem matcher will search for test.lua (which doesn't exist, as it's missing the src/ prefix).
The same issue occurs in many case (not just with working-directory), for example with tools such as terragrunt which support being run in sub-directories.
It would be super useful to have a filePrefix (or anything like that) option in problem matcher config to specify the root dir.
Code Snippet
{
"problemMatcher": [
{
"owner": "test",
"pattern": [
{
"regexp": "^(.*): (.*)$",
"filePrefix": "src/",
"file": 1,
"message": 2
}
]
}
]
}