From fcf33e4cd1757da9be4707712762488ddc5050b1 Mon Sep 17 00:00:00 2001 From: Ulli Hafner Date: Fri, 26 Apr 2019 15:37:17 +0200 Subject: [PATCH] Added Cargo and Cmake tools. --- CHANGELOG.md | 4 + SUPPORTED-FORMATS.md | 182 +++++++++--------- .../plugins/analysis/warnings/Cargo.java | 54 ++++++ .../plugins/analysis/warnings/Cmake.java | 48 +++++ .../plugins/analysis/warnings/Doxygen.java | 5 - .../plugins/analysis/warnings/DrMemory.java | 5 - .../plugins/analysis/warnings/GhsMulti.java | 5 - .../plugins/analysis/warnings/GnuFortran.java | 5 - .../plugins/analysis/warnings/NagFortran.java | 5 - .../analysis/warnings/YuiCompressor.java | 5 - .../analysis/warnings/Messages.properties | 6 +- .../analysis/warnings/ParsersITest.java | 12 ++ .../plugins/analysis/warnings/CargoCheck.json | 4 + .../plugins/analysis/warnings/cmake.txt | 22 +++ 14 files changed, 238 insertions(+), 124 deletions(-) create mode 100644 src/main/java/io/jenkins/plugins/analysis/warnings/Cargo.java create mode 100644 src/main/java/io/jenkins/plugins/analysis/warnings/Cmake.java create mode 100644 src/test/resources/io/jenkins/plugins/analysis/warnings/CargoCheck.json create mode 100644 src/test/resources/io/jenkins/plugins/analysis/warnings/cmake.txt diff --git a/CHANGELOG.md b/CHANGELOG.md index e238029007..10f7fe1cec 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,10 @@ Additional new features: Support for [IBLinter](https://github.com/IBDecodable/IBLinter) - Xcode Storyboard Linter - [PR#21](https://github.com/jenkinsci/warnings-ng-plugin/pull/21): Support for [PHPStan](https://github.com/phpstan/phpstan) - PHP Static Analysis Tool +- [PR#132](https://github.com/jenkinsci/analysis-model/pull/132): +Added a parser for CMake warnings. +- [PR#137](https://github.com/jenkinsci/analysis-model/pull/137): +Added a parser for JSON output from Cargo. ### Fixed diff --git a/SUPPORTED-FORMATS.md b/SUPPORTED-FORMATS.md index 1cdf62f510..8ee7d60af1 100644 --- a/SUPPORTED-FORMATS.md +++ b/SUPPORTED-FORMATS.md @@ -1,4 +1,4 @@ - + # Supported Report Formats Jenkins' Warnings Next Generation Plugin supports the following report formats. @@ -22,92 +22,94 @@ the [Analysis Parsers Library](https://github.com/jenkinsci/analysis-model/). | 6 | axivion-suite | axivionSuite() | - - | Axivion Suite | - | | 7 | buckminster | buckminster() | - - | Buckminster | | | 8 | cadence | cadence() | - - | Cadence Incisive | | -| 9 | ccm | ccm() | - - | CCM | | -| 10 | checkstyle | checkStyle() | ![CheckStyle](src/main/webapp/icons/checkstyle-24x24.png) ![CheckStyle](src/main/webapp/icons/checkstyle-48x48.png) | [CheckStyle](https://checkstyle.org) | **/checkstyle-result.xml | -| 11 | clang | clang() | - - | Clang (LLVM based) | | -| 12 | clang-tidy | clangTidy() | - - | Clang-Tidy | | -| 13 | code-analysis | codeAnalysis() | - - | CodeAnalysis | | -| 14 | codenarc | codeNarc() | - - | CodeNarc | | -| 15 | coolflux | coolflux() | - - | Coolflux DSP Compiler | | -| 16 | cpd | cpd() | ![CPD](src/main/webapp/icons/dry-24x24.png) ![CPD](src/main/webapp/icons/dry-48x48.png) | [CPD](https://pmd.github.io/latest/pmd_userdocs_cpd.html) | **/cpd.xml | -| 17 | cppcheck | cppCheck() | - - | CPPCheck | | -| 18 | cpplint | cppLint() | - - | CppLint | | -| 19 | csslint | cssLint() | - - | CssLint | | -| 20 | detekt | detekt() | - - | [Detekt](https://arturbosch.github.io/detekt/) | | -| 21 | docfx | docFx() | - - | DocFX | | -| 22 | doxygen | doxygen() | - - | Doxygen | | -| 23 | dr-memory | drMemory() | - - | Dr. Memory | | -| 24 | eclipse | eclipse() | - - | Eclipse ECJ | | -| 25 | erlc | erlc() | - - | Erlang Compiler (erlc) | | -| 26 | error-prone | errorProne() | ![Error Prone](src/main/webapp/icons/bug-24x24.png) ![Error Prone](src/main/webapp/icons/bug-48x48.png) | [Error Prone](https://errorprone.info) | | -| 27 | eslint | esLint() | ![ESlint](src/main/webapp/icons/eslint-24x24.png) ![ESlint](src/main/webapp/icons/eslint-48x48.png) | [ESlint](https://eslint.org) | | -| 28 | findbugs | findBugs() | ![FindBugs](src/main/webapp/icons/findbugs-24x24.png) ![FindBugs](src/main/webapp/icons/findbugs-48x48.png) | FindBugs | **/findbugsXml.xml | -| 29 | flake8 | flake8() | - - | Flake8 | | -| 30 | flex | flexSdk() | - - | Flex SDK Compiler | | -| 31 | fxcop | fxcop() | - - | FxCop | | -| 32 | gendarme | gendarme() | - - | Gendarme | | -| 33 | ghs-multi | ghsMulti() | - - | GHS Multi Compiler | | -| 34 | gcc3 | gcc3() | - - | GNU C Compiler 3 (gcc) | | -| 35 | gcc4 | gcc4() | - - | GNU C Compiler 4 (gcc) | | -| 36 | fortran | gnuFortran() | - - | GNU Fortran Compiler | | -| 37 | golint | goLint() | ![Go Lint](src/main/webapp/icons/golint-24x24.png) ![Go Lint](src/main/webapp/icons/golint-48x48.png) | Go Lint | | -| 38 | go-vet | goVet() | - - | Go Vet | | -| 39 | groovy | groovyScript() | - - | Groovy Parser | | -| 40 | iar-cstat | iarCstat() | - - | IAR C-STAT | | -| 41 | iar | iar() | - - | IAR Compiler (C/C++) | | -| 42 | iblinter | ibLinter() | - - | [IBLinter](https://github.com/IBDecodable/IBLinter) | | -| 43 | xlc | xlc() | - - | IBM XLC Compiler | | -| 44 | infer | infer() | - - | [Infer](http://fbinfer.com) | | -| 45 | intel | intel() | - - | Intel Compiler (C, Fortran) | | -| 46 | idea | ideaInspection() | ![IntelliJ IDEA Inspections](src/main/webapp/icons/idea-24x24.png) ![IntelliJ IDEA Inspections](src/main/webapp/icons/idea-48x48.png) | [IntelliJ IDEA Inspections](https://www.jetbrains.com/help/idea/code-inspection.html) | | -| 47 | java | java() | ![Java](src/main/webapp/icons/java-24x24.png) ![Java](src/main/webapp/icons/java-48x48.png) | Java | | -| 48 | javadoc-warnings | javaDoc() | ![JavaDoc](src/main/webapp/icons/java-24x24.png) ![JavaDoc](src/main/webapp/icons/java-48x48.png) | JavaDoc | | -| 49 | jc-report | jcReport() | - - | JCReport | | -| 50 | js-hint | jsHint() | - - | JSHint | | -| 51 | jslint | jsLint() | - - | [JSLint](https://www.jslint.com) | | -| 52 | klocwork | klocWork() | - - | Klocwork | | -| 53 | ktlint | ktLint() | ![Ktlint](src/main/webapp/icons/ktlint-24x24.png) ![Ktlint](src/main/webapp/icons/ktlint-48x48.png) | [Ktlint](https://ktlint.github.io) | | -| 54 | maven-warnings | mavenConsole() | - - | Maven | | -| 55 | taglist | tagList() | - - | [Maven Taglist Plugin](https://www.mojohaus.org/taglist-maven-plugin) | **/taglist.xml | -| 56 | metrowerks | metrowerksCodeWarrior() | - - | Metrowerks CodeWarrior | | -| 57 | msbuild | msBuild() | - - | MSBuild | | -| 58 | mypy | myPy() | - - | MyPy | | -| 59 | nag-fortran | nagFortran() | - - | NAG Fortran Compiler | | -| 60 | open-tasks | taskScanner() | ![Open Tasks Scanner](src/main/webapp/icons/open-tasks-24x24.png) ![Open Tasks Scanner](src/main/webapp/icons/open-tasks-48x48.png) | Open Tasks Scanner | - | -| 61 | invalids | invalids() | - - | Oracle Invalids | | -| 62 | pclint | pcLint() | - - | PC-Lint | | -| 63 | pep8 | pep8() | - - | Pep8 | | -| 64 | perforce | perforce() | - - | Perforce Compiler | | -| 65 | perl-critic | perlCritic() | - - | Perl::Critic | | -| 66 | php | php() | - - | PHP Runtime | | -| 67 | php-code-sniffer | phpCodeSniffer() | - - | [PHP_CodeSniffer](https://github.com/squizlabs/PHP_CodeSniffer) | | -| 68 | phpstan | phpStan() | ![PHPStan](src/main/webapp/icons/phpstan-24x24.png) ![PHPStan](src/main/webapp/icons/phpstan-48x48.png) | [PHPStan](https://github.com/phpstan/phpstan) | | -| 69 | pit | pit() | ![Pit Test Coverage](src/main/webapp/icons/pit-24x24.png) ![Pit Test Coverage](src/main/webapp/icons/pit-48x48.png) | [Pit Test Coverage](http://pitest.org) | | -| 70 | pmd | pmdParser() | ![PMD](src/main/webapp/icons/pmd-24x24.png) ![PMD](src/main/webapp/icons/pmd-48x48.png) | [PMD](https://pmd.github.io) | **/pmd.xml | -| 71 | prefast | prefast() | - - | PREfast | | -| 72 | puppetlint | puppetLint() | - - | Puppet-Lint | | -| 73 | pydocstyle | pyDocStyle() | - - | Pydocstyle | | -| 74 | pylint | pyLint() | ![Pylint](src/main/webapp/icons/pylint-24x24.png) ![Pylint](src/main/webapp/icons/pylint-48x48.png) | Pylint | | -| 75 | qac | qacSourceCodeAnalyser() | - - | QA-C Sourcecode Analyser | | -| 76 | dupfinder | dupFinder() | ![Resharper dupFinder](src/main/webapp/icons/dry-24x24.png) ![Resharper dupFinder](src/main/webapp/icons/dry-48x48.png) | Resharper dupFinder | | -| 77 | resharper | resharperInspectCode() | ![Resharper InspectCode](src/main/webapp/icons/resharper-24x24.png) ![Resharper InspectCode](src/main/webapp/icons/resharper-48x48.png) | Resharper InspectCode | | -| 78 | robocopy | robocopy() | - - | Robocopy | | -| 79 | rflint | rfLint() | ![Robot Framework Lint](src/main/webapp/icons/robot-framework-24x24.png) ![Robot Framework Lint](src/main/webapp/icons/robot-framework-48x48.png) | Robot Framework Lint | | -| 80 | rubocop | ruboCop() | ![RuboCop](src/main/webapp/icons/rubocop-24x24.png) ![RuboCop](src/main/webapp/icons/rubocop-48x48.png) | RuboCop | | -| 81 | scala | scala() | ![Scala Compiler](src/main/webapp/icons/scala-24x24.png) ![Scala Compiler](src/main/webapp/icons/scala-48x48.png) | Scala Compiler | | -| 82 | simian | simian() | ![Simian](src/main/webapp/icons/dry-24x24.png) ![Simian](src/main/webapp/icons/dry-48x48.png) | Simian | | -| 83 | sonar | sonarQube() | ![SonarQube](src/main/webapp/icons/sonar-24x24.png) ![SonarQube](src/main/webapp/icons/sonar-48x48.png) | SonarQube | **/sonar-report.json | -| 84 | sphinx | sphinxBuild() | - - | Sphinx-build | | -| 85 | spotbugs | spotBugs() | ![SpotBugs](src/main/webapp/icons/spotbugs-24x24.png) ![SpotBugs](src/main/webapp/icons/spotbugs-48x48.png) | [SpotBugs](https://spotbugs.github.io) | **/spotbugsXml.xml | -| 86 | stylecop | styleCop() | - - | StyleCop | | -| 87 | sunc | sunC() | - - | SUN C++ Compiler | | -| 88 | swiftlint | swiftLint() | - - | [SwiftLint](https://github.com/realm/SwiftLint) | | -| 89 | tasking-vx | taskingVx() | - - | TASKING VX Compiler | | -| 90 | code-composer | tiCss() | - - | Texas Instruments Code Composer Studio | | -| 91 | tnsdl | tnsdl() | - - | TNSDL Translator | | -| 92 | tslint | tsLint() | - - | [TSLint](https://palantir.github.io/tslint/) | | -| 93 | diabc | diabC() | - - | Wind River Diab Compiler (C/C++) | | -| 94 | xmllint | xmlLint() | - - | XML Lint | | -| 95 | yamllint | yamlLint() | - - | [YamlLint](https://yamllint.readthedocs.io/) | | -| 96 | yui | yuiCompressor() | - - | YUI Compressor | | -| 97 | zptlint | zptLint() | - - | ZPT Lint | | +| 9 | cargo | cargo() | - - | Cargo | | +| 10 | ccm | ccm() | - - | CCM | | +| 11 | checkstyle | checkStyle() | ![CheckStyle](src/main/webapp/icons/checkstyle-24x24.png) ![CheckStyle](src/main/webapp/icons/checkstyle-48x48.png) | [CheckStyle](https://checkstyle.org) | **/checkstyle-result.xml | +| 12 | clang | clang() | - - | Clang (LLVM based) | | +| 13 | clang-tidy | clangTidy() | - - | Clang-Tidy | | +| 14 | cmake | cmake() | - - | CMake | | +| 15 | code-analysis | codeAnalysis() | - - | CodeAnalysis | | +| 16 | codenarc | codeNarc() | - - | CodeNarc | | +| 17 | coolflux | coolflux() | - - | Coolflux DSP Compiler | | +| 18 | cpd | cpd() | ![CPD](src/main/webapp/icons/dry-24x24.png) ![CPD](src/main/webapp/icons/dry-48x48.png) | [CPD](https://pmd.github.io/latest/pmd_userdocs_cpd.html) | **/cpd.xml | +| 19 | cppcheck | cppCheck() | - - | CPPCheck | | +| 20 | cpplint | cppLint() | - - | CppLint | | +| 21 | csslint | cssLint() | - - | CssLint | | +| 22 | detekt | detekt() | - - | [Detekt](https://arturbosch.github.io/detekt/) | | +| 23 | docfx | docFx() | - - | DocFX | | +| 24 | doxygen | doxygen() | - - | Doxygen | | +| 25 | dr-memory | drMemory() | - - | Dr. Memory | | +| 26 | eclipse | eclipse() | - - | Eclipse ECJ | | +| 27 | erlc | erlc() | - - | Erlang Compiler (erlc) | | +| 28 | error-prone | errorProne() | ![Error Prone](src/main/webapp/icons/bug-24x24.png) ![Error Prone](src/main/webapp/icons/bug-48x48.png) | [Error Prone](https://errorprone.info) | | +| 29 | eslint | esLint() | ![ESlint](src/main/webapp/icons/eslint-24x24.png) ![ESlint](src/main/webapp/icons/eslint-48x48.png) | [ESlint](https://eslint.org) | | +| 30 | findbugs | findBugs() | ![FindBugs](src/main/webapp/icons/findbugs-24x24.png) ![FindBugs](src/main/webapp/icons/findbugs-48x48.png) | FindBugs | **/findbugsXml.xml | +| 31 | flake8 | flake8() | - - | Flake8 | | +| 32 | flex | flexSdk() | - - | Flex SDK Compiler | | +| 33 | fxcop | fxcop() | - - | FxCop | | +| 34 | gendarme | gendarme() | - - | Gendarme | | +| 35 | ghs-multi | ghsMulti() | - - | GHS Multi Compiler | | +| 36 | gcc3 | gcc3() | - - | GNU C Compiler 3 (gcc) | | +| 37 | gcc4 | gcc4() | - - | GNU C Compiler 4 (gcc) | | +| 38 | fortran | gnuFortran() | - - | GNU Fortran Compiler | | +| 39 | golint | goLint() | ![Go Lint](src/main/webapp/icons/golint-24x24.png) ![Go Lint](src/main/webapp/icons/golint-48x48.png) | Go Lint | | +| 40 | go-vet | goVet() | - - | Go Vet | | +| 41 | groovy | groovyScript() | - - | Groovy Parser | | +| 42 | iar-cstat | iarCstat() | - - | IAR C-STAT | | +| 43 | iar | iar() | - - | IAR Compiler (C/C++) | | +| 44 | iblinter | ibLinter() | - - | [IBLinter](https://github.com/IBDecodable/IBLinter) | | +| 45 | xlc | xlc() | - - | IBM XLC Compiler | | +| 46 | infer | infer() | - - | [Infer](http://fbinfer.com) | | +| 47 | intel | intel() | - - | Intel Compiler (C, Fortran) | | +| 48 | idea | ideaInspection() | ![IntelliJ IDEA Inspections](src/main/webapp/icons/idea-24x24.png) ![IntelliJ IDEA Inspections](src/main/webapp/icons/idea-48x48.png) | [IntelliJ IDEA Inspections](https://www.jetbrains.com/help/idea/code-inspection.html) | | +| 49 | java | java() | ![Java](src/main/webapp/icons/java-24x24.png) ![Java](src/main/webapp/icons/java-48x48.png) | Java | | +| 50 | javadoc-warnings | javaDoc() | ![JavaDoc](src/main/webapp/icons/java-24x24.png) ![JavaDoc](src/main/webapp/icons/java-48x48.png) | JavaDoc | | +| 51 | jc-report | jcReport() | - - | JCReport | | +| 52 | js-hint | jsHint() | - - | JSHint | | +| 53 | jslint | jsLint() | - - | [JSLint](https://www.jslint.com) | | +| 54 | klocwork | klocWork() | - - | Klocwork | | +| 55 | ktlint | ktLint() | ![Ktlint](src/main/webapp/icons/ktlint-24x24.png) ![Ktlint](src/main/webapp/icons/ktlint-48x48.png) | [Ktlint](https://ktlint.github.io) | | +| 56 | maven-warnings | mavenConsole() | - - | Maven | | +| 57 | taglist | tagList() | - - | [Maven Taglist Plugin](https://www.mojohaus.org/taglist-maven-plugin) | **/taglist.xml | +| 58 | metrowerks | metrowerksCodeWarrior() | - - | Metrowerks CodeWarrior | | +| 59 | msbuild | msBuild() | - - | MSBuild | | +| 60 | mypy | myPy() | - - | MyPy | | +| 61 | nag-fortran | nagFortran() | - - | NAG Fortran Compiler | | +| 62 | open-tasks | taskScanner() | ![Open Tasks Scanner](src/main/webapp/icons/open-tasks-24x24.png) ![Open Tasks Scanner](src/main/webapp/icons/open-tasks-48x48.png) | Open Tasks Scanner | - | +| 63 | invalids | invalids() | - - | Oracle Invalids | | +| 64 | pclint | pcLint() | - - | PC-Lint | | +| 65 | pep8 | pep8() | - - | Pep8 | | +| 66 | perforce | perforce() | - - | Perforce Compiler | | +| 67 | perl-critic | perlCritic() | - - | Perl::Critic | | +| 68 | php | php() | - - | PHP Runtime | | +| 69 | php-code-sniffer | phpCodeSniffer() | - - | [PHP_CodeSniffer](https://github.com/squizlabs/PHP_CodeSniffer) | | +| 70 | phpstan | phpStan() | ![PHPStan](src/main/webapp/icons/phpstan-24x24.png) ![PHPStan](src/main/webapp/icons/phpstan-48x48.png) | [PHPStan](https://github.com/phpstan/phpstan) | | +| 71 | pit | pit() | ![Pit Test Coverage](src/main/webapp/icons/pit-24x24.png) ![Pit Test Coverage](src/main/webapp/icons/pit-48x48.png) | [Pit Test Coverage](http://pitest.org) | | +| 72 | pmd | pmdParser() | ![PMD](src/main/webapp/icons/pmd-24x24.png) ![PMD](src/main/webapp/icons/pmd-48x48.png) | [PMD](https://pmd.github.io) | **/pmd.xml | +| 73 | prefast | prefast() | - - | PREfast | | +| 74 | puppetlint | puppetLint() | - - | Puppet-Lint | | +| 75 | pydocstyle | pyDocStyle() | - - | Pydocstyle | | +| 76 | pylint | pyLint() | ![Pylint](src/main/webapp/icons/pylint-24x24.png) ![Pylint](src/main/webapp/icons/pylint-48x48.png) | Pylint | | +| 77 | qac | qacSourceCodeAnalyser() | - - | QA-C Sourcecode Analyser | | +| 78 | dupfinder | dupFinder() | ![Resharper dupFinder](src/main/webapp/icons/dry-24x24.png) ![Resharper dupFinder](src/main/webapp/icons/dry-48x48.png) | Resharper dupFinder | | +| 79 | resharper | resharperInspectCode() | ![Resharper InspectCode](src/main/webapp/icons/resharper-24x24.png) ![Resharper InspectCode](src/main/webapp/icons/resharper-48x48.png) | Resharper InspectCode | | +| 80 | robocopy | robocopy() | - - | Robocopy | | +| 81 | rflint | rfLint() | ![Robot Framework Lint](src/main/webapp/icons/robot-framework-24x24.png) ![Robot Framework Lint](src/main/webapp/icons/robot-framework-48x48.png) | Robot Framework Lint | | +| 82 | rubocop | ruboCop() | ![RuboCop](src/main/webapp/icons/rubocop-24x24.png) ![RuboCop](src/main/webapp/icons/rubocop-48x48.png) | RuboCop | | +| 83 | scala | scala() | ![Scala Compiler](src/main/webapp/icons/scala-24x24.png) ![Scala Compiler](src/main/webapp/icons/scala-48x48.png) | Scala Compiler | | +| 84 | simian | simian() | ![Simian](src/main/webapp/icons/dry-24x24.png) ![Simian](src/main/webapp/icons/dry-48x48.png) | Simian | | +| 85 | sonar | sonarQube() | ![SonarQube](src/main/webapp/icons/sonar-24x24.png) ![SonarQube](src/main/webapp/icons/sonar-48x48.png) | SonarQube | **/sonar-report.json | +| 86 | sphinx | sphinxBuild() | - - | Sphinx-build | | +| 87 | spotbugs | spotBugs() | ![SpotBugs](src/main/webapp/icons/spotbugs-24x24.png) ![SpotBugs](src/main/webapp/icons/spotbugs-48x48.png) | [SpotBugs](https://spotbugs.github.io) | **/spotbugsXml.xml | +| 88 | stylecop | styleCop() | - - | StyleCop | | +| 89 | sunc | sunC() | - - | SUN C++ Compiler | | +| 90 | swiftlint | swiftLint() | - - | [SwiftLint](https://github.com/realm/SwiftLint) | | +| 91 | tasking-vx | taskingVx() | - - | TASKING VX Compiler | | +| 92 | code-composer | tiCss() | - - | Texas Instruments Code Composer Studio | | +| 93 | tnsdl | tnsdl() | - - | TNSDL Translator | | +| 94 | tslint | tsLint() | - - | [TSLint](https://palantir.github.io/tslint/) | | +| 95 | diabc | diabC() | - - | Wind River Diab Compiler (C/C++) | | +| 96 | xmllint | xmlLint() | - - | XML Lint | | +| 97 | yamllint | yamlLint() | - - | [YamlLint](https://yamllint.readthedocs.io/) | | +| 98 | yui | yuiCompressor() | - - | YUI Compressor | | +| 99 | zptlint | zptLint() | - - | ZPT Lint | | diff --git a/src/main/java/io/jenkins/plugins/analysis/warnings/Cargo.java b/src/main/java/io/jenkins/plugins/analysis/warnings/Cargo.java new file mode 100644 index 0000000000..82bb37ac88 --- /dev/null +++ b/src/main/java/io/jenkins/plugins/analysis/warnings/Cargo.java @@ -0,0 +1,54 @@ +package io.jenkins.plugins.analysis.warnings; + +import edu.hm.hafner.analysis.parser.CargoCheckParser; +import edu.umd.cs.findbugs.annotations.NonNull; + +import org.kohsuke.stapler.DataBoundConstructor; +import org.jenkinsci.Symbol; +import hudson.Extension; + +import io.jenkins.plugins.analysis.core.model.ReportScanningTool; + +/** + * Provides a parser and customized messages for {@code rustc} compiler messages emitted b {@code cargo check + * --message-format json}. + * + * @author Ullrich Hafner + */ +public class Cargo extends ReportScanningTool { + private static final long serialVersionUID = -3997235880208767455L; + private static final String ID = "cargo"; + + /** Creates a new instance of {@link Cargo}. */ + @DataBoundConstructor + public Cargo() { + super(); + // empty constructor required for stapler + } + + @Override + public CargoCheckParser createParser() { + return new CargoCheckParser(); + } + + /** Descriptor for this static analysis tool. */ + @Symbol("cargo") + @Extension + public static class Descriptor extends ReportScanningToolDescriptor { + /** Creates the descriptor instance. */ + public Descriptor() { + super(ID); + } + + @NonNull + @Override + public String getDisplayName() { + return Messages.Warnings_Cargo_ParserName(); + } + + @Override + public String getHelp() { + return "Use commandline cargo check --message-format json"; + } + } +} diff --git a/src/main/java/io/jenkins/plugins/analysis/warnings/Cmake.java b/src/main/java/io/jenkins/plugins/analysis/warnings/Cmake.java new file mode 100644 index 0000000000..650c4f4ca9 --- /dev/null +++ b/src/main/java/io/jenkins/plugins/analysis/warnings/Cmake.java @@ -0,0 +1,48 @@ +package io.jenkins.plugins.analysis.warnings; + +import edu.hm.hafner.analysis.parser.CMakeParser; +import edu.umd.cs.findbugs.annotations.NonNull; + +import org.kohsuke.stapler.DataBoundConstructor; +import org.jenkinsci.Symbol; +import hudson.Extension; + +import io.jenkins.plugins.analysis.core.model.ReportScanningTool; + +/** + * Provides parser and customized messages for CMake. + * + * @author Ullrich Hafner + */ +public class Cmake extends ReportScanningTool { + private static final long serialVersionUID = -5981880343845273634L; + private static final String ID = "cmake"; + + /** Creates a new instance of {@link Cmake}. */ + @DataBoundConstructor + public Cmake() { + super(); + // empty constructor required for stapler + } + + @Override + public CMakeParser createParser() { + return new CMakeParser(); + } + + /** Descriptor for this static analysis tool. */ + @Symbol("cmake") + @Extension + public static class Descriptor extends ReportScanningToolDescriptor { + /** Creates the descriptor instance. */ + public Descriptor() { + super(ID); + } + + @NonNull + @Override + public String getDisplayName() { + return Messages.Warnings_Cmake_ParserName(); + } + } +} diff --git a/src/main/java/io/jenkins/plugins/analysis/warnings/Doxygen.java b/src/main/java/io/jenkins/plugins/analysis/warnings/Doxygen.java index e9b97642f8..daba89d481 100644 --- a/src/main/java/io/jenkins/plugins/analysis/warnings/Doxygen.java +++ b/src/main/java/io/jenkins/plugins/analysis/warnings/Doxygen.java @@ -40,11 +40,6 @@ public Descriptor() { super(ID); } - @Override - public String getHelp() { - return Messages.Warning_SlowMultiLineParser(); - } - @NonNull @Override public String getDisplayName() { diff --git a/src/main/java/io/jenkins/plugins/analysis/warnings/DrMemory.java b/src/main/java/io/jenkins/plugins/analysis/warnings/DrMemory.java index e940ab59f6..0acfa0f68d 100644 --- a/src/main/java/io/jenkins/plugins/analysis/warnings/DrMemory.java +++ b/src/main/java/io/jenkins/plugins/analysis/warnings/DrMemory.java @@ -39,11 +39,6 @@ public Descriptor() { super(ID); } - @Override - public String getHelp() { - return Messages.Warning_SlowMultiLineParser(); - } - @NonNull @Override public String getDisplayName() { diff --git a/src/main/java/io/jenkins/plugins/analysis/warnings/GhsMulti.java b/src/main/java/io/jenkins/plugins/analysis/warnings/GhsMulti.java index 13c3e3a37d..442c63add6 100644 --- a/src/main/java/io/jenkins/plugins/analysis/warnings/GhsMulti.java +++ b/src/main/java/io/jenkins/plugins/analysis/warnings/GhsMulti.java @@ -39,11 +39,6 @@ public Descriptor() { super(ID); } - @Override - public String getHelp() { - return Messages.Warning_SlowMultiLineParser(); - } - @NonNull @Override public String getDisplayName() { diff --git a/src/main/java/io/jenkins/plugins/analysis/warnings/GnuFortran.java b/src/main/java/io/jenkins/plugins/analysis/warnings/GnuFortran.java index 0e0a7a6f56..772a29067f 100644 --- a/src/main/java/io/jenkins/plugins/analysis/warnings/GnuFortran.java +++ b/src/main/java/io/jenkins/plugins/analysis/warnings/GnuFortran.java @@ -39,11 +39,6 @@ public Descriptor() { super(ID); } - @Override - public String getHelp() { - return Messages.Warning_SlowMultiLineParser(); - } - @NonNull @Override public String getDisplayName() { diff --git a/src/main/java/io/jenkins/plugins/analysis/warnings/NagFortran.java b/src/main/java/io/jenkins/plugins/analysis/warnings/NagFortran.java index 56af010cf4..8ea479d162 100644 --- a/src/main/java/io/jenkins/plugins/analysis/warnings/NagFortran.java +++ b/src/main/java/io/jenkins/plugins/analysis/warnings/NagFortran.java @@ -39,11 +39,6 @@ public Descriptor() { super(ID); } - @Override - public String getHelp() { - return Messages.Warning_SlowMultiLineParser(); - } - @NonNull @Override public String getDisplayName() { diff --git a/src/main/java/io/jenkins/plugins/analysis/warnings/YuiCompressor.java b/src/main/java/io/jenkins/plugins/analysis/warnings/YuiCompressor.java index 793c2b9e49..efb7bcb505 100644 --- a/src/main/java/io/jenkins/plugins/analysis/warnings/YuiCompressor.java +++ b/src/main/java/io/jenkins/plugins/analysis/warnings/YuiCompressor.java @@ -39,11 +39,6 @@ public Descriptor() { super(ID); } - @Override - public String getHelp() { - return Messages.Warning_SlowMultiLineParser(); - } - @NonNull @Override public String getDisplayName() { diff --git a/src/main/resources/io/jenkins/plugins/analysis/warnings/Messages.properties b/src/main/resources/io/jenkins/plugins/analysis/warnings/Messages.properties index a7c7625897..2df916a7a1 100644 --- a/src/main/resources/io/jenkins/plugins/analysis/warnings/Messages.properties +++ b/src/main/resources/io/jenkins/plugins/analysis/warnings/Messages.properties @@ -2,9 +2,6 @@ OpenTasks.Validation.NoTask=No open task found. OpenTasks.Validation.OneTask=One open task: {0} - {1} OpenTasks.Validation.MultipleTasks={0} open tasks found. -Warning.SlowMultiLineParser=Warning: this parser might be slow since it is reading the whole report file into memory \ - and parses this String using a slow multi-line regular expression. - Warnings.Groovy.NoParsersDefined=- no parser defined yet - Warnings.Groovy.DescribableName=Groovy Parser @@ -52,12 +49,13 @@ Warnings.PMD.ParserName=PMD Warnings.FindBugs.ParserName=FindBugs Warnings.SpotBugs.ParserName=SpotBugs Warnings.ScalaStyle.ParserName=ScalaStyle +Warnings.Cmake.ParserName=CMake +Warnings.Cargo.ParserName=Cargo Warnings.AcuCobol.ParserName=AcuCobol Compiler Warnings.JavaParser.ParserName=Java Warnings.JavaDoc.ParserName=JavaDoc Warnings.EclipseParser.ParserName=Eclipse ECJ - Warnings.Taglist.ParserName=Maven Taglist Plugin Warnings.Maven.ParserName=Maven Warnings.CppLint.ParserName=CppLint diff --git a/src/test/java/io/jenkins/plugins/analysis/warnings/ParsersITest.java b/src/test/java/io/jenkins/plugins/analysis/warnings/ParsersITest.java index d59276575d..c4002bfd2a 100644 --- a/src/test/java/io/jenkins/plugins/analysis/warnings/ParsersITest.java +++ b/src/test/java/io/jenkins/plugins/analysis/warnings/ParsersITest.java @@ -86,6 +86,18 @@ public void shouldFindAllIssuesForCheckStyleAlias() { } } + /** Runs the Iar parser on an output file that contains 8 issues. */ + @Test + public void shouldFindAllCmakeIssues() { + shouldFindIssuesOfTool(8, new Cmake(), "cmake.txt"); + } + + /** Runs the Iar parser on an output file that contains 2 issues. */ + @Test + public void shouldFindAllCargoIssues() { + shouldFindIssuesOfTool(2, new Cargo(), "CargoCheck.json"); + } + /** Runs the Iar parser on an output file that contains 262 issues. */ @Test public void shouldFindAllIssuesForPmdAlias() { diff --git a/src/test/resources/io/jenkins/plugins/analysis/warnings/CargoCheck.json b/src/test/resources/io/jenkins/plugins/analysis/warnings/CargoCheck.json new file mode 100644 index 0000000000..a879493669 --- /dev/null +++ b/src/test/resources/io/jenkins/plugins/analysis/warnings/CargoCheck.json @@ -0,0 +1,4 @@ +{"reason":"compiler-artifact","package_id":"smol_str 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)","target":{"kind":["lib"],"crate_types":["lib"],"name":"smol_str","src_path":".cargo/registry/src/github.com-1ecc6299db9ec823/smol_str-0.1.9/src/lib.rs","edition":"2015"},"profile":{"opt_level":"0","debuginfo":2,"debug_assertions":true,"overflow_checks":true,"test":false},"features":[],"filenames":["/target/debug/deps/libsmol_str-60034903e8f9c710.rmeta"],"executable":null,"fresh":false} +{"reason":"compiler-message","package_id":"dummy-pkg","target":{"kind":["bin"],"crate_types":["bin"],"name":"secspc","src_path":"src/main.rs","edition":"2018"},"message":{"message":"unused import: `secsp_analysis::input::FileId`","code":{"code":"unused_imports","explanation":null},"level":"warning","spans":[{"file_name":"packages/secspc/src/main.rs","byte_start":199,"byte_end":228,"line_start":14,"line_end":14,"column_start":5,"column_end":34,"is_primary":true,"text":[{"text":"use secsp_analysis::input::FileId;","highlight_start":5,"highlight_end":34}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"#[warn(unused_imports)] on by default","code":null,"level":"note","spans":[],"children":[],"rendered":null}],"rendered":"warning: unused import: `secsp_analysis::input::FileId`\n --> packages/secspc/src/main.rs:14:5\n |\n14 | use secsp_analysis::input::FileId;\n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n |\n = note: #[warn(unused_imports)] on by default\n\n"}} +{"reason":"compiler-message","package_id":"dummy-pkg","target":{"kind":["bin"],"crate_types":["bin"],"name":"secspc","src_path":"packages/secspc/src/main.rs","edition":"2018"},"message":{"message":"dummy message","code":{"code":"dummy_code","explanation":null},"level":"warning","spans":[],"children":[],"rendered":"dummy message"}} +{"reason":"compiler-message","package_id":"dummy-pkg","target":{"kind":["bin"],"crate_types":["bin"],"name":"secspc","src_path":"packages/secspc/src/main.rs","edition":"2018"},"message":{"message":"redundant closure found","code":{"code":"clippy::redundant_closure","explanation":null},"level":"warning","spans":[{"file_name":"packages/secspc/src/main.rs","byte_start":1651,"byte_end":1671,"line_start":68,"line_end":68,"column_start":14,"column_end":34,"is_primary":false,"label":"secondary text here","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"packages/secspc/src/main.rs","byte_start":1651,"byte_end":1671,"line_start":68,"line_end":68,"column_start":14,"column_end":34,"is_primary":true,"text":[{"text":" .map(|i| PathBuf::from(i))","highlight_start":14,"highlight_end":34}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"#[warn(clippy::redundant_closure)] on by default","code":null,"level":"note","spans":[],"children":[],"rendered":null},{"message":"for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure","code":null,"level":"help","spans":[],"children":[],"rendered":null},{"message":"remove closure as shown","code":null,"level":"help","spans":[{"file_name":"packages/secspc/src/main.rs","byte_start":1651,"byte_end":1671,"line_start":68,"line_end":68,"column_start":14,"column_end":34,"is_primary":true,"text":[{"text":" .map(|i| PathBuf::from(i))","highlight_start":14,"highlight_end":34}],"label":null,"suggested_replacement":"PathBuf::from","suggestion_applicability":"MachineApplicable","expansion":null}],"children":[],"rendered":null}],"rendered":"warning: redundant closure found\n --> packages/secspc/src/main.rs:68:14\n |\n68 | .map(|i| PathBuf::from(i))\n | ^^^^^^^^^^^^^^^^^^^^ help: remove closure as shown: `PathBuf::from`\n |\n = note: #[warn(clippy::redundant_closure)] on by default\n = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure\n\n"}} \ No newline at end of file diff --git a/src/test/resources/io/jenkins/plugins/analysis/warnings/cmake.txt b/src/test/resources/io/jenkins/plugins/analysis/warnings/cmake.txt new file mode 100644 index 0000000000..08541e7f28 --- /dev/null +++ b/src/test/resources/io/jenkins/plugins/analysis/warnings/cmake.txt @@ -0,0 +1,22 @@ +[step1] CMake Warning: +[step1] Manually-specified variables were not used by the project + +[step2] CMake Warning in CMakeLists.txt: +[step2] The build directory is a subdirectory of the source directory. + +CMake Warning (dev) at tools/gtest-1.8/googlemock/CMakeLists.txt:10 (option): + I'm the message + +CMake Warning at project/utils/fancy.cmake:423 (message): + Special workaround applied + +CMake Error at error.cmake:2 (message): + Uh oh !$%@! + +CMake Deprecation Warning at legacy.cmake:23 (message): + function foo is deprecated, use bar instead + +CMake Warning at unlikely.cmake:357 nonexistingcategory: + strange things can happen + +CMake Warning at unlikely.cmake:362 (message): \ No newline at end of file