Allow prefix on problem matcher
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 5.9k
- Forks
- 1.8k
- PR merge metrics
- No merged PRs in 30d
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
}
]
}
]
}
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
No files or tests are named in the issue. Start by locating the problem matcher configuration parsing and file-path resolution entry points in the toolkit, then trace how relative paths are converted into annotations. Done means a configured prefix is applied to matched file paths, including working-directory and subdirectory cases, with tests covering the examples in this issue.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- ci-cd, tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100