Skip to content

problem matcher default severity#203

Merged
ericsciple merged 4 commits intomasterfrom
users/ericsciple/m162issue
Nov 22, 2019
Merged

problem matcher default severity#203
ericsciple merged 4 commits intomasterfrom
users/ericsciple/m162issue

Conversation

@ericsciple
Copy link
Collaborator

@ericsciple ericsciple commented Nov 21, 2019

Problem matchers are unable to interpret severity strings other than warning and error. The severity match group expects warning or error (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).

[DataMember(Name = "owner")]
private string _owner;

[DataMember(Name = "severity")]
Copy link
Collaborator Author

@ericsciple ericsciple Nov 21, 2019

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

public sealed class IssueMatch
{
public IssueMatch(IssueMatch runningMatch, IssuePattern pattern, GroupCollection groups)
public IssueMatch(IssueMatch runningMatch, IssuePattern pattern, GroupCollection groups, string defaultSeverity = null)
Copy link
Collaborator Author

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.

Message = runningMatch?.Message ?? GetValue(groups, pattern.Message);
FromPath = runningMatch?.FromPath ?? GetValue(groups, pattern.FromPath);

if (string.IsNullOrEmpty(Severity) && !string.IsNullOrEmpty(defaultSeverity))
Copy link
Collaborator Author

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.

Copy link
Collaborator

@thboop thboop left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clean 🥇 , minor thoughts

@ericsciple ericsciple merged commit 7d505f7 into master Nov 22, 2019
@ericsciple ericsciple deleted the users/ericsciple/m162issue branch November 22, 2019 18:22
AdamOlech pushed a commit to antmicro/runner that referenced this pull request Jan 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants