-
Bug
-
Resolution: Not A Defect
-
Minor
-
None
I would like to know if and how it is possible to parse the output of npm-groovy-lint.
I call it like this
npm-groovy-lint -o lint.json
and and in my jenkinsfile I tried the following two things:
recordIssues(tools: [issues(pattern: 'linter.json')])
and
recordIssues(tools: [groovyScript(parserId: 'pep8-groovy', pattern: 'linter.json')])
The build succeeds but the warnings aren't displayed. This is (a part) of the linter.json file
{ "summary": { "totalFilesWithErrorsNumber": 6, "totalFilesLinted": 6, "totalFoundErrorNumber": 6, "totalFoundWarningNumber": 37, "totalFoundInfoNumber": 91, "totalFoundNumber": 134, "totalFixedNumber": 0, "totalRemainingNumber": 134, "totalFixedErrorNumber": 0, "totalFixedWarningNumber": 0, "totalFixedInfoNumber": 0, "totalRemainingErrorNumber": 6, "totalRemainingWarningNumber": 37, "totalRemainingInfoNumber": 91, "detectedRules": { "LineLength": 2, "ConsecutiveBlankLines": 1, "CompileStatic": 6, "Indentation": 21, "DuplicateStringLiteral": 6, "UnusedVariable": 2, "ClassJavadoc": 4, "MethodCount": 1, "PublicInstanceField": 1, "UnusedMethodParameter": 3, "UnnecessaryToString": 6, "VariableName": 5, "Instanceof": 1, "CatchException": 1, "EmptyIfStatement": 1, "UnusedImport": 4, "UnnecessaryGroovyImport": 3, "ImportFromSamePackage": 2, "ParameterReassignment": 1, "UnnecessaryCallForLastElement": 1, "NoDef": 1, "VariableTypeRequired": 3, "SpaceAfterMethodCallName": 1, "ImplicitClosureParameter": 1, "CouldBeSwitchStatement": 1, "JavaIoPackageAccess": 7, "IfStatementBraces": 2, "ElseBlockBraces": 1, "StaticMethodsBeforeInstanceMethods": 4, "ThrowException": 7, "UnnecessaryElseStatement": 2, "UnnecessaryGetter": 21, "UnusedPrivateField": 4, "UnnecessaryConstructor": 1, "EmptyMethod": 1, "PrivateFieldCouldBeFinal": 2, "ImplicitReturnStatement": 1, "FactoryMethodName": 1, "DuplicateNumberLiteral": 1 }, "fixedRules": {} }, "linesNumber": 61, "files": { "<BASE-PATH>/Jenkinsfile": { "errors": [ { "id": 0, "line": 3, "rule": "ConsecutiveBlankLines", "severity": "info", "msg": "File Jenkinsfile has consecutive blank lines", "fixable": true, "fixLabel": "Remove consecutive blank lines" }, { "id": 1, "line": 5, "rule": "CompileStatic", "severity": "info", "msg": "Class should be marked with one of @GrailsCompileStatic, @CompileStatic or @CompileDynamic" }, { "id": 2, "line": 8, "rule": "Indentation", "severity": "info", "msg": "The statement on line 8 in class None is at the incorrect indent level: Expected one of columns [5, 9, 13] but was 3", "fixable": true, "fixLabel": "Correct Indentation" } ] // ...and so on } }