-
Notifications
You must be signed in to change notification settings - Fork 964
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
problem matcher default severity #203
Conversation
d0654e8
to
d742cca
Compare
@@ -256,6 +276,9 @@ public sealed class IssueMatcherConfig | |||
[DataMember(Name = "owner")] | |||
private string _owner; | |||
|
|||
[DataMember(Name = "severity")] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is the config class the json is deserialized into
@@ -169,7 +184,7 @@ public IssuePattern(IssuePatternConfig config, TimeSpan timeout) | |||
|
|||
public sealed class IssueMatch | |||
{ | |||
public IssueMatch(IssueMatch runningMatch, IssuePattern pattern, GroupCollection groups) | |||
public IssueMatch(IssueMatch runningMatch, IssuePattern pattern, GroupCollection groups, string defaultSeverity = null) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This class is used at runtime when a match is found.
This ctor extracts the properties from the regex match groups, and stores them in first class properties on this class.
@@ -178,6 +193,11 @@ public IssueMatch(IssueMatch runningMatch, IssuePattern pattern, GroupCollection | |||
Code = runningMatch?.Code ?? GetValue(groups, pattern.Code); | |||
Message = runningMatch?.Message ?? GetValue(groups, pattern.Message); | |||
FromPath = runningMatch?.FromPath ?? GetValue(groups, pattern.FromPath); | |||
|
|||
if (string.IsNullOrEmpty(Severity) && !string.IsNullOrEmpty(defaultSeverity)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If a default severity is defined, here is where it's applied.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Clean 🥇 , minor thoughts
Problem matchers are unable to interpret severity strings other than
warning
anderror
. Theseverity
match group expectswarning
orerror
(case insensitive).However some tools indicate warning or error using codes such as W123 or E456.
To support non-standard severity strings, a problem matcher may now define a default severity (e.g. warning instead of error). This enables non-standard severity strings, by registering two problems matchers (one for warning, one for error).