Skip to content

Commit

Permalink
ci: use problem matchers to tag lint warnings & errors
Browse files Browse the repository at this point in the history
  • Loading branch information
benoit-pierre committed Jul 27, 2024
1 parent 9611d92 commit 5521d18
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 3 deletions.
58 changes: 58 additions & 0 deletions .github/problem-matchers.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
{
"problemMatcher": [
{
"owner": "clang-tidy",
"pattern": [
{
"regexp": "^(?:\\x1b\\[[0-9;]+m)*(.+):(\\d+):(\\d+):\\s+(?:\\x1b\\[[0-9;]+m)*(warning|error):\\s+(?:\\x1b\\[[0-9;]+m)*(.*)\\s+\\[(.+)\\](?:\\x1b\\[[0-9;]+m)*$",
"file": 1,
"line": 2,
"column": 3,
"severity": 4,
"message": 5,
"code": 6
}
]
},
{
"owner": "cppcheck",
"pattern": [
{
"regexp": "^(?:\\x1b\\[[0-9;]+m)*(.+):([0-9;]+):(\\d+):\\s+(?:\\x1b\\[[0-9;]+m)*(warning|error):(?:\\x1b\\[[0-9;]+m)*\\s+(.+)\\s+\\[(.+)\\](?:\\x1b\\[[0-9;]+m)*$",
"file": 1,
"line": 2,
"column": 3,
"severity": 4,
"message": 5,
"code": 6
}
]
},
{
"owner": "stylelint",
"pattern": [
{
"regexp": "^(.+):(\\d+):(\\d+):\\s+(.+)\\s+\\((.+)\\)\\s+\\[(error)\\]$",
"file": 1,
"line": 2,
"column": 3,
"message": 4,
"code": 5,
"severity": 6
}
]
},
{
"owner": "xmllint",
"pattern": [
{
"regexp": "^(.+):(\\d+):\\s+parser (error)\\s+:\\s+(.+)$",
"file": 1,
"line": 2,
"severity": 3,
"message": 4
}
]
}
]
}
8 changes: 8 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,5 +55,13 @@ jobs:
npm init --yes
npm install stylelint stylelint-config-standard
- name: Setup problem matchers
run: |
set -x
echo '::remove-matcher owner=eslint-compact::'
echo '::remove-matcher owner=eslint-stylish::'
echo '::remove-matcher owner=tsc::'
echo '::add-matcher::.github/problem-matchers.json'
- name: Lint
run: ./utils/lint.sh 2>&1
4 changes: 1 addition & 3 deletions utils/lint.mk
Original file line number Diff line number Diff line change
Expand Up @@ -152,17 +152,15 @@ endef
ifneq (,$(GITHUB_ACTIONS))
ci_startgroup := printf '::group::'
ci_endgroup := printf '::endgroup::\n'
ci_error = printf '%b\n::error::%s\n%b\n' '$(ANSI_RESET)' $1 '$(ANSI_RESET)'
ci_time := time
else
ci_startgroup := :
ci_endgroup := :
ci_error := :
ci_time =
endif

define warn_on_error
if [ $1 -ne 0 ]; then $(call $(if $(GITHUB_ACTIONS),ci_error,trace_warn),$2); fi
if [ $1 -ne 0 ]; then $(call trace_warn,$2); fi
endef

# `$(call lint_rule,prefix,file,command)`
Expand Down

0 comments on commit 5521d18

Please sign in to comment.