mirror of
https://github.com/actions/setup-java.git
synced 2025-05-21 18:01:46 +00:00
Add problem matcher for Checkstyle
This commit adds a problem matcher for Checkstyle to allow automatic GitHub annotations. When run through Gradle, an example line is: ``` [ant:checkstyle] [ERROR] /root/Bound.java:7:2: 'import' has incorrect indentation level 1, expected level should be 0. [Indentation] ``` Alternatively, when run standalone, an example output is: ``` [WARN] /root/test.java:2:1: The name of the outer type and the file do not match. [OuterTypeFilename] ``` The regular expression matches both cases. In the latter example, `WARN`, rather than `WARNING` is output. This is resolved by using a default severity of `warning`, which will be overridden in the case that the severity is `ERROR`.
This commit is contained in:
parent
ad01d131cc
commit
42dba1991e
19
.github/checkstyle.json
vendored
Normal file
19
.github/checkstyle.json
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
{
|
||||
"problemMatcher": [
|
||||
{
|
||||
"owner": "checkstyle",
|
||||
"severity": "warning",
|
||||
"pattern": [
|
||||
{
|
||||
"regexp": "^.*\\[(ERROR|WARN)\\]\\s+(.*):(\\d+):(\\d+):\\s+(.*)\\s+\\[(.*)\\]$",
|
||||
"severity": 1,
|
||||
"file": 2,
|
||||
"line": 3,
|
||||
"column": 4,
|
||||
"message": 5,
|
||||
"code": 6
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
@ -38,6 +38,7 @@ async function run() {
|
||||
|
||||
const matchersPath = path.join(__dirname, '..', '..', '.github');
|
||||
core.info(`##[add-matcher]${path.join(matchersPath, 'java.json')}`);
|
||||
core.info(`##[add-matcher]${path.join(matchersPath, 'checkstyle.json')}`);
|
||||
|
||||
await auth.configureAuthentication();
|
||||
} catch (error) {
|
||||
|
Loading…
Reference in New Issue
Block a user