Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Support "severity" in ProblemMatcher (next to ProblemPattern) #204

Closed
TrueBrain opened this issue Nov 7, 2019 · 12 comments
Closed

Support "severity" in ProblemMatcher (next to ProblemPattern) #204

TrueBrain opened this issue Nov 7, 2019 · 12 comments
Assignees
Labels
enhancement New feature or request

Comments

@TrueBrain
Copy link

TrueBrain commented Nov 7, 2019

Currently the Problem Matcher only support "severity" as group in the ProblemPattern (see #186 (comment)); VSCode also supports this as fixed field in the ProblemMatcher (see https://code.visualstudio.com/docs/editor/tasks-appendix).

It would be a nice addition to see the same functionality in GitHub Actions; this would mean Problem Matcher works the same in VSCode as in GitHub Actions.

A use case: 'flake8' returns codes like E100, W200, F300. E stands for error, W for warning, F for fatal. Have the warnings as warnings (and errors and fatals as errors) is currently not supported with the current implementation of Problem Matcher.

The current workaround is one ugly sed. For example:
https://github.com/TrueBrain/actions-flake8/blob/initial_work/entrypoint.sh#L13

Solving this would greatly reduce the complexity of such actions (in fact, it would make it trivial).

@TrueBrain TrueBrain added the enhancement New feature or request label Nov 7, 2019
@ericsciple
Copy link
Contributor

@TrueBrain severity is supported. The docs were merged recently: https://github.com/actions/toolkit/blob/master/docs/problem-matchers.md

@ericsciple
Copy link
Contributor

Although the translation problem still exists. Only the string "warning" and "error" are supported. Interested in ideas.

@TrueBrain
Copy link
Author

Exactly why I created this ticket ;)

I do want to put emphasis on the fact that this problem is already solved by VSCode. And given ProblemMatchers strongly resemble the one used by VSCode, solving them both in the same way would be greatly appreciated :)

This I tried to make clear in my original ticket: there is a difference between ProblemMatcher and ProblemPattern. VSCode implements both, GitHub Actions currently only the latter (in context of severity, of course).

@ericsciple
Copy link
Contributor

@TrueBrain sorry i am not seeing it in their docs. Do you have a link to the docs how vscode solves this?

@ericsciple
Copy link
Contributor

I was thinking something like two new properties "errorPattern": "^[EF]" and "warningPattern": "^W"

@ericsciple
Copy link
Contributor

nevermind i think i see how they solved it. They have it higher up in the structure, above the patterns...

@ericsciple
Copy link
Contributor

Basically sibling to owner. In that case i think you would need to define the matcher twice, once for errors. And then again as a separate owner, for warnings.

@ericsciple ericsciple self-assigned this Nov 14, 2019
@ericsciple
Copy link
Contributor

It's supported by the current runner in PROD now.

@ericsciple
Copy link
Contributor

@zsedem
Copy link

zsedem commented May 21, 2020

@ericsciple I do not understand how this documenation change above describes how is this supported.

@ericsciple
Copy link
Contributor

@zsedem sibling to owner you can set severity to indicate the default severity.

So for the flake8 scenario, you would create two matchers. For example:

{
  "problemMatcher": [
    {
      "owner": "flake8_error",
      "severity": "error",
      "pattern": [
        {
          "regexp": "^[EF][0-9]+ ...",
        }
      ]
    },
    {
      "owner": "flake8_warning",
      "severity": "warning",
      "pattern": [
        {
          "regexp": "^W[0-9]+ ...",
        }
      ]
    }
  ]
}

Let me know if that helps

@zsedem
Copy link

zsedem commented May 21, 2020

yes, that answers my question
thank you

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants