feat(problem-matchers): Add warnings to problem matchers #288
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This PR enables warning annotations as an alternative to errors. If the severity is not specified in the problem matcher, it defaults to
error
. Only values accepted for severity iserror
andwarning
case-insenitive, but unfortunatelycfn-lint
does not output any of those. It only produces a single letter for the type of the problem. Therefore, we can't directly use the matched group in the severity field. After some digging around, I've found that we can specify the severity field in the same level as owner. We can specify two owners, one for warnings and informational and one for errors.I also took the liberty of including the error code in the message to make it more convenient to search the issue in cfn-lint rules. I can revert it back if you'd like. With these changes the message displayed in the annotations will change from
Parameter EnvName is missing required property Type
to
E2001 Parameter EnvName is missing required property Type
For some reason
code
field does not get displayed in the annotation message even if it gets matched properly. I have the same issue witheslint
and could not find any open issues about that.Other Information
I'm not a regex guru, there is probably much better way to do it but this is what I came up with: https://regex101.com/r/Qo5sGX/1 It creates an additional group from the whole text in addition to previous groups
Relevant docs:
https://github.com/actions/runner/blob/main/docs/adrs/0276-problem-matchers.md#supported-severity-levels
https://github.com/actions/toolkit/blob/main/docs/problem-matchers.md#single-line-matchers