I am trying to commit my changes to a Jenkinsfile but I am getting the following info statement:
1 info Class should be marked with one of @GrailsCompileStatic, @CompileStatic or @CompileDynamic CompileStatic
I have tried marking my pipeline:
import groovy.transform.CompileStatic
@CompileStatic
pipeline {
...
}
but this gives me an error:
4 error Unexpected input: '{' @ line 4, column 10. NglParseError
Is there any way to get rid of this info statement without adding a statement that prevents failing on info to my pre-commit hook?
pre commit hook:
- repo: https://github.com/nvuillam/npm-groovy-lint
rev: v14.6.0
hooks:
- id: npm-groovy-lint
args: [--fix]
files: '(Jenkinsfile|.*\.jenkins)$'
Class should be marked with one of @GrailsCompileStatic, @CompileStatic or @CompileDynamic CompileStatic
This is a false positive return from npm-groovy-lint
for Jenkinsfile
. It is also at an info
level, and therefore can be safely ignored. It also should be ignored since resolving it throws an Exception
, which is much worse than a false positive info
issue.
Is there any way to get rid of this info statement without adding a statement that prevents failing on info to my pre-commit hook?
Basically with -l warning
, but that would probably cause other undesirable effects.
Side note: if your pre-commit hook already uses the --fix
flag, then you may also want to utilize the --format
flag as well.