Skip to content

Commit 2a89ac8

Browse files
authored
Merge pull request #229 from mhucka/mh-problem-matchers
Add problem matchers
2 parents b12d753 + b9bd3cc commit 2a89ac8

File tree

5 files changed

+76
-0
lines changed

5 files changed

+76
-0
lines changed

.github/problem-matchers/README.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Problem Matchers
2+
3+
GitHub [Problem
4+
Matchers](https://github.com/actions/toolkit/blob/main/docs/problem-matchers.md)
5+
are a mechanism that enable workflow steps to scan the outputs of GitHub
6+
Actions for regex patterns and automatically write annotations in the workflow
7+
summary page. Using Problem Matchers allows information to be displayed more
8+
prominently in the GitHub user interface.
9+
10+
This directory contains Problem Matchers used by the GitHub Actions workflows
11+
in the [`workflows`](./workflows) subdirectory.
12+
13+
The following problem matcher JSON file for Pylint was copied from the [Home
14+
Assistant](https://github.com/home-assistant/core) project on GitHub. The Home
15+
Assistant project is licensed under the Apache 2.0 open-source license. The
16+
versions of the file at the time it was copied was 2025.1.2.
17+
18+
- [`pylint.json`](https://github.com/home-assistant/core/blob/dev/.github/workflows/matchers/pylint.json)
19+
20+
The following problem matcher for Black came from a fork of the
21+
[MLflow](https://github.com/mlflow/mlflow) project by user Sumanth077 on
22+
GitHub. The MLflow project is licensed under the Apache 2.0 open-source
23+
license. The version of the file copied was dated 2022-05-29.
24+
25+
- [`black.json`](https://github.com/Sumanth077/mlflow/blob/problem-matcher-for-black/.github/workflows/matchers/black.json)
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"problemMatcher": [
3+
{
4+
"owner": "black",
5+
"severity": "error",
6+
"pattern": [
7+
{
8+
"regexp": "^(would reformat) (.+)$",
9+
"file": 2,
10+
"message": 1
11+
}
12+
]
13+
}
14+
]
15+
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
{
2+
"problemMatcher": [
3+
{
4+
"owner": "pylint-error",
5+
"severity": "error",
6+
"pattern": [
7+
{
8+
"regexp": "^(.+):(\\d+):(\\d+):\\s(([EF]\\d{4}):\\s.+)$",
9+
"file": 1,
10+
"line": 2,
11+
"column": 3,
12+
"message": 4,
13+
"code": 5
14+
}
15+
]
16+
},
17+
{
18+
"owner": "pylint-warning",
19+
"severity": "warning",
20+
"pattern": [
21+
{
22+
"regexp": "^(.+):(\\d+):(\\d+):\\s(([CRW]\\d{4}):\\s.+)$",
23+
"file": 1,
24+
"line": 2,
25+
"column": 3,
26+
"message": 4,
27+
"code": 5
28+
}
29+
]
30+
}
31+
]
32+
}

.github/workflows/black.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ jobs:
1212
timeout-minutes: 10
1313
steps:
1414
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
15+
- name: Set up problem matcher for Black output
16+
run: echo '::add-matcher::.github/problem-matchers/black.json'
1517
- uses: psf/black@8a737e727ac5ab2f1d4cf5876720ed276dc8dc4b # stable
1618
with:
1719
src: "./unitary"

.github/workflows/pylint.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,7 @@ jobs:
1919
run: |
2020
python -m pip install --upgrade pip
2121
pip install pylint
22+
- name: Set up problem matcher for Pylint output
23+
run: echo '::add-matcher::.github/problem-matchers/pylint.json'
2224
- name: Pylint check
2325
run: dev_tools/pylint

0 commit comments

Comments
 (0)