Skip to content
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

Merged
merged 4 commits into from
Nov 22, 2019
Merged

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).

@@ -256,6 +276,9 @@ public sealed class IssueMatcherConfig
[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

@@ -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)
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.

@@ -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))
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