How to publish cppcheck results in a pipeline?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
16 messages Options
Reply | Threaded
Open this post in threaded view
|

How to publish cppcheck results in a pipeline?

jesus fernandez
I am learning about Jenkins on my own, and I wanted to try the cppcheck plugin, I have setup the following sample pipeline:
```
pipeline {
    agent any

    stages {
        stage('analysis') {
            steps {
                script{
                    bat'cppcheck "E:/Source" --force — enable=all — inconclusive — xml — xml-version=2 . 2 > cppcheck.xml'
                }
            }
        }
    }
    post {
        always {
            // scanForIssues tool: cppCheck(pattern: 'cppcheck.xml')
            publishCppcheck pattern:'cppcheck.xml'
        }
    }
}
```

But I get an error in the post step which I do not know if it is related to my projecto or if I am doing something wrong. I have follow the instructions on this thread [cppcheck][1]but it does not seem to work, wehther I use ```publushCppcheck``` :
```
[Pipeline] { (Declarative: Post Actions)
[Pipeline] publishCppcheck (hide)
[Cppcheck] Starting the cppcheck analysis.
[Cppcheck] Processing 1 files with the pattern 'cppcheck.xml'.
[Cppcheck] Parsing throws exceptions. javax.xml.bind.UnmarshalException
 - with linked exception:
[org.xml.sax.SAXParseException; systemId: file:/C:/Users/anton/.jenkins/workspace/JOB4/cppcheck.xml; lineNumber: 1; columnNumber: 1; El contenido no está permitido en el prólogo.]
[Cppcheck] java.io.IOException: javax.xml.bind.UnmarshalException
 - with linked exception:
[org.xml.sax.SAXParseException; systemId: file:/C:/Users/anton/.jenkins/workspace/JOB4/cppcheck.xml; lineNumber: 1; columnNumber: 1; El contenido no está permitido en el prólogo.]
at org.jenkinsci.plugins.cppcheck.parser.CppcheckParser.parse(CppcheckParser.java:67)
at org.jenkinsci.plugins.cppcheck.CppcheckParserResult.invoke(CppcheckParserResult.java:69)
at org.jenkinsci.plugins.cppcheck.CppcheckParserResult.invoke(CppcheckParserResult.java:24)
at hudson.FilePath.act(FilePath.java:1164)
at hudson.FilePath.act(FilePath.java:1147)
at org.jenkinsci.plugins.cppcheck.CppcheckPublisher.perform(CppcheckPublisher.java:337)
at jenkins.tasks.SimpleBuildStep.perform(SimpleBuildStep.java:123)
at org.jenkinsci.plugins.workflow.steps.CoreStep$Execution.run(CoreStep.java:99)
at org.jenkinsci.plugins.workflow.steps.CoreStep$Execution.run(CoreStep.java:69)
at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: javax.xml.bind.UnmarshalException
```

or ```scanforIssues``` from warnings ng plugin::
```
[Pipeline] { (Declarative: Post Actions)
[Pipeline] scanForIssues
[CPPCheck] [-ERROR-] Parsing of file 'C:\Users\anton\.jenkins\workspace\JOB4\cppcheck.xml' failed due to an exception:
[CPPCheck] [-ERROR-] com.ctc.wstx.exc.WstxUnexpectedCharException: Unexpected character 'C' (code 67) in prolog; expected '<'
 at [row,col {unknown-source}]: [1,1]
[CPPCheck] [-ERROR-]  at [row,col {unknown-source}]: [1,1]
[CPPCheck] [-ERROR-]  at com.ctc.wstx.sr.StreamScanner.throwUnexpectedChar(StreamScanner.java:648)
[CPPCheck] [-ERROR-]  at com.ctc.wstx.sr.BasicStreamReader.nextFromProlog(BasicStreamReader.java:2047)
[CPPCheck] [-ERROR-]  at com.ctc.wstx.sr.BasicStreamReader.next(BasicStreamReader.java:1069)
[CPPCheck] [-ERROR-]  at se.bjurr.violations.lib.parsers.CPPCheckParser.parseReportOutput(CPPCheckParser.java:43)
[CPPCheck] [-ERROR-]  at edu.hm.hafner.analysis.parser.violations.AbstractViolationAdapter.parse(AbstractViolationAdapter.java:35)
[CPPCheck] [-ERROR-]  at io.jenkins.plugins.analysis.core.model.FilesScanner.aggregateIssuesOfFile(FilesScanner.java:105)
[CPPCheck] [-ERROR-]  at io.jenkins.plugins.analysis.core.model.FilesScanner.scanFiles(FilesScanner.java:89)
[CPPCheck] [-ERROR-]  at io.jenkins.plugins.analysis.core.model.FilesScanner.invoke(FilesScanner.java:72)
[CPPCheck] [-ERROR-]  at io.jenkins.plugins.analysis.core.model.FilesScanner.invoke(FilesScanner.java:30)
[CPPCheck] [-ERROR-]  at hudson.FilePath.act(FilePath.java:1164)
[CPPCheck] [-ERROR-]  at hudson.FilePath.act(FilePath.java:1147)
[CPPCheck] [-ERROR-]  at io.jenkins.plugins.analysis.core.model.ReportScanningTool.scanInWorkspace(ReportScanningTool.java:152)
[CPPCheck] [-ERROR-]  at io.jenkins.plugins.analysis.core.model.ReportScanningTool.scan(ReportScanningTool.java:134)
[CPPCheck] [-ERROR-]  at io.jenkins.plugins.analysis.core.steps.IssuesScanner.scan(IssuesScanner.java:95)
[CPPCheck] [-ERROR-]  at io.jenkins.plugins.analysis.core.steps.ScanForIssuesStep$Execution.run(ScanForIssuesStep.java:214)
[CPPCheck] [-ERROR-]  at io.jenkins.plugins.analysis.core.steps.ScanForIssuesStep$Execution.run(ScanForIssuesStep.java:175)
[CPPCheck] [-ERROR-]  at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47)
[CPPCheck] [-ERROR-]  at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
[CPPCheck] [-ERROR-]  at java.util.concurrent.FutureTask.run(Unknown Source)
[CPPCheck] [-ERROR-]  at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
[CPPCheck] [-ERROR-]  at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
[CPPCheck] [-ERROR-]  at java.lang.Thread.run(Unknown Source)
[CPPCheck] [-ERROR-]  [wrapped] edu.hm.hafner.analysis.ParsingException: Exception occurred during parsing
WstxUnexpectedCharException: Unexpected character 'C' (code 67) in prolog; expected '<'
 at [row,col {unknown-source}]: [1,1]
com.ctc.wstx.exc.WstxUnexpectedCharException: Unexpected character 'C' (code 67) in prolog; expected '<'
 at [row,col {unknown-source}]: [1,1]
at com.ctc.wstx.sr.StreamScanner.throwUnexpectedChar(StreamScanner.java:648)
at com.ctc.wstx.sr.BasicStreamReader.nextFromProlog(BasicStreamReader.java:2047)
at com.ctc.wstx.sr.BasicStreamReader.next(BasicStreamReader.java:1069)
at se.bjurr.violations.lib.parsers.CPPCheckParser.parseReportOutput(CPPCheckParser.java:43)
at edu.hm.hafner.analysis.parser.violations.AbstractViolationAdapter.parse(AbstractViolationAdapter.java:35)
at io.jenkins.plugins.analysis.core.model.FilesScanner.aggregateIssuesOfFile(FilesScanner.java:105)
at io.jenkins.plugins.analysis.core.model.FilesScanner.scanFiles(FilesScanner.java:89)
at io.jenkins.plugins.analysis.core.model.FilesScanner.invoke(FilesScanner.java:72)
at io.jenkins.plugins.analysis.core.model.FilesScanner.invoke(FilesScanner.java:30)
at hudson.FilePath.act(FilePath.java:1164)
at hudson.FilePath.act(FilePath.java:1147)
at io.jenkins.plugins.analysis.core.model.ReportScanningTool.scanInWorkspace(ReportScanningTool.java:152)
at io.jenkins.plugins.analysis.core.model.ReportScanningTool.scan(ReportScanningTool.java:134)
at io.jenkins.plugins.analysis.core.steps.IssuesScanner.scan(IssuesScanner.java:95)
at io.jenkins.plugins.analysis.core.steps.ScanForIssuesStep$Execution.run(ScanForIssuesStep.java:214)
at io.jenkins.plugins.analysis.core.steps.ScanForIssuesStep$Execution.run(ScanForIssuesStep.java:175)
at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
```


  [1]: https://stackoverflow.com/questions/45836071/cppcheck-into-jenkins-with-qt-project

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/eefe0887-c933-4541-aab3-1f286c04b371n%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: How to publish cppcheck results in a pipeline?

Ulli Hafner
It look like your create XML is not valid. Can you please open the XML file and check? 

Am 25.03.2021 um 17:40 schrieb jesus fernandez <[hidden email]>:

I am learning about Jenkins on my own, and I wanted to try the cppcheck plugin, I have setup the following sample pipeline:
```
pipeline {
    agent any

    stages {
        stage('analysis') {
            steps {
                script{
                    bat'cppcheck "E:/Source" --force — enable=all — inconclusive — xml — xml-version=2 . 2 > cppcheck.xml'
                }
            }
        }
    }
    post {
        always {
            // scanForIssues tool: cppCheck(pattern: 'cppcheck.xml')
            publishCppcheck pattern:'cppcheck.xml'
        }
    }
}
```

But I get an error in the post step which I do not know if it is related to my projecto or if I am doing something wrong. I have follow the instructions on this thread [cppcheck][1]but it does not seem to work, wehther I use ```publushCppcheck``` :
```
[Pipeline] { (Declarative: Post Actions)
[Pipeline] publishCppcheck (hide)
[Cppcheck] Starting the cppcheck analysis.
[Cppcheck] Processing 1 files with the pattern 'cppcheck.xml'.
[Cppcheck] Parsing throws exceptions. javax.xml.bind.UnmarshalException
 - with linked exception:
[org.xml.sax.SAXParseException; systemId: file:/C:/Users/anton/.jenkins/workspace/JOB4/cppcheck.xml; lineNumber: 1; columnNumber: 1; El contenido no está permitido en el prólogo.]
[Cppcheck] java.io.IOException: javax.xml.bind.UnmarshalException
 - with linked exception:
[org.xml.sax.SAXParseException; systemId: file:/C:/Users/anton/.jenkins/workspace/JOB4/cppcheck.xml; lineNumber: 1; columnNumber: 1; El contenido no está permitido en el prólogo.]
at org.jenkinsci.plugins.cppcheck.parser.CppcheckParser.parse(CppcheckParser.java:67)
at org.jenkinsci.plugins.cppcheck.CppcheckParserResult.invoke(CppcheckParserResult.java:69)
at org.jenkinsci.plugins.cppcheck.CppcheckParserResult.invoke(CppcheckParserResult.java:24)
at hudson.FilePath.act(FilePath.java:1164)
at hudson.FilePath.act(FilePath.java:1147)
at org.jenkinsci.plugins.cppcheck.CppcheckPublisher.perform(CppcheckPublisher.java:337)
at jenkins.tasks.SimpleBuildStep.perform(SimpleBuildStep.java:123)
at org.jenkinsci.plugins.workflow.steps.CoreStep$Execution.run(CoreStep.java:99)
at org.jenkinsci.plugins.workflow.steps.CoreStep$Execution.run(CoreStep.java:69)
at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: javax.xml.bind.UnmarshalException
```

or ```scanforIssues``` from warnings ng plugin::
```
[Pipeline] { (Declarative: Post Actions)
[Pipeline] scanForIssues
[CPPCheck] [-ERROR-] Parsing of file 'C:\Users\anton\.jenkins\workspace\JOB4\cppcheck.xml' failed due to an exception:
[CPPCheck] [-ERROR-] com.ctc.wstx.exc.WstxUnexpectedCharException: Unexpected character 'C' (code 67) in prolog; expected '<'
 at [row,col {unknown-source}]: [1,1]
[CPPCheck] [-ERROR-]  at [row,col {unknown-source}]: [1,1]
[CPPCheck] [-ERROR-]  at com.ctc.wstx.sr.StreamScanner.throwUnexpectedChar(StreamScanner.java:648)
[CPPCheck] [-ERROR-]  at com.ctc.wstx.sr.BasicStreamReader.nextFromProlog(BasicStreamReader.java:2047)
[CPPCheck] [-ERROR-]  at com.ctc.wstx.sr.BasicStreamReader.next(BasicStreamReader.java:1069)
[CPPCheck] [-ERROR-]  at se.bjurr.violations.lib.parsers.CPPCheckParser.parseReportOutput(CPPCheckParser.java:43)
[CPPCheck] [-ERROR-]  at edu.hm.hafner.analysis.parser.violations.AbstractViolationAdapter.parse(AbstractViolationAdapter.java:35)
[CPPCheck] [-ERROR-]  at io.jenkins.plugins.analysis.core.model.FilesScanner.aggregateIssuesOfFile(FilesScanner.java:105)
[CPPCheck] [-ERROR-]  at io.jenkins.plugins.analysis.core.model.FilesScanner.scanFiles(FilesScanner.java:89)
[CPPCheck] [-ERROR-]  at io.jenkins.plugins.analysis.core.model.FilesScanner.invoke(FilesScanner.java:72)
[CPPCheck] [-ERROR-]  at io.jenkins.plugins.analysis.core.model.FilesScanner.invoke(FilesScanner.java:30)
[CPPCheck] [-ERROR-]  at hudson.FilePath.act(FilePath.java:1164)
[CPPCheck] [-ERROR-]  at hudson.FilePath.act(FilePath.java:1147)
[CPPCheck] [-ERROR-]  at io.jenkins.plugins.analysis.core.model.ReportScanningTool.scanInWorkspace(ReportScanningTool.java:152)
[CPPCheck] [-ERROR-]  at io.jenkins.plugins.analysis.core.model.ReportScanningTool.scan(ReportScanningTool.java:134)
[CPPCheck] [-ERROR-]  at io.jenkins.plugins.analysis.core.steps.IssuesScanner.scan(IssuesScanner.java:95)
[CPPCheck] [-ERROR-]  at io.jenkins.plugins.analysis.core.steps.ScanForIssuesStep$Execution.run(ScanForIssuesStep.java:214)
[CPPCheck] [-ERROR-]  at io.jenkins.plugins.analysis.core.steps.ScanForIssuesStep$Execution.run(ScanForIssuesStep.java:175)
[CPPCheck] [-ERROR-]  at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47)
[CPPCheck] [-ERROR-]  at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
[CPPCheck] [-ERROR-]  at java.util.concurrent.FutureTask.run(Unknown Source)
[CPPCheck] [-ERROR-]  at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
[CPPCheck] [-ERROR-]  at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
[CPPCheck] [-ERROR-]  at java.lang.Thread.run(Unknown Source)
[CPPCheck] [-ERROR-]  [wrapped] edu.hm.hafner.analysis.ParsingException: Exception occurred during parsing
WstxUnexpectedCharException: Unexpected character 'C' (code 67) in prolog; expected '<'
 at [row,col {unknown-source}]: [1,1]
com.ctc.wstx.exc.WstxUnexpectedCharException: Unexpected character 'C' (code 67) in prolog; expected '<'
 at [row,col {unknown-source}]: [1,1]
at com.ctc.wstx.sr.StreamScanner.throwUnexpectedChar(StreamScanner.java:648)
at com.ctc.wstx.sr.BasicStreamReader.nextFromProlog(BasicStreamReader.java:2047)
at com.ctc.wstx.sr.BasicStreamReader.next(BasicStreamReader.java:1069)
at se.bjurr.violations.lib.parsers.CPPCheckParser.parseReportOutput(CPPCheckParser.java:43)
at edu.hm.hafner.analysis.parser.violations.AbstractViolationAdapter.parse(AbstractViolationAdapter.java:35)
at io.jenkins.plugins.analysis.core.model.FilesScanner.aggregateIssuesOfFile(FilesScanner.java:105)
at io.jenkins.plugins.analysis.core.model.FilesScanner.scanFiles(FilesScanner.java:89)
at io.jenkins.plugins.analysis.core.model.FilesScanner.invoke(FilesScanner.java:72)
at io.jenkins.plugins.analysis.core.model.FilesScanner.invoke(FilesScanner.java:30)
at hudson.FilePath.act(FilePath.java:1164)
at hudson.FilePath.act(FilePath.java:1147)
at io.jenkins.plugins.analysis.core.model.ReportScanningTool.scanInWorkspace(ReportScanningTool.java:152)
at io.jenkins.plugins.analysis.core.model.ReportScanningTool.scan(ReportScanningTool.java:134)
at io.jenkins.plugins.analysis.core.steps.IssuesScanner.scan(IssuesScanner.java:95)
at io.jenkins.plugins.analysis.core.steps.ScanForIssuesStep$Execution.run(ScanForIssuesStep.java:214)
at io.jenkins.plugins.analysis.core.steps.ScanForIssuesStep$Execution.run(ScanForIssuesStep.java:175)
at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
```



--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/eefe0887-c933-4541-aab3-1f286c04b371n%40googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/0B6A6B5F-4091-4A36-A65B-F7E00A96E011%40gmail.com.
Reply | Threaded
Open this post in threaded view
|

Re: How to publish cppcheck results in a pipeline?

jesus fernandez
Thanks for replying, I have opened and it has 2000 lines of code but I do not know if it is valid or not as I have never used cppcheck before, and if it is not valid is it because I am not using the right parameters when calling cppcheck or how?



El jueves, 25 de marzo de 2021 a las 17:44:44 UTC+1, [hidden email] escribió:
It look like your create XML is not valid. Can you please open the XML file and check? 

Am 25.03.2021 um 17:40 schrieb jesus fernandez <[hidden email]>:

I am learning about Jenkins on my own, and I wanted to try the cppcheck plugin, I have setup the following sample pipeline:
```
pipeline {
    agent any

    stages {
        stage('analysis') {
            steps {
                script{
                    bat'cppcheck "E:/Source" --force — enable=all — inconclusive — xml — xml-version=2 . 2 > cppcheck.xml'
                }
            }
        }
    }
    post {
        always {
            // scanForIssues tool: cppCheck(pattern: 'cppcheck.xml')
            publishCppcheck pattern:'cppcheck.xml'
        }
    }
}
```

But I get an error in the post step which I do not know if it is related to my projecto or if I am doing something wrong. I have follow the instructions on this thread [cppcheck][1]but it does not seem to work, wehther I use ```publushCppcheck``` :
```
[Pipeline] { (Declarative: Post Actions)
[Pipeline] publishCppcheck (hide)
[Cppcheck] Starting the cppcheck analysis.
[Cppcheck] Processing 1 files with the pattern 'cppcheck.xml'.
[Cppcheck] Parsing throws exceptions. javax.xml.bind.UnmarshalException
 - with linked exception:
[org.xml.sax.SAXParseException; systemId: file:/C:/Users/anton/.jenkins/workspace/JOB4/cppcheck.xml; lineNumber: 1; columnNumber: 1; El contenido no está permitido en el prólogo.]
[Cppcheck] java.io.IOException: javax.xml.bind.UnmarshalException
 - with linked exception:
[org.xml.sax.SAXParseException; systemId: file:/C:/Users/anton/.jenkins/workspace/JOB4/cppcheck.xml; lineNumber: 1; columnNumber: 1; El contenido no está permitido en el prólogo.]
at org.jenkinsci.plugins.cppcheck.parser.CppcheckParser.parse(CppcheckParser.java:67)
at org.jenkinsci.plugins.cppcheck.CppcheckParserResult.invoke(CppcheckParserResult.java:69)
at org.jenkinsci.plugins.cppcheck.CppcheckParserResult.invoke(CppcheckParserResult.java:24)
at hudson.FilePath.act(FilePath.java:1164)
at hudson.FilePath.act(FilePath.java:1147)
at org.jenkinsci.plugins.cppcheck.CppcheckPublisher.perform(CppcheckPublisher.java:337)
at jenkins.tasks.SimpleBuildStep.perform(SimpleBuildStep.java:123)
at org.jenkinsci.plugins.workflow.steps.CoreStep$Execution.run(CoreStep.java:99)
at org.jenkinsci.plugins.workflow.steps.CoreStep$Execution.run(CoreStep.java:69)
at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: javax.xml.bind.UnmarshalException
```

or ```scanforIssues``` from warnings ng plugin::
```
[Pipeline] { (Declarative: Post Actions)
[Pipeline] scanForIssues
[CPPCheck] [-ERROR-] Parsing of file 'C:\Users\anton\.jenkins\workspace\JOB4\cppcheck.xml' failed due to an exception:
[CPPCheck] [-ERROR-] com.ctc.wstx.exc.WstxUnexpectedCharException: Unexpected character 'C' (code 67) in prolog; expected '<'
 at [row,col {unknown-source}]: [1,1]
[CPPCheck] [-ERROR-]  at [row,col {unknown-source}]: [1,1]
[CPPCheck] [-ERROR-]  at com.ctc.wstx.sr.StreamScanner.throwUnexpectedChar(StreamScanner.java:648)
[CPPCheck] [-ERROR-]  at com.ctc.wstx.sr.BasicStreamReader.nextFromProlog(BasicStreamReader.java:2047)
[CPPCheck] [-ERROR-]  at com.ctc.wstx.sr.BasicStreamReader.next(BasicStreamReader.java:1069)
[CPPCheck] [-ERROR-]  at se.bjurr.violations.lib.parsers.CPPCheckParser.parseReportOutput(CPPCheckParser.java:43)
[CPPCheck] [-ERROR-]  at edu.hm.hafner.analysis.parser.violations.AbstractViolationAdapter.parse(AbstractViolationAdapter.java:35)
[CPPCheck] [-ERROR-]  at io.jenkins.plugins.analysis.core.model.FilesScanner.aggregateIssuesOfFile(FilesScanner.java:105)
[CPPCheck] [-ERROR-]  at io.jenkins.plugins.analysis.core.model.FilesScanner.scanFiles(FilesScanner.java:89)
[CPPCheck] [-ERROR-]  at io.jenkins.plugins.analysis.core.model.FilesScanner.invoke(FilesScanner.java:72)
[CPPCheck] [-ERROR-]  at io.jenkins.plugins.analysis.core.model.FilesScanner.invoke(FilesScanner.java:30)
[CPPCheck] [-ERROR-]  at hudson.FilePath.act(FilePath.java:1164)
[CPPCheck] [-ERROR-]  at hudson.FilePath.act(FilePath.java:1147)
[CPPCheck] [-ERROR-]  at io.jenkins.plugins.analysis.core.model.ReportScanningTool.scanInWorkspace(ReportScanningTool.java:152)
[CPPCheck] [-ERROR-]  at io.jenkins.plugins.analysis.core.model.ReportScanningTool.scan(ReportScanningTool.java:134)
[CPPCheck] [-ERROR-]  at io.jenkins.plugins.analysis.core.steps.IssuesScanner.scan(IssuesScanner.java:95)
[CPPCheck] [-ERROR-]  at io.jenkins.plugins.analysis.core.steps.ScanForIssuesStep$Execution.run(ScanForIssuesStep.java:214)
[CPPCheck] [-ERROR-]  at io.jenkins.plugins.analysis.core.steps.ScanForIssuesStep$Execution.run(ScanForIssuesStep.java:175)
[CPPCheck] [-ERROR-]  at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47)
[CPPCheck] [-ERROR-]  at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
[CPPCheck] [-ERROR-]  at java.util.concurrent.FutureTask.run(Unknown Source)
[CPPCheck] [-ERROR-]  at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
[CPPCheck] [-ERROR-]  at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
[CPPCheck] [-ERROR-]  at java.lang.Thread.run(Unknown Source)
[CPPCheck] [-ERROR-]  [wrapped] edu.hm.hafner.analysis.ParsingException: Exception occurred during parsing
WstxUnexpectedCharException: Unexpected character 'C' (code 67) in prolog; expected '<'
 at [row,col {unknown-source}]: [1,1]
com.ctc.wstx.exc.WstxUnexpectedCharException: Unexpected character 'C' (code 67) in prolog; expected '<'
 at [row,col {unknown-source}]: [1,1]
at com.ctc.wstx.sr.StreamScanner.throwUnexpectedChar(StreamScanner.java:648)
at com.ctc.wstx.sr.BasicStreamReader.nextFromProlog(BasicStreamReader.java:2047)
at com.ctc.wstx.sr.BasicStreamReader.next(BasicStreamReader.java:1069)
at se.bjurr.violations.lib.parsers.CPPCheckParser.parseReportOutput(CPPCheckParser.java:43)
at edu.hm.hafner.analysis.parser.violations.AbstractViolationAdapter.parse(AbstractViolationAdapter.java:35)
at io.jenkins.plugins.analysis.core.model.FilesScanner.aggregateIssuesOfFile(FilesScanner.java:105)
at io.jenkins.plugins.analysis.core.model.FilesScanner.scanFiles(FilesScanner.java:89)
at io.jenkins.plugins.analysis.core.model.FilesScanner.invoke(FilesScanner.java:72)
at io.jenkins.plugins.analysis.core.model.FilesScanner.invoke(FilesScanner.java:30)
at hudson.FilePath.act(FilePath.java:1164)
at hudson.FilePath.act(FilePath.java:1147)
at io.jenkins.plugins.analysis.core.model.ReportScanningTool.scanInWorkspace(ReportScanningTool.java:152)
at io.jenkins.plugins.analysis.core.model.ReportScanningTool.scan(ReportScanningTool.java:134)
at io.jenkins.plugins.analysis.core.steps.IssuesScanner.scan(IssuesScanner.java:95)
at io.jenkins.plugins.analysis.core.steps.ScanForIssuesStep$Execution.run(ScanForIssuesStep.java:214)
at io.jenkins.plugins.analysis.core.steps.ScanForIssuesStep$Execution.run(ScanForIssuesStep.java:175)
at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
```



--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/eefe0887-c933-4541-aab3-1f286c04b371n%40googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/8c629824-db3d-404f-9845-a95f14f4849dn%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: How to publish cppcheck results in a pipeline?

Ulli Hafner
The exception says it is not a valid XML file. Is it a valid XML file? Seems that there is content before the fir XML tag. Can you open it in an editor that can validate the XML?

Am 25.03.2021 um 17:57 schrieb jesus fernandez <[hidden email]>:

Thanks for replying, I have opened and it has 2000 lines of code but I do not know if it is valid or not as I have never used cppcheck before, and if it is not valid is it because I am not using the right parameters when calling cppcheck or how?



El jueves, 25 de marzo de 2021 a las 17:44:44 UTC+1, ullrich...@gmail.com escribió:
It look like your create XML is not valid. Can you please open the XML file and check? 

Am 25.03.2021 um 17:40 schrieb jesus fernandez <jesusfern...@...>:

I am learning about Jenkins on my own, and I wanted to try the cppcheck plugin, I have setup the following sample pipeline:
```
pipeline {
    agent any

    stages {
        stage('analysis') {
            steps {
                script{
                    bat'cppcheck "E:/Source" --force — enable=all — inconclusive — xml — xml-version=2 . 2 > cppcheck.xml'
                }
            }
        }
    }
    post {
        always {
            // scanForIssues tool: cppCheck(pattern: 'cppcheck.xml')
            publishCppcheck pattern:'cppcheck.xml'
        }
    }
}
```

But I get an error in the post step which I do not know if it is related to my projecto or if I am doing something wrong. I have follow the instructions on this thread [cppcheck][1]but it does not seem to work, wehther I use ```publushCppcheck``` :
```
[Pipeline] { (Declarative: Post Actions)
[Pipeline] publishCppcheck (hide)
[Cppcheck] Starting the cppcheck analysis.
[Cppcheck] Processing 1 files with the pattern 'cppcheck.xml'.
[Cppcheck] Parsing throws exceptions. javax.xml.bind.UnmarshalException
 - with linked exception:
[org.xml.sax.SAXParseException; systemId: file:/C:/Users/anton/.jenkins/workspace/JOB4/cppcheck.xml; lineNumber: 1; columnNumber: 1; El contenido no está permitido en el prólogo.]
[Cppcheck] java.io.IOException: javax.xml.bind.UnmarshalException
 - with linked exception:
[org.xml.sax.SAXParseException; systemId: file:/C:/Users/anton/.jenkins/workspace/JOB4/cppcheck.xml; lineNumber: 1; columnNumber: 1; El contenido no está permitido en el prólogo.]
at org.jenkinsci.plugins.cppcheck.parser.CppcheckParser.parse(CppcheckParser.java:67)
at org.jenkinsci.plugins.cppcheck.CppcheckParserResult.invoke(CppcheckParserResult.java:69)
at org.jenkinsci.plugins.cppcheck.CppcheckParserResult.invoke(CppcheckParserResult.java:24)
at hudson.FilePath.act(FilePath.java:1164)
at hudson.FilePath.act(FilePath.java:1147)
at org.jenkinsci.plugins.cppcheck.CppcheckPublisher.perform(CppcheckPublisher.java:337)
at jenkins.tasks.SimpleBuildStep.perform(SimpleBuildStep.java:123)
at org.jenkinsci.plugins.workflow.steps.CoreStep$Execution.run(CoreStep.java:99)
at org.jenkinsci.plugins.workflow.steps.CoreStep$Execution.run(CoreStep.java:69)
at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: javax.xml.bind.UnmarshalException
```

or ```scanforIssues``` from warnings ng plugin::
```
[Pipeline] { (Declarative: Post Actions)
[Pipeline] scanForIssues
[CPPCheck] [-ERROR-] Parsing of file 'C:\Users\anton\.jenkins\workspace\JOB4\cppcheck.xml' failed due to an exception:
[CPPCheck] [-ERROR-] com.ctc.wstx.exc.WstxUnexpectedCharException: Unexpected character 'C' (code 67) in prolog; expected '<'
 at [row,col {unknown-source}]: [1,1]
[CPPCheck] [-ERROR-]  at [row,col {unknown-source}]: [1,1]
[CPPCheck] [-ERROR-]  at com.ctc.wstx.sr.StreamScanner.throwUnexpectedChar(StreamScanner.java:648)
[CPPCheck] [-ERROR-]  at com.ctc.wstx.sr.BasicStreamReader.nextFromProlog(BasicStreamReader.java:2047)
[CPPCheck] [-ERROR-]  at com.ctc.wstx.sr.BasicStreamReader.next(BasicStreamReader.java:1069)
[CPPCheck] [-ERROR-]  at se.bjurr.violations.lib.parsers.CPPCheckParser.parseReportOutput(CPPCheckParser.java:43)
[CPPCheck] [-ERROR-]  at edu.hm.hafner.analysis.parser.violations.AbstractViolationAdapter.parse(AbstractViolationAdapter.java:35)
[CPPCheck] [-ERROR-]  at io.jenkins.plugins.analysis.core.model.FilesScanner.aggregateIssuesOfFile(FilesScanner.java:105)
[CPPCheck] [-ERROR-]  at io.jenkins.plugins.analysis.core.model.FilesScanner.scanFiles(FilesScanner.java:89)
[CPPCheck] [-ERROR-]  at io.jenkins.plugins.analysis.core.model.FilesScanner.invoke(FilesScanner.java:72)
[CPPCheck] [-ERROR-]  at io.jenkins.plugins.analysis.core.model.FilesScanner.invoke(FilesScanner.java:30)
[CPPCheck] [-ERROR-]  at hudson.FilePath.act(FilePath.java:1164)
[CPPCheck] [-ERROR-]  at hudson.FilePath.act(FilePath.java:1147)
[CPPCheck] [-ERROR-]  at io.jenkins.plugins.analysis.core.model.ReportScanningTool.scanInWorkspace(ReportScanningTool.java:152)
[CPPCheck] [-ERROR-]  at io.jenkins.plugins.analysis.core.model.ReportScanningTool.scan(ReportScanningTool.java:134)
[CPPCheck] [-ERROR-]  at io.jenkins.plugins.analysis.core.steps.IssuesScanner.scan(IssuesScanner.java:95)
[CPPCheck] [-ERROR-]  at io.jenkins.plugins.analysis.core.steps.ScanForIssuesStep$Execution.run(ScanForIssuesStep.java:214)
[CPPCheck] [-ERROR-]  at io.jenkins.plugins.analysis.core.steps.ScanForIssuesStep$Execution.run(ScanForIssuesStep.java:175)
[CPPCheck] [-ERROR-]  at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47)
[CPPCheck] [-ERROR-]  at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
[CPPCheck] [-ERROR-]  at java.util.concurrent.FutureTask.run(Unknown Source)
[CPPCheck] [-ERROR-]  at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
[CPPCheck] [-ERROR-]  at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
[CPPCheck] [-ERROR-]  at java.lang.Thread.run(Unknown Source)
[CPPCheck] [-ERROR-]  [wrapped] edu.hm.hafner.analysis.ParsingException: Exception occurred during parsing
WstxUnexpectedCharException: Unexpected character 'C' (code 67) in prolog; expected '<'
 at [row,col {unknown-source}]: [1,1]
com.ctc.wstx.exc.WstxUnexpectedCharException: Unexpected character 'C' (code 67) in prolog; expected '<'
 at [row,col {unknown-source}]: [1,1]
at com.ctc.wstx.sr.StreamScanner.throwUnexpectedChar(StreamScanner.java:648)
at com.ctc.wstx.sr.BasicStreamReader.nextFromProlog(BasicStreamReader.java:2047)
at com.ctc.wstx.sr.BasicStreamReader.next(BasicStreamReader.java:1069)
at se.bjurr.violations.lib.parsers.CPPCheckParser.parseReportOutput(CPPCheckParser.java:43)
at edu.hm.hafner.analysis.parser.violations.AbstractViolationAdapter.parse(AbstractViolationAdapter.java:35)
at io.jenkins.plugins.analysis.core.model.FilesScanner.aggregateIssuesOfFile(FilesScanner.java:105)
at io.jenkins.plugins.analysis.core.model.FilesScanner.scanFiles(FilesScanner.java:89)
at io.jenkins.plugins.analysis.core.model.FilesScanner.invoke(FilesScanner.java:72)
at io.jenkins.plugins.analysis.core.model.FilesScanner.invoke(FilesScanner.java:30)
at hudson.FilePath.act(FilePath.java:1164)
at hudson.FilePath.act(FilePath.java:1147)
at io.jenkins.plugins.analysis.core.model.ReportScanningTool.scanInWorkspace(ReportScanningTool.java:152)
at io.jenkins.plugins.analysis.core.model.ReportScanningTool.scan(ReportScanningTool.java:134)
at io.jenkins.plugins.analysis.core.steps.IssuesScanner.scan(IssuesScanner.java:95)
at io.jenkins.plugins.analysis.core.steps.ScanForIssuesStep$Execution.run(ScanForIssuesStep.java:214)
at io.jenkins.plugins.analysis.core.steps.ScanForIssuesStep$Execution.run(ScanForIssuesStep.java:175)
at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
```



--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-use...@....
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/eefe0887-c933-4541-aab3-1f286c04b371n%40googlegroups.com.


--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/8c629824-db3d-404f-9845-a95f14f4849dn%40googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/55C394DA-C117-4C7D-9D03-0DC364BA0DA0%40gmail.com.
Reply | Threaded
Open this post in threaded view
|

Re: How to publish cppcheck results in a pipeline?

Fabi

>>Thanks for replying, I have opened and it has 2000 lines of code but I do not know if it is valid or not as I have never used cppcheck before, and if it is not valid is it because I am not using the right parameters when calling cppcheck or how?
>>
>>                    bat'cppcheck "E:/Source" --force — enable=all — inconclusive — xml âxml — xml-version=2 . 2 > cppcheck.xml'

You need the output of channel 2 so you need to write 2> , leave out the space.

bye  Fabi

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/20210325183030.3E7B84516B19%40macserver.private.
Reply | Threaded
Open this post in threaded view
|

Re: How to publish cppcheck results in a pipeline?

jesus fernandez
In reply to this post by Ulli Hafner
I thought the  ```bat'cppcheck "E:/Source" --force — enable=all — inconclusive — xml — xml-version=2 . 2 > cppcheck.xml'``` command does genearate a valid xml. is it a matter of missing parameters or a matter of having to parse the output? in the documentation and the SO link I attached it is supposed to be done like that... what am I missing here?

El jueves, 25 de marzo de 2021 a las 18:21:38 UTC+1, [hidden email] escribió:
The exception says it is not a valid XML file. Is it a valid XML file? Seems that there is content before the fir XML tag. Can you open it in an editor that can validate the XML?

Am 25.03.2021 um 17:57 schrieb jesus fernandez <[hidden email]>:

Thanks for replying, I have opened and it has 2000 lines of code but I do not know if it is valid or not as I have never used cppcheck before, and if it is not valid is it because I am not using the right parameters when calling cppcheck or how?



El jueves, 25 de marzo de 2021 a las 17:44:44 UTC+1, ullrich...@gmail.com escribió:
It look like your create XML is not valid. Can you please open the XML file and check? 

Am 25.03.2021 um 17:40 schrieb jesus fernandez <[hidden email]>:

I am learning about Jenkins on my own, and I wanted to try the cppcheck plugin, I have setup the following sample pipeline:
```
pipeline {
    agent any

    stages {
        stage('analysis') {
            steps {
                script{
                    bat'cppcheck "E:/Source" --force — enable=all — inconclusive — xml — xml-version=2 . 2 > cppcheck.xml'
                }
            }
        }
    }
    post {
        always {
            // scanForIssues tool: cppCheck(pattern: 'cppcheck.xml')
            publishCppcheck pattern:'cppcheck.xml'
        }
    }
}
```

But I get an error in the post step which I do not know if it is related to my projecto or if I am doing something wrong. I have follow the instructions on this thread [cppcheck][1]but it does not seem to work, wehther I use ```publushCppcheck``` :
```
[Pipeline] { (Declarative: Post Actions)
[Pipeline] publishCppcheck (hide)
[Cppcheck] Starting the cppcheck analysis.
[Cppcheck] Processing 1 files with the pattern 'cppcheck.xml'.
[Cppcheck] Parsing throws exceptions. javax.xml.bind.UnmarshalException
 - with linked exception:
[org.xml.sax.SAXParseException; systemId: file:/C:/Users/anton/.jenkins/workspace/JOB4/cppcheck.xml; lineNumber: 1; columnNumber: 1; El contenido no está permitido en el prólogo.]
[Cppcheck] java.io.IOException: javax.xml.bind.UnmarshalException
 - with linked exception:
[org.xml.sax.SAXParseException; systemId: file:/C:/Users/anton/.jenkins/workspace/JOB4/cppcheck.xml; lineNumber: 1; columnNumber: 1; El contenido no está permitido en el prólogo.]
at org.jenkinsci.plugins.cppcheck.parser.CppcheckParser.parse(CppcheckParser.java:67)
at org.jenkinsci.plugins.cppcheck.CppcheckParserResult.invoke(CppcheckParserResult.java:69)
at org.jenkinsci.plugins.cppcheck.CppcheckParserResult.invoke(CppcheckParserResult.java:24)
at hudson.FilePath.act(FilePath.java:1164)
at hudson.FilePath.act(FilePath.java:1147)
at org.jenkinsci.plugins.cppcheck.CppcheckPublisher.perform(CppcheckPublisher.java:337)
at jenkins.tasks.SimpleBuildStep.perform(SimpleBuildStep.java:123)
at org.jenkinsci.plugins.workflow.steps.CoreStep$Execution.run(CoreStep.java:99)
at org.jenkinsci.plugins.workflow.steps.CoreStep$Execution.run(CoreStep.java:69)
at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: javax.xml.bind.UnmarshalException
```

or ```scanforIssues``` from warnings ng plugin::
```
[Pipeline] { (Declarative: Post Actions)
[Pipeline] scanForIssues
[CPPCheck] [-ERROR-] Parsing of file 'C:\Users\anton\.jenkins\workspace\JOB4\cppcheck.xml' failed due to an exception:
[CPPCheck] [-ERROR-] com.ctc.wstx.exc.WstxUnexpectedCharException: Unexpected character 'C' (code 67) in prolog; expected '<'
 at [row,col {unknown-source}]: [1,1]
[CPPCheck] [-ERROR-]  at [row,col {unknown-source}]: [1,1]
[CPPCheck] [-ERROR-]  at com.ctc.wstx.sr.StreamScanner.throwUnexpectedChar(StreamScanner.java:648)
[CPPCheck] [-ERROR-]  at com.ctc.wstx.sr.BasicStreamReader.nextFromProlog(BasicStreamReader.java:2047)
[CPPCheck] [-ERROR-]  at com.ctc.wstx.sr.BasicStreamReader.next(BasicStreamReader.java:1069)
[CPPCheck] [-ERROR-]  at se.bjurr.violations.lib.parsers.CPPCheckParser.parseReportOutput(CPPCheckParser.java:43)
[CPPCheck] [-ERROR-]  at edu.hm.hafner.analysis.parser.violations.AbstractViolationAdapter.parse(AbstractViolationAdapter.java:35)
[CPPCheck] [-ERROR-]  at io.jenkins.plugins.analysis.core.model.FilesScanner.aggregateIssuesOfFile(FilesScanner.java:105)
[CPPCheck] [-ERROR-]  at io.jenkins.plugins.analysis.core.model.FilesScanner.scanFiles(FilesScanner.java:89)
[CPPCheck] [-ERROR-]  at io.jenkins.plugins.analysis.core.model.FilesScanner.invoke(FilesScanner.java:72)
[CPPCheck] [-ERROR-]  at io.jenkins.plugins.analysis.core.model.FilesScanner.invoke(FilesScanner.java:30)
[CPPCheck] [-ERROR-]  at hudson.FilePath.act(FilePath.java:1164)
[CPPCheck] [-ERROR-]  at hudson.FilePath.act(FilePath.java:1147)
[CPPCheck] [-ERROR-]  at io.jenkins.plugins.analysis.core.model.ReportScanningTool.scanInWorkspace(ReportScanningTool.java:152)
[CPPCheck] [-ERROR-]  at io.jenkins.plugins.analysis.core.model.ReportScanningTool.scan(ReportScanningTool.java:134)
[CPPCheck] [-ERROR-]  at io.jenkins.plugins.analysis.core.steps.IssuesScanner.scan(IssuesScanner.java:95)
[CPPCheck] [-ERROR-]  at io.jenkins.plugins.analysis.core.steps.ScanForIssuesStep$Execution.run(ScanForIssuesStep.java:214)
[CPPCheck] [-ERROR-]  at io.jenkins.plugins.analysis.core.steps.ScanForIssuesStep$Execution.run(ScanForIssuesStep.java:175)
[CPPCheck] [-ERROR-]  at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47)
[CPPCheck] [-ERROR-]  at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
[CPPCheck] [-ERROR-]  at java.util.concurrent.FutureTask.run(Unknown Source)
[CPPCheck] [-ERROR-]  at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
[CPPCheck] [-ERROR-]  at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
[CPPCheck] [-ERROR-]  at java.lang.Thread.run(Unknown Source)
[CPPCheck] [-ERROR-]  [wrapped] edu.hm.hafner.analysis.ParsingException: Exception occurred during parsing
WstxUnexpectedCharException: Unexpected character 'C' (code 67) in prolog; expected '<'
 at [row,col {unknown-source}]: [1,1]
com.ctc.wstx.exc.WstxUnexpectedCharException: Unexpected character 'C' (code 67) in prolog; expected '<'
 at [row,col {unknown-source}]: [1,1]
at com.ctc.wstx.sr.StreamScanner.throwUnexpectedChar(StreamScanner.java:648)
at com.ctc.wstx.sr.BasicStreamReader.nextFromProlog(BasicStreamReader.java:2047)
at com.ctc.wstx.sr.BasicStreamReader.next(BasicStreamReader.java:1069)
at se.bjurr.violations.lib.parsers.CPPCheckParser.parseReportOutput(CPPCheckParser.java:43)
at edu.hm.hafner.analysis.parser.violations.AbstractViolationAdapter.parse(AbstractViolationAdapter.java:35)
at io.jenkins.plugins.analysis.core.model.FilesScanner.aggregateIssuesOfFile(FilesScanner.java:105)
at io.jenkins.plugins.analysis.core.model.FilesScanner.scanFiles(FilesScanner.java:89)
at io.jenkins.plugins.analysis.core.model.FilesScanner.invoke(FilesScanner.java:72)
at io.jenkins.plugins.analysis.core.model.FilesScanner.invoke(FilesScanner.java:30)
at hudson.FilePath.act(FilePath.java:1164)
at hudson.FilePath.act(FilePath.java:1147)
at io.jenkins.plugins.analysis.core.model.ReportScanningTool.scanInWorkspace(ReportScanningTool.java:152)
at io.jenkins.plugins.analysis.core.model.ReportScanningTool.scan(ReportScanningTool.java:134)
at io.jenkins.plugins.analysis.core.steps.IssuesScanner.scan(IssuesScanner.java:95)
at io.jenkins.plugins.analysis.core.steps.ScanForIssuesStep$Execution.run(ScanForIssuesStep.java:214)
at io.jenkins.plugins.analysis.core.steps.ScanForIssuesStep$Execution.run(ScanForIssuesStep.java:175)
at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
```



--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/eefe0887-c933-4541-aab3-1f286c04b371n%40googlegroups.com.


--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/1cfaf8d9-b011-4249-9540-168f075d4049n%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: How to publish cppcheck results in a pipeline?

Ulli Hafner
If you can’t check on your own if the file contains valid XML can you please show the first 5 lines of the XML file here?

Am 25.03.2021 um 19:36 schrieb jesus fernandez <[hidden email]>:

I thought the  ```bat'cppcheck "E:/Source" --force — enable=all — inconclusive — xml — xml-version=2 . 2 > cppcheck.xml'``` command does genearate a valid xml. is it a matter of missing parameters or a matter of having to parse the output? in the documentation and the SO link I attached it is supposed to be done like that... what am I missing here?

El jueves, 25 de marzo de 2021 a las 18:21:38 UTC+1, ullrich...@gmail.com escribió:
The exception says it is not a valid XML file. Is it a valid XML file? Seems that there is content before the fir XML tag. Can you open it in an editor that can validate the XML?

Am 25.03.2021 um 17:57 schrieb jesus fernandez <jesusfern...@...>:

Thanks for replying, I have opened and it has 2000 lines of code but I do not know if it is valid or not as I have never used cppcheck before, and if it is not valid is it because I am not using the right parameters when calling cppcheck or how?



El jueves, 25 de marzo de 2021 a las 17:44:44 UTC+1, ullrich...@gmail.com escribió:
It look like your create XML is not valid. Can you please open the XML file and check? 

Am 25.03.2021 um 17:40 schrieb jesus fernandez <[hidden email]>:

I am learning about Jenkins on my own, and I wanted to try the cppcheck plugin, I have setup the following sample pipeline:
```
pipeline {
    agent any

    stages {
        stage('analysis') {
            steps {
                script{
                    bat'cppcheck "E:/Source" --force — enable=all — inconclusive — xml — xml-version=2 . 2 > cppcheck.xml'
                }
            }
        }
    }
    post {
        always {
            // scanForIssues tool: cppCheck(pattern: 'cppcheck.xml')
            publishCppcheck pattern:'cppcheck.xml'
        }
    }
}
```

But I get an error in the post step which I do not know if it is related to my projecto or if I am doing something wrong. I have follow the instructions on this thread [cppcheck][1]but it does not seem to work, wehther I use ```publushCppcheck``` :
```
[Pipeline] { (Declarative: Post Actions)
[Pipeline] publishCppcheck (hide)
[Cppcheck] Starting the cppcheck analysis.
[Cppcheck] Processing 1 files with the pattern 'cppcheck.xml'.
[Cppcheck] Parsing throws exceptions. javax.xml.bind.UnmarshalException
 - with linked exception:
[org.xml.sax.SAXParseException; systemId: file:/C:/Users/anton/.jenkins/workspace/JOB4/cppcheck.xml; lineNumber: 1; columnNumber: 1; El contenido no está permitido en el prólogo.]
[Cppcheck] java.io.IOException: javax.xml.bind.UnmarshalException
 - with linked exception:
[org.xml.sax.SAXParseException; systemId: file:/C:/Users/anton/.jenkins/workspace/JOB4/cppcheck.xml; lineNumber: 1; columnNumber: 1; El contenido no está permitido en el prólogo.]
at org.jenkinsci.plugins.cppcheck.parser.CppcheckParser.parse(CppcheckParser.java:67)
at org.jenkinsci.plugins.cppcheck.CppcheckParserResult.invoke(CppcheckParserResult.java:69)
at org.jenkinsci.plugins.cppcheck.CppcheckParserResult.invoke(CppcheckParserResult.java:24)
at hudson.FilePath.act(FilePath.java:1164)
at hudson.FilePath.act(FilePath.java:1147)
at org.jenkinsci.plugins.cppcheck.CppcheckPublisher.perform(CppcheckPublisher.java:337)
at jenkins.tasks.SimpleBuildStep.perform(SimpleBuildStep.java:123)
at org.jenkinsci.plugins.workflow.steps.CoreStep$Execution.run(CoreStep.java:99)
at org.jenkinsci.plugins.workflow.steps.CoreStep$Execution.run(CoreStep.java:69)
at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: javax.xml.bind.UnmarshalException
```

or ```scanforIssues``` from warnings ng plugin::
```
[Pipeline] { (Declarative: Post Actions)
[Pipeline] scanForIssues
[CPPCheck] [-ERROR-] Parsing of file 'C:\Users\anton\.jenkins\workspace\JOB4\cppcheck.xml' failed due to an exception:
[CPPCheck] [-ERROR-] com.ctc.wstx.exc.WstxUnexpectedCharException: Unexpected character 'C' (code 67) in prolog; expected '<'
 at [row,col {unknown-source}]: [1,1]
[CPPCheck] [-ERROR-]  at [row,col {unknown-source}]: [1,1]
[CPPCheck] [-ERROR-]  at com.ctc.wstx.sr.StreamScanner.throwUnexpectedChar(StreamScanner.java:648)
[CPPCheck] [-ERROR-]  at com.ctc.wstx.sr.BasicStreamReader.nextFromProlog(BasicStreamReader.java:2047)
[CPPCheck] [-ERROR-]  at com.ctc.wstx.sr.BasicStreamReader.next(BasicStreamReader.java:1069)
[CPPCheck] [-ERROR-]  at se.bjurr.violations.lib.parsers.CPPCheckParser.parseReportOutput(CPPCheckParser.java:43)
[CPPCheck] [-ERROR-]  at edu.hm.hafner.analysis.parser.violations.AbstractViolationAdapter.parse(AbstractViolationAdapter.java:35)
[CPPCheck] [-ERROR-]  at io.jenkins.plugins.analysis.core.model.FilesScanner.aggregateIssuesOfFile(FilesScanner.java:105)
[CPPCheck] [-ERROR-]  at io.jenkins.plugins.analysis.core.model.FilesScanner.scanFiles(FilesScanner.java:89)
[CPPCheck] [-ERROR-]  at io.jenkins.plugins.analysis.core.model.FilesScanner.invoke(FilesScanner.java:72)
[CPPCheck] [-ERROR-]  at io.jenkins.plugins.analysis.core.model.FilesScanner.invoke(FilesScanner.java:30)
[CPPCheck] [-ERROR-]  at hudson.FilePath.act(FilePath.java:1164)
[CPPCheck] [-ERROR-]  at hudson.FilePath.act(FilePath.java:1147)
[CPPCheck] [-ERROR-]  at io.jenkins.plugins.analysis.core.model.ReportScanningTool.scanInWorkspace(ReportScanningTool.java:152)
[CPPCheck] [-ERROR-]  at io.jenkins.plugins.analysis.core.model.ReportScanningTool.scan(ReportScanningTool.java:134)
[CPPCheck] [-ERROR-]  at io.jenkins.plugins.analysis.core.steps.IssuesScanner.scan(IssuesScanner.java:95)
[CPPCheck] [-ERROR-]  at io.jenkins.plugins.analysis.core.steps.ScanForIssuesStep$Execution.run(ScanForIssuesStep.java:214)
[CPPCheck] [-ERROR-]  at io.jenkins.plugins.analysis.core.steps.ScanForIssuesStep$Execution.run(ScanForIssuesStep.java:175)
[CPPCheck] [-ERROR-]  at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47)
[CPPCheck] [-ERROR-]  at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
[CPPCheck] [-ERROR-]  at java.util.concurrent.FutureTask.run(Unknown Source)
[CPPCheck] [-ERROR-]  at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
[CPPCheck] [-ERROR-]  at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
[CPPCheck] [-ERROR-]  at java.lang.Thread.run(Unknown Source)
[CPPCheck] [-ERROR-]  [wrapped] edu.hm.hafner.analysis.ParsingException: Exception occurred during parsing
WstxUnexpectedCharException: Unexpected character 'C' (code 67) in prolog; expected '<'
 at [row,col {unknown-source}]: [1,1]
com.ctc.wstx.exc.WstxUnexpectedCharException: Unexpected character 'C' (code 67) in prolog; expected '<'
 at [row,col {unknown-source}]: [1,1]
at com.ctc.wstx.sr.StreamScanner.throwUnexpectedChar(StreamScanner.java:648)
at com.ctc.wstx.sr.BasicStreamReader.nextFromProlog(BasicStreamReader.java:2047)
at com.ctc.wstx.sr.BasicStreamReader.next(BasicStreamReader.java:1069)
at se.bjurr.violations.lib.parsers.CPPCheckParser.parseReportOutput(CPPCheckParser.java:43)
at edu.hm.hafner.analysis.parser.violations.AbstractViolationAdapter.parse(AbstractViolationAdapter.java:35)
at io.jenkins.plugins.analysis.core.model.FilesScanner.aggregateIssuesOfFile(FilesScanner.java:105)
at io.jenkins.plugins.analysis.core.model.FilesScanner.scanFiles(FilesScanner.java:89)
at io.jenkins.plugins.analysis.core.model.FilesScanner.invoke(FilesScanner.java:72)
at io.jenkins.plugins.analysis.core.model.FilesScanner.invoke(FilesScanner.java:30)
at hudson.FilePath.act(FilePath.java:1164)
at hudson.FilePath.act(FilePath.java:1147)
at io.jenkins.plugins.analysis.core.model.ReportScanningTool.scanInWorkspace(ReportScanningTool.java:152)
at io.jenkins.plugins.analysis.core.model.ReportScanningTool.scan(ReportScanningTool.java:134)
at io.jenkins.plugins.analysis.core.steps.IssuesScanner.scan(IssuesScanner.java:95)
at io.jenkins.plugins.analysis.core.steps.ScanForIssuesStep$Execution.run(ScanForIssuesStep.java:214)
at io.jenkins.plugins.analysis.core.steps.ScanForIssuesStep$Execution.run(ScanForIssuesStep.java:175)
at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
```



--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/eefe0887-c933-4541-aab3-1f286c04b371n%40googlegroups.com.


--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-use...@....

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/1cfaf8d9-b011-4249-9540-168f075d4049n%40googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/D3E8E74A-66FA-468D-9A80-5B9C18A1022E%40gmail.com.
Reply | Threaded
Open this post in threaded view
|

Re: How to publish cppcheck results in a pipeline?

jesus fernandez
the supposely .xml does not have any format, these are the first 5 lines:
Checking E:\Source\Game\AchievementManager.cpp ...
Checking E:\Source\Game\AchievementManager.cpp: APP_STEAM;FINAL_RELEASE;_DEBUG...
Checking E:\Source\Game\AchievementManager.cpp: APP_STEAM;NEED_AOE1DE_ACHIEVEMENT_TEST;_DEBUG...
Checking E:\Source\Game\AchievementManager.cpp: APP_STEAM;NEED_AOE3DE_ACHIEVEMENT_TEST;_DEBUG...
Checking E:\Source\Game\AchievementManager.cpp: APP_STEAM;_DEBUG...

El jueves, 25 de marzo de 2021 a las 19:47:22 UTC+1, [hidden email] escribió:
If you can’t check on your own if the file contains valid XML can you please show the first 5 lines of the XML file here?

Am 25.03.2021 um 19:36 schrieb jesus fernandez <[hidden email]>:

I thought the  ```bat'cppcheck "E:/Source" --force — enable=all — inconclusive — xml — xml-version=2 . 2 > cppcheck.xml'``` command does genearate a valid xml. is it a matter of missing parameters or a matter of having to parse the output? in the documentation and the SO link I attached it is supposed to be done like that... what am I missing here?

El jueves, 25 de marzo de 2021 a las 18:21:38 UTC+1, ullrich...@gmail.com escribió:
The exception says it is not a valid XML file. Is it a valid XML file? Seems that there is content before the fir XML tag. Can you open it in an editor that can validate the XML?

Am 25.03.2021 um 17:57 schrieb jesus fernandez <[hidden email]>:

Thanks for replying, I have opened and it has 2000 lines of code but I do not know if it is valid or not as I have never used cppcheck before, and if it is not valid is it because I am not using the right parameters when calling cppcheck or how?



El jueves, 25 de marzo de 2021 a las 17:44:44 UTC+1, ullrich...@gmail.com escribió:
It look like your create XML is not valid. Can you please open the XML file and check? 

Am 25.03.2021 um 17:40 schrieb jesus fernandez <[hidden email]>:

I am learning about Jenkins on my own, and I wanted to try the cppcheck plugin, I have setup the following sample pipeline:
```
pipeline {
    agent any

    stages {
        stage('analysis') {
            steps {
                script{
                    bat'cppcheck "E:/Source" --force — enable=all — inconclusive — xml — xml-version=2 . 2 > cppcheck.xml'
                }
            }
        }
    }
    post {
        always {
            // scanForIssues tool: cppCheck(pattern: 'cppcheck.xml')
            publishCppcheck pattern:'cppcheck.xml'
        }
    }
}
```

But I get an error in the post step which I do not know if it is related to my projecto or if I am doing something wrong. I have follow the instructions on this thread [cppcheck][1]but it does not seem to work, wehther I use ```publushCppcheck``` :
```
[Pipeline] { (Declarative: Post Actions)
[Pipeline] publishCppcheck (hide)
[Cppcheck] Starting the cppcheck analysis.
[Cppcheck] Processing 1 files with the pattern 'cppcheck.xml'.
[Cppcheck] Parsing throws exceptions. javax.xml.bind.UnmarshalException
 - with linked exception:
[org.xml.sax.SAXParseException; systemId: file:/C:/Users/anton/.jenkins/workspace/JOB4/cppcheck.xml; lineNumber: 1; columnNumber: 1; El contenido no está permitido en el prólogo.]
[Cppcheck] java.io.IOException: javax.xml.bind.UnmarshalException
 - with linked exception:
[org.xml.sax.SAXParseException; systemId: file:/C:/Users/anton/.jenkins/workspace/JOB4/cppcheck.xml; lineNumber: 1; columnNumber: 1; El contenido no está permitido en el prólogo.]
at org.jenkinsci.plugins.cppcheck.parser.CppcheckParser.parse(CppcheckParser.java:67)
at org.jenkinsci.plugins.cppcheck.CppcheckParserResult.invoke(CppcheckParserResult.java:69)
at org.jenkinsci.plugins.cppcheck.CppcheckParserResult.invoke(CppcheckParserResult.java:24)
at hudson.FilePath.act(FilePath.java:1164)
at hudson.FilePath.act(FilePath.java:1147)
at org.jenkinsci.plugins.cppcheck.CppcheckPublisher.perform(CppcheckPublisher.java:337)
at jenkins.tasks.SimpleBuildStep.perform(SimpleBuildStep.java:123)
at org.jenkinsci.plugins.workflow.steps.CoreStep$Execution.run(CoreStep.java:99)
at org.jenkinsci.plugins.workflow.steps.CoreStep$Execution.run(CoreStep.java:69)
at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: javax.xml.bind.UnmarshalException
```

or ```scanforIssues``` from warnings ng plugin::
```
[Pipeline] { (Declarative: Post Actions)
[Pipeline] scanForIssues
[CPPCheck] [-ERROR-] Parsing of file 'C:\Users\anton\.jenkins\workspace\JOB4\cppcheck.xml' failed due to an exception:
[CPPCheck] [-ERROR-] com.ctc.wstx.exc.WstxUnexpectedCharException: Unexpected character 'C' (code 67) in prolog; expected '<'
 at [row,col {unknown-source}]: [1,1]
[CPPCheck] [-ERROR-]  at [row,col {unknown-source}]: [1,1]
[CPPCheck] [-ERROR-]  at com.ctc.wstx.sr.StreamScanner.throwUnexpectedChar(StreamScanner.java:648)
[CPPCheck] [-ERROR-]  at com.ctc.wstx.sr.BasicStreamReader.nextFromProlog(BasicStreamReader.java:2047)
[CPPCheck] [-ERROR-]  at com.ctc.wstx.sr.BasicStreamReader.next(BasicStreamReader.java:1069)
[CPPCheck] [-ERROR-]  at se.bjurr.violations.lib.parsers.CPPCheckParser.parseReportOutput(CPPCheckParser.java:43)
[CPPCheck] [-ERROR-]  at edu.hm.hafner.analysis.parser.violations.AbstractViolationAdapter.parse(AbstractViolationAdapter.java:35)
[CPPCheck] [-ERROR-]  at io.jenkins.plugins.analysis.core.model.FilesScanner.aggregateIssuesOfFile(FilesScanner.java:105)
[CPPCheck] [-ERROR-]  at io.jenkins.plugins.analysis.core.model.FilesScanner.scanFiles(FilesScanner.java:89)
[CPPCheck] [-ERROR-]  at io.jenkins.plugins.analysis.core.model.FilesScanner.invoke(FilesScanner.java:72)
[CPPCheck] [-ERROR-]  at io.jenkins.plugins.analysis.core.model.FilesScanner.invoke(FilesScanner.java:30)
[CPPCheck] [-ERROR-]  at hudson.FilePath.act(FilePath.java:1164)
[CPPCheck] [-ERROR-]  at hudson.FilePath.act(FilePath.java:1147)
[CPPCheck] [-ERROR-]  at io.jenkins.plugins.analysis.core.model.ReportScanningTool.scanInWorkspace(ReportScanningTool.java:152)
[CPPCheck] [-ERROR-]  at io.jenkins.plugins.analysis.core.model.ReportScanningTool.scan(ReportScanningTool.java:134)
[CPPCheck] [-ERROR-]  at io.jenkins.plugins.analysis.core.steps.IssuesScanner.scan(IssuesScanner.java:95)
[CPPCheck] [-ERROR-]  at io.jenkins.plugins.analysis.core.steps.ScanForIssuesStep$Execution.run(ScanForIssuesStep.java:214)
[CPPCheck] [-ERROR-]  at io.jenkins.plugins.analysis.core.steps.ScanForIssuesStep$Execution.run(ScanForIssuesStep.java:175)
[CPPCheck] [-ERROR-]  at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47)
[CPPCheck] [-ERROR-]  at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
[CPPCheck] [-ERROR-]  at java.util.concurrent.FutureTask.run(Unknown Source)
[CPPCheck] [-ERROR-]  at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
[CPPCheck] [-ERROR-]  at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
[CPPCheck] [-ERROR-]  at java.lang.Thread.run(Unknown Source)
[CPPCheck] [-ERROR-]  [wrapped] edu.hm.hafner.analysis.ParsingException: Exception occurred during parsing
WstxUnexpectedCharException: Unexpected character 'C' (code 67) in prolog; expected '<'
 at [row,col {unknown-source}]: [1,1]
com.ctc.wstx.exc.WstxUnexpectedCharException: Unexpected character 'C' (code 67) in prolog; expected '<'
 at [row,col {unknown-source}]: [1,1]
at com.ctc.wstx.sr.StreamScanner.throwUnexpectedChar(StreamScanner.java:648)
at com.ctc.wstx.sr.BasicStreamReader.nextFromProlog(BasicStreamReader.java:2047)
at com.ctc.wstx.sr.BasicStreamReader.next(BasicStreamReader.java:1069)
at se.bjurr.violations.lib.parsers.CPPCheckParser.parseReportOutput(CPPCheckParser.java:43)
at edu.hm.hafner.analysis.parser.violations.AbstractViolationAdapter.parse(AbstractViolationAdapter.java:35)
at io.jenkins.plugins.analysis.core.model.FilesScanner.aggregateIssuesOfFile(FilesScanner.java:105)
at io.jenkins.plugins.analysis.core.model.FilesScanner.scanFiles(FilesScanner.java:89)
at io.jenkins.plugins.analysis.core.model.FilesScanner.invoke(FilesScanner.java:72)
at io.jenkins.plugins.analysis.core.model.FilesScanner.invoke(FilesScanner.java:30)
at hudson.FilePath.act(FilePath.java:1164)
at hudson.FilePath.act(FilePath.java:1147)
at io.jenkins.plugins.analysis.core.model.ReportScanningTool.scanInWorkspace(ReportScanningTool.java:152)
at io.jenkins.plugins.analysis.core.model.ReportScanningTool.scan(ReportScanningTool.java:134)
at io.jenkins.plugins.analysis.core.steps.IssuesScanner.scan(IssuesScanner.java:95)
at io.jenkins.plugins.analysis.core.steps.ScanForIssuesStep$Execution.run(ScanForIssuesStep.java:214)
at io.jenkins.plugins.analysis.core.steps.ScanForIssuesStep$Execution.run(ScanForIssuesStep.java:175)
at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
```



--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/eefe0887-c933-4541-aab3-1f286c04b371n%40googlegroups.com.


--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/25ed29da-fab4-4796-b4e3-d14503e83dabn%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: How to publish cppcheck results in a pipeline?

jesus fernandez
so it seems like if it basically is writting all the outputs the cmd throws

El jueves, 25 de marzo de 2021 a las 20:07:20 UTC+1, jesus fernandez escribió:
the supposely .xml does not have any format, these are the first 5 lines:
Checking E:\Source\Game\AchievementManager.cpp ...
Checking E:\Source\Game\AchievementManager.cpp: APP_STEAM;FINAL_RELEASE;_DEBUG...
Checking E:\Source\Game\AchievementManager.cpp: APP_STEAM;NEED_AOE1DE_ACHIEVEMENT_TEST;_DEBUG...
Checking E:\Source\Game\AchievementManager.cpp: APP_STEAM;NEED_AOE3DE_ACHIEVEMENT_TEST;_DEBUG...
Checking E:\Source\Game\AchievementManager.cpp: APP_STEAM;_DEBUG...

El jueves, 25 de marzo de 2021 a las 19:47:22 UTC+1, [hidden email] escribió:
If you can’t check on your own if the file contains valid XML can you please show the first 5 lines of the XML file here?

Am 25.03.2021 um 19:36 schrieb jesus fernandez <[hidden email]>:

I thought the  ```bat'cppcheck "E:/Source" --force — enable=all — inconclusive — xml — xml-version=2 . 2 > cppcheck.xml'``` command does genearate a valid xml. is it a matter of missing parameters or a matter of having to parse the output? in the documentation and the SO link I attached it is supposed to be done like that... what am I missing here?

El jueves, 25 de marzo de 2021 a las 18:21:38 UTC+1, ullrich...@gmail.com escribió:
The exception says it is not a valid XML file. Is it a valid XML file? Seems that there is content before the fir XML tag. Can you open it in an editor that can validate the XML?

Am 25.03.2021 um 17:57 schrieb jesus fernandez <[hidden email]>:

Thanks for replying, I have opened and it has 2000 lines of code but I do not know if it is valid or not as I have never used cppcheck before, and if it is not valid is it because I am not using the right parameters when calling cppcheck or how?



El jueves, 25 de marzo de 2021 a las 17:44:44 UTC+1, ullrich...@gmail.com escribió:
It look like your create XML is not valid. Can you please open the XML file and check? 

Am 25.03.2021 um 17:40 schrieb jesus fernandez <[hidden email]>:

I am learning about Jenkins on my own, and I wanted to try the cppcheck plugin, I have setup the following sample pipeline:
```
pipeline {
    agent any

    stages {
        stage('analysis') {
            steps {
                script{
                    bat'cppcheck "E:/Source" --force — enable=all — inconclusive — xml — xml-version=2 . 2 > cppcheck.xml'
                }
            }
        }
    }
    post {
        always {
            // scanForIssues tool: cppCheck(pattern: 'cppcheck.xml')
            publishCppcheck pattern:'cppcheck.xml'
        }
    }
}
```

But I get an error in the post step which I do not know if it is related to my projecto or if I am doing something wrong. I have follow the instructions on this thread [cppcheck][1]but it does not seem to work, wehther I use ```publushCppcheck``` :
```
[Pipeline] { (Declarative: Post Actions)
[Pipeline] publishCppcheck (hide)
[Cppcheck] Starting the cppcheck analysis.
[Cppcheck] Processing 1 files with the pattern 'cppcheck.xml'.
[Cppcheck] Parsing throws exceptions. javax.xml.bind.UnmarshalException
 - with linked exception:
[org.xml.sax.SAXParseException; systemId: file:/C:/Users/anton/.jenkins/workspace/JOB4/cppcheck.xml; lineNumber: 1; columnNumber: 1; El contenido no está permitido en el prólogo.]
[Cppcheck] java.io.IOException: javax.xml.bind.UnmarshalException
 - with linked exception:
[org.xml.sax.SAXParseException; systemId: file:/C:/Users/anton/.jenkins/workspace/JOB4/cppcheck.xml; lineNumber: 1; columnNumber: 1; El contenido no está permitido en el prólogo.]
at org.jenkinsci.plugins.cppcheck.parser.CppcheckParser.parse(CppcheckParser.java:67)
at org.jenkinsci.plugins.cppcheck.CppcheckParserResult.invoke(CppcheckParserResult.java:69)
at org.jenkinsci.plugins.cppcheck.CppcheckParserResult.invoke(CppcheckParserResult.java:24)
at hudson.FilePath.act(FilePath.java:1164)
at hudson.FilePath.act(FilePath.java:1147)
at org.jenkinsci.plugins.cppcheck.CppcheckPublisher.perform(CppcheckPublisher.java:337)
at jenkins.tasks.SimpleBuildStep.perform(SimpleBuildStep.java:123)
at org.jenkinsci.plugins.workflow.steps.CoreStep$Execution.run(CoreStep.java:99)
at org.jenkinsci.plugins.workflow.steps.CoreStep$Execution.run(CoreStep.java:69)
at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: javax.xml.bind.UnmarshalException
```

or ```scanforIssues``` from warnings ng plugin::
```
[Pipeline] { (Declarative: Post Actions)
[Pipeline] scanForIssues
[CPPCheck] [-ERROR-] Parsing of file 'C:\Users\anton\.jenkins\workspace\JOB4\cppcheck.xml' failed due to an exception:
[CPPCheck] [-ERROR-] com.ctc.wstx.exc.WstxUnexpectedCharException: Unexpected character 'C' (code 67) in prolog; expected '<'
 at [row,col {unknown-source}]: [1,1]
[CPPCheck] [-ERROR-]  at [row,col {unknown-source}]: [1,1]
[CPPCheck] [-ERROR-]  at com.ctc.wstx.sr.StreamScanner.throwUnexpectedChar(StreamScanner.java:648)
[CPPCheck] [-ERROR-]  at com.ctc.wstx.sr.BasicStreamReader.nextFromProlog(BasicStreamReader.java:2047)
[CPPCheck] [-ERROR-]  at com.ctc.wstx.sr.BasicStreamReader.next(BasicStreamReader.java:1069)
[CPPCheck] [-ERROR-]  at se.bjurr.violations.lib.parsers.CPPCheckParser.parseReportOutput(CPPCheckParser.java:43)
[CPPCheck] [-ERROR-]  at edu.hm.hafner.analysis.parser.violations.AbstractViolationAdapter.parse(AbstractViolationAdapter.java:35)
[CPPCheck] [-ERROR-]  at io.jenkins.plugins.analysis.core.model.FilesScanner.aggregateIssuesOfFile(FilesScanner.java:105)
[CPPCheck] [-ERROR-]  at io.jenkins.plugins.analysis.core.model.FilesScanner.scanFiles(FilesScanner.java:89)
[CPPCheck] [-ERROR-]  at io.jenkins.plugins.analysis.core.model.FilesScanner.invoke(FilesScanner.java:72)
[CPPCheck] [-ERROR-]  at io.jenkins.plugins.analysis.core.model.FilesScanner.invoke(FilesScanner.java:30)
[CPPCheck] [-ERROR-]  at hudson.FilePath.act(FilePath.java:1164)
[CPPCheck] [-ERROR-]  at hudson.FilePath.act(FilePath.java:1147)
[CPPCheck] [-ERROR-]  at io.jenkins.plugins.analysis.core.model.ReportScanningTool.scanInWorkspace(ReportScanningTool.java:152)
[CPPCheck] [-ERROR-]  at io.jenkins.plugins.analysis.core.model.ReportScanningTool.scan(ReportScanningTool.java:134)
[CPPCheck] [-ERROR-]  at io.jenkins.plugins.analysis.core.steps.IssuesScanner.scan(IssuesScanner.java:95)
[CPPCheck] [-ERROR-]  at io.jenkins.plugins.analysis.core.steps.ScanForIssuesStep$Execution.run(ScanForIssuesStep.java:214)
[CPPCheck] [-ERROR-]  at io.jenkins.plugins.analysis.core.steps.ScanForIssuesStep$Execution.run(ScanForIssuesStep.java:175)
[CPPCheck] [-ERROR-]  at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47)
[CPPCheck] [-ERROR-]  at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
[CPPCheck] [-ERROR-]  at java.util.concurrent.FutureTask.run(Unknown Source)
[CPPCheck] [-ERROR-]  at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
[CPPCheck] [-ERROR-]  at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
[CPPCheck] [-ERROR-]  at java.lang.Thread.run(Unknown Source)
[CPPCheck] [-ERROR-]  [wrapped] edu.hm.hafner.analysis.ParsingException: Exception occurred during parsing
WstxUnexpectedCharException: Unexpected character 'C' (code 67) in prolog; expected '<'
 at [row,col {unknown-source}]: [1,1]
com.ctc.wstx.exc.WstxUnexpectedCharException: Unexpected character 'C' (code 67) in prolog; expected '<'
 at [row,col {unknown-source}]: [1,1]
at com.ctc.wstx.sr.StreamScanner.throwUnexpectedChar(StreamScanner.java:648)
at com.ctc.wstx.sr.BasicStreamReader.nextFromProlog(BasicStreamReader.java:2047)
at com.ctc.wstx.sr.BasicStreamReader.next(BasicStreamReader.java:1069)
at se.bjurr.violations.lib.parsers.CPPCheckParser.parseReportOutput(CPPCheckParser.java:43)
at edu.hm.hafner.analysis.parser.violations.AbstractViolationAdapter.parse(AbstractViolationAdapter.java:35)
at io.jenkins.plugins.analysis.core.model.FilesScanner.aggregateIssuesOfFile(FilesScanner.java:105)
at io.jenkins.plugins.analysis.core.model.FilesScanner.scanFiles(FilesScanner.java:89)
at io.jenkins.plugins.analysis.core.model.FilesScanner.invoke(FilesScanner.java:72)
at io.jenkins.plugins.analysis.core.model.FilesScanner.invoke(FilesScanner.java:30)
at hudson.FilePath.act(FilePath.java:1164)
at hudson.FilePath.act(FilePath.java:1147)
at io.jenkins.plugins.analysis.core.model.ReportScanningTool.scanInWorkspace(ReportScanningTool.java:152)
at io.jenkins.plugins.analysis.core.model.ReportScanningTool.scan(ReportScanningTool.java:134)
at io.jenkins.plugins.analysis.core.steps.IssuesScanner.scan(IssuesScanner.java:95)
at io.jenkins.plugins.analysis.core.steps.ScanForIssuesStep$Execution.run(ScanForIssuesStep.java:214)
at io.jenkins.plugins.analysis.core.steps.ScanForIssuesStep$Execution.run(ScanForIssuesStep.java:175)
at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
```



--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/eefe0887-c933-4541-aab3-1f286c04b371n%40googlegroups.com.


--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/d268e9b6-727c-4697-87e1-a9df64781a60n%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: How to publish cppcheck results in a pipeline?

Ulli Hafner
Yes, this is definitely not XML :-)
This is the stderr of your program! 

2 > cppcheck.xml pipes your stderr to a file. You do not need this part. 

Am 25.03.2021 um 20:08 schrieb jesus fernandez <[hidden email]>:

so it seems like if it basically is writting all the outputs the cmd throws

El jueves, 25 de marzo de 2021 a las 20:07:20 UTC+1, jesus fernandez escribió:
the supposely .xml does not have any format, these are the first 5 lines:
Checking E:\Source\Game\AchievementManager.cpp ...
Checking E:\Source\Game\AchievementManager.cpp: APP_STEAM;FINAL_RELEASE;_DEBUG...
Checking E:\Source\Game\AchievementManager.cpp: APP_STEAM;NEED_AOE1DE_ACHIEVEMENT_TEST;_DEBUG...
Checking E:\Source\Game\AchievementManager.cpp: APP_STEAM;NEED_AOE3DE_ACHIEVEMENT_TEST;_DEBUG...
Checking E:\Source\Game\AchievementManager.cpp: APP_STEAM;_DEBUG...

El jueves, 25 de marzo de 2021 a las 19:47:22 UTC+1, ullrich...@... escribió:
If you can’t check on your own if the file contains valid XML can you please show the first 5 lines of the XML file here?

Am 25.03.2021 um 19:36 schrieb jesus fernandez <[hidden email]>:

I thought the  ```bat'cppcheck "E:/Source" --force — enable=all — inconclusive — xml — xml-version=2 . 2 > cppcheck.xml'``` command does genearate a valid xml. is it a matter of missing parameters or a matter of having to parse the output? in the documentation and the SO link I attached it is supposed to be done like that... what am I missing here?

El jueves, 25 de marzo de 2021 a las 18:21:38 UTC+1, ullrich...@gmail.com escribió:
The exception says it is not a valid XML file. Is it a valid XML file? Seems that there is content before the fir XML tag. Can you open it in an editor that can validate the XML?

Am 25.03.2021 um 17:57 schrieb jesus fernandez <[hidden email]>:

Thanks for replying, I have opened and it has 2000 lines of code but I do not know if it is valid or not as I have never used cppcheck before, and if it is not valid is it because I am not using the right parameters when calling cppcheck or how?



El jueves, 25 de marzo de 2021 a las 17:44:44 UTC+1, ullrich...@gmail.com escribió:
It look like your create XML is not valid. Can you please open the XML file and check? 

Am 25.03.2021 um 17:40 schrieb jesus fernandez <[hidden email]>:

I am learning about Jenkins on my own, and I wanted to try the cppcheck plugin, I have setup the following sample pipeline:
```
pipeline {
    agent any

    stages {
        stage('analysis') {
            steps {
                script{
                    bat'cppcheck "E:/Source" --force — enable=all — inconclusive — xml — xml-version=2 . 2 > cppcheck.xml'
                }
            }
        }
    }
    post {
        always {
            // scanForIssues tool: cppCheck(pattern: 'cppcheck.xml')
            publishCppcheck pattern:'cppcheck.xml'
        }
    }
}
```

But I get an error in the post step which I do not know if it is related to my projecto or if I am doing something wrong. I have follow the instructions on this thread [cppcheck][1]but it does not seem to work, wehther I use ```publushCppcheck``` :
```
[Pipeline] { (Declarative: Post Actions)
[Pipeline] publishCppcheck (hide)
[Cppcheck] Starting the cppcheck analysis.
[Cppcheck] Processing 1 files with the pattern 'cppcheck.xml'.
[Cppcheck] Parsing throws exceptions. javax.xml.bind.UnmarshalException
 - with linked exception:
[org.xml.sax.SAXParseException; systemId: file:/C:/Users/anton/.jenkins/workspace/JOB4/cppcheck.xml; lineNumber: 1; columnNumber: 1; El contenido no está permitido en el prólogo.]
[Cppcheck] java.io.IOException: javax.xml.bind.UnmarshalException
 - with linked exception:
[org.xml.sax.SAXParseException; systemId: file:/C:/Users/anton/.jenkins/workspace/JOB4/cppcheck.xml; lineNumber: 1; columnNumber: 1; El contenido no está permitido en el prólogo.]
at org.jenkinsci.plugins.cppcheck.parser.CppcheckParser.parse(CppcheckParser.java:67)
at org.jenkinsci.plugins.cppcheck.CppcheckParserResult.invoke(CppcheckParserResult.java:69)
at org.jenkinsci.plugins.cppcheck.CppcheckParserResult.invoke(CppcheckParserResult.java:24)
at hudson.FilePath.act(FilePath.java:1164)
at hudson.FilePath.act(FilePath.java:1147)
at org.jenkinsci.plugins.cppcheck.CppcheckPublisher.perform(CppcheckPublisher.java:337)
at jenkins.tasks.SimpleBuildStep.perform(SimpleBuildStep.java:123)
at org.jenkinsci.plugins.workflow.steps.CoreStep$Execution.run(CoreStep.java:99)
at org.jenkinsci.plugins.workflow.steps.CoreStep$Execution.run(CoreStep.java:69)
at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: javax.xml.bind.UnmarshalException
```

or ```scanforIssues``` from warnings ng plugin::
```
[Pipeline] { (Declarative: Post Actions)
[Pipeline] scanForIssues
[CPPCheck] [-ERROR-] Parsing of file 'C:\Users\anton\.jenkins\workspace\JOB4\cppcheck.xml' failed due to an exception:
[CPPCheck] [-ERROR-] com.ctc.wstx.exc.WstxUnexpectedCharException: Unexpected character 'C' (code 67) in prolog; expected '<'
 at [row,col {unknown-source}]: [1,1]
[CPPCheck] [-ERROR-]  at [row,col {unknown-source}]: [1,1]
[CPPCheck] [-ERROR-]  at com.ctc.wstx.sr.StreamScanner.throwUnexpectedChar(StreamScanner.java:648)
[CPPCheck] [-ERROR-]  at com.ctc.wstx.sr.BasicStreamReader.nextFromProlog(BasicStreamReader.java:2047)
[CPPCheck] [-ERROR-]  at com.ctc.wstx.sr.BasicStreamReader.next(BasicStreamReader.java:1069)
[CPPCheck] [-ERROR-]  at se.bjurr.violations.lib.parsers.CPPCheckParser.parseReportOutput(CPPCheckParser.java:43)
[CPPCheck] [-ERROR-]  at edu.hm.hafner.analysis.parser.violations.AbstractViolationAdapter.parse(AbstractViolationAdapter.java:35)
[CPPCheck] [-ERROR-]  at io.jenkins.plugins.analysis.core.model.FilesScanner.aggregateIssuesOfFile(FilesScanner.java:105)
[CPPCheck] [-ERROR-]  at io.jenkins.plugins.analysis.core.model.FilesScanner.scanFiles(FilesScanner.java:89)
[CPPCheck] [-ERROR-]  at io.jenkins.plugins.analysis.core.model.FilesScanner.invoke(FilesScanner.java:72)
[CPPCheck] [-ERROR-]  at io.jenkins.plugins.analysis.core.model.FilesScanner.invoke(FilesScanner.java:30)
[CPPCheck] [-ERROR-]  at hudson.FilePath.act(FilePath.java:1164)
[CPPCheck] [-ERROR-]  at hudson.FilePath.act(FilePath.java:1147)
[CPPCheck] [-ERROR-]  at io.jenkins.plugins.analysis.core.model.ReportScanningTool.scanInWorkspace(ReportScanningTool.java:152)
[CPPCheck] [-ERROR-]  at io.jenkins.plugins.analysis.core.model.ReportScanningTool.scan(ReportScanningTool.java:134)
[CPPCheck] [-ERROR-]  at io.jenkins.plugins.analysis.core.steps.IssuesScanner.scan(IssuesScanner.java:95)
[CPPCheck] [-ERROR-]  at io.jenkins.plugins.analysis.core.steps.ScanForIssuesStep$Execution.run(ScanForIssuesStep.java:214)
[CPPCheck] [-ERROR-]  at io.jenkins.plugins.analysis.core.steps.ScanForIssuesStep$Execution.run(ScanForIssuesStep.java:175)
[CPPCheck] [-ERROR-]  at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47)
[CPPCheck] [-ERROR-]  at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
[CPPCheck] [-ERROR-]  at java.util.concurrent.FutureTask.run(Unknown Source)
[CPPCheck] [-ERROR-]  at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
[CPPCheck] [-ERROR-]  at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
[CPPCheck] [-ERROR-]  at java.lang.Thread.run(Unknown Source)
[CPPCheck] [-ERROR-]  [wrapped] edu.hm.hafner.analysis.ParsingException: Exception occurred during parsing
WstxUnexpectedCharException: Unexpected character 'C' (code 67) in prolog; expected '<'
 at [row,col {unknown-source}]: [1,1]
com.ctc.wstx.exc.WstxUnexpectedCharException: Unexpected character 'C' (code 67) in prolog; expected '<'
 at [row,col {unknown-source}]: [1,1]
at com.ctc.wstx.sr.StreamScanner.throwUnexpectedChar(StreamScanner.java:648)
at com.ctc.wstx.sr.BasicStreamReader.nextFromProlog(BasicStreamReader.java:2047)
at com.ctc.wstx.sr.BasicStreamReader.next(BasicStreamReader.java:1069)
at se.bjurr.violations.lib.parsers.CPPCheckParser.parseReportOutput(CPPCheckParser.java:43)
at edu.hm.hafner.analysis.parser.violations.AbstractViolationAdapter.parse(AbstractViolationAdapter.java:35)
at io.jenkins.plugins.analysis.core.model.FilesScanner.aggregateIssuesOfFile(FilesScanner.java:105)
at io.jenkins.plugins.analysis.core.model.FilesScanner.scanFiles(FilesScanner.java:89)
at io.jenkins.plugins.analysis.core.model.FilesScanner.invoke(FilesScanner.java:72)
at io.jenkins.plugins.analysis.core.model.FilesScanner.invoke(FilesScanner.java:30)
at hudson.FilePath.act(FilePath.java:1164)
at hudson.FilePath.act(FilePath.java:1147)
at io.jenkins.plugins.analysis.core.model.ReportScanningTool.scanInWorkspace(ReportScanningTool.java:152)
at io.jenkins.plugins.analysis.core.model.ReportScanningTool.scan(ReportScanningTool.java:134)
at io.jenkins.plugins.analysis.core.steps.IssuesScanner.scan(IssuesScanner.java:95)
at io.jenkins.plugins.analysis.core.steps.ScanForIssuesStep$Execution.run(ScanForIssuesStep.java:214)
at io.jenkins.plugins.analysis.core.steps.ScanForIssuesStep$Execution.run(ScanForIssuesStep.java:175)
at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
```



-- 
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/eefe0887-c933-4541-aab3-1f286c04b371n%40googlegroups.com.


-- 
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].

-- 
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].

-- 
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/d268e9b6-727c-4697-87e1-a9df64781a60n%40googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/1A4606FD-D46E-4DF8-97DF-DE6866D6509E%40gmail.com.
Reply | Threaded
Open this post in threaded view
|

Re: How to publish cppcheck results in a pipeline?

jesus fernandez
Thanks for the replies but how woud the command be then? something like this cppcheck "E:/Source" --force — enable=all — inconclusive — xml — xml-version=2 . > cppcheck.xm

El jueves, 25 de marzo de 2021 a las 21:49:15 UTC+1, [hidden email] escribió:
Yes, this is definitely not XML :-)
This is the stderr of your program! 

2 > cppcheck.xml pipes your stderr to a file. You do not need this part. 

Am 25.03.2021 um 20:08 schrieb jesus fernandez <[hidden email]>:

so it seems like if it basically is writting all the outputs the cmd throws

El jueves, 25 de marzo de 2021 a las 20:07:20 UTC+1, jesus fernandez escribió:
the supposely .xml does not have any format, these are the first 5 lines:
Checking E:\Source\Game\AchievementManager.cpp ...
Checking E:\Source\Game\AchievementManager.cpp: APP_STEAM;FINAL_RELEASE;_DEBUG...
Checking E:\Source\Game\AchievementManager.cpp: APP_STEAM;NEED_AOE1DE_ACHIEVEMENT_TEST;_DEBUG...
Checking E:\Source\Game\AchievementManager.cpp: APP_STEAM;NEED_AOE3DE_ACHIEVEMENT_TEST;_DEBUG...
Checking E:\Source\Game\AchievementManager.cpp: APP_STEAM;_DEBUG...

El jueves, 25 de marzo de 2021 a las 19:47:22 UTC+1, [hidden email] escribió:
If you can’t check on your own if the file contains valid XML can you please show the first 5 lines of the XML file here?

Am 25.03.2021 um 19:36 schrieb jesus fernandez <[hidden email]>:

I thought the  ```bat'cppcheck "E:/Source" --force — enable=all — inconclusive — xml — xml-version=2 . 2 > cppcheck.xml'``` command does genearate a valid xml. is it a matter of missing parameters or a matter of having to parse the output? in the documentation and the SO link I attached it is supposed to be done like that... what am I missing here?

El jueves, 25 de marzo de 2021 a las 18:21:38 UTC+1, ullrich...@gmail.com escribió:
The exception says it is not a valid XML file. Is it a valid XML file? Seems that there is content before the fir XML tag. Can you open it in an editor that can validate the XML?

Am 25.03.2021 um 17:57 schrieb jesus fernandez <[hidden email]>:

Thanks for replying, I have opened and it has 2000 lines of code but I do not know if it is valid or not as I have never used cppcheck before, and if it is not valid is it because I am not using the right parameters when calling cppcheck or how?



El jueves, 25 de marzo de 2021 a las 17:44:44 UTC+1, ullrich...@gmail.com escribió:
It look like your create XML is not valid. Can you please open the XML file and check? 

Am 25.03.2021 um 17:40 schrieb jesus fernandez <[hidden email]>:

I am learning about Jenkins on my own, and I wanted to try the cppcheck plugin, I have setup the following sample pipeline:
```
pipeline {
    agent any

    stages {
        stage('analysis') {
            steps {
                script{
                    bat'cppcheck "E:/Source" --force — enable=all — inconclusive — xml — xml-version=2 . 2 > cppcheck.xml'
                }
            }
        }
    }
    post {
        always {
            // scanForIssues tool: cppCheck(pattern: 'cppcheck.xml')
            publishCppcheck pattern:'cppcheck.xml'
        }
    }
}
```

But I get an error in the post step which I do not know if it is related to my projecto or if I am doing something wrong. I have follow the instructions on this thread [cppcheck][1]but it does not seem to work, wehther I use ```publushCppcheck``` :
```
[Pipeline] { (Declarative: Post Actions)
[Pipeline] publishCppcheck (hide)
[Cppcheck] Starting the cppcheck analysis.
[Cppcheck] Processing 1 files with the pattern 'cppcheck.xml'.
[Cppcheck] Parsing throws exceptions. javax.xml.bind.UnmarshalException
 - with linked exception:
[org.xml.sax.SAXParseException; systemId: file:/C:/Users/anton/.jenkins/workspace/JOB4/cppcheck.xml; lineNumber: 1; columnNumber: 1; El contenido no está permitido en el prólogo.]
[Cppcheck] java.io.IOException: javax.xml.bind.UnmarshalException
 - with linked exception:
[org.xml.sax.SAXParseException; systemId: file:/C:/Users/anton/.jenkins/workspace/JOB4/cppcheck.xml; lineNumber: 1; columnNumber: 1; El contenido no está permitido en el prólogo.]
at org.jenkinsci.plugins.cppcheck.parser.CppcheckParser.parse(CppcheckParser.java:67)
at org.jenkinsci.plugins.cppcheck.CppcheckParserResult.invoke(CppcheckParserResult.java:69)
at org.jenkinsci.plugins.cppcheck.CppcheckParserResult.invoke(CppcheckParserResult.java:24)
at hudson.FilePath.act(FilePath.java:1164)
at hudson.FilePath.act(FilePath.java:1147)
at org.jenkinsci.plugins.cppcheck.CppcheckPublisher.perform(CppcheckPublisher.java:337)
at jenkins.tasks.SimpleBuildStep.perform(SimpleBuildStep.java:123)
at org.jenkinsci.plugins.workflow.steps.CoreStep$Execution.run(CoreStep.java:99)
at org.jenkinsci.plugins.workflow.steps.CoreStep$Execution.run(CoreStep.java:69)
at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: javax.xml.bind.UnmarshalException
```

or ```scanforIssues``` from warnings ng plugin::
```
[Pipeline] { (Declarative: Post Actions)
[Pipeline] scanForIssues
[CPPCheck] [-ERROR-] Parsing of file 'C:\Users\anton\.jenkins\workspace\JOB4\cppcheck.xml' failed due to an exception:
[CPPCheck] [-ERROR-] com.ctc.wstx.exc.WstxUnexpectedCharException: Unexpected character 'C' (code 67) in prolog; expected '<'
 at [row,col {unknown-source}]: [1,1]
[CPPCheck] [-ERROR-]  at [row,col {unknown-source}]: [1,1]
[CPPCheck] [-ERROR-]  at com.ctc.wstx.sr.StreamScanner.throwUnexpectedChar(StreamScanner.java:648)
[CPPCheck] [-ERROR-]  at com.ctc.wstx.sr.BasicStreamReader.nextFromProlog(BasicStreamReader.java:2047)
[CPPCheck] [-ERROR-]  at com.ctc.wstx.sr.BasicStreamReader.next(BasicStreamReader.java:1069)
[CPPCheck] [-ERROR-]  at se.bjurr.violations.lib.parsers.CPPCheckParser.parseReportOutput(CPPCheckParser.java:43)
[CPPCheck] [-ERROR-]  at edu.hm.hafner.analysis.parser.violations.AbstractViolationAdapter.parse(AbstractViolationAdapter.java:35)
[CPPCheck] [-ERROR-]  at io.jenkins.plugins.analysis.core.model.FilesScanner.aggregateIssuesOfFile(FilesScanner.java:105)
[CPPCheck] [-ERROR-]  at io.jenkins.plugins.analysis.core.model.FilesScanner.scanFiles(FilesScanner.java:89)
[CPPCheck] [-ERROR-]  at io.jenkins.plugins.analysis.core.model.FilesScanner.invoke(FilesScanner.java:72)
[CPPCheck] [-ERROR-]  at io.jenkins.plugins.analysis.core.model.FilesScanner.invoke(FilesScanner.java:30)
[CPPCheck] [-ERROR-]  at hudson.FilePath.act(FilePath.java:1164)
[CPPCheck] [-ERROR-]  at hudson.FilePath.act(FilePath.java:1147)
[CPPCheck] [-ERROR-]  at io.jenkins.plugins.analysis.core.model.ReportScanningTool.scanInWorkspace(ReportScanningTool.java:152)
[CPPCheck] [-ERROR-]  at io.jenkins.plugins.analysis.core.model.ReportScanningTool.scan(ReportScanningTool.java:134)
[CPPCheck] [-ERROR-]  at io.jenkins.plugins.analysis.core.steps.IssuesScanner.scan(IssuesScanner.java:95)
[CPPCheck] [-ERROR-]  at io.jenkins.plugins.analysis.core.steps.ScanForIssuesStep$Execution.run(ScanForIssuesStep.java:214)
[CPPCheck] [-ERROR-]  at io.jenkins.plugins.analysis.core.steps.ScanForIssuesStep$Execution.run(ScanForIssuesStep.java:175)
[CPPCheck] [-ERROR-]  at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47)
[CPPCheck] [-ERROR-]  at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
[CPPCheck] [-ERROR-]  at java.util.concurrent.FutureTask.run(Unknown Source)
[CPPCheck] [-ERROR-]  at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
[CPPCheck] [-ERROR-]  at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
[CPPCheck] [-ERROR-]  at java.lang.Thread.run(Unknown Source)
[CPPCheck] [-ERROR-]  [wrapped] edu.hm.hafner.analysis.ParsingException: Exception occurred during parsing
WstxUnexpectedCharException: Unexpected character 'C' (code 67) in prolog; expected '<'
 at [row,col {unknown-source}]: [1,1]
com.ctc.wstx.exc.WstxUnexpectedCharException: Unexpected character 'C' (code 67) in prolog; expected '<'
 at [row,col {unknown-source}]: [1,1]
at com.ctc.wstx.sr.StreamScanner.throwUnexpectedChar(StreamScanner.java:648)
at com.ctc.wstx.sr.BasicStreamReader.nextFromProlog(BasicStreamReader.java:2047)
at com.ctc.wstx.sr.BasicStreamReader.next(BasicStreamReader.java:1069)
at se.bjurr.violations.lib.parsers.CPPCheckParser.parseReportOutput(CPPCheckParser.java:43)
at edu.hm.hafner.analysis.parser.violations.AbstractViolationAdapter.parse(AbstractViolationAdapter.java:35)
at io.jenkins.plugins.analysis.core.model.FilesScanner.aggregateIssuesOfFile(FilesScanner.java:105)
at io.jenkins.plugins.analysis.core.model.FilesScanner.scanFiles(FilesScanner.java:89)
at io.jenkins.plugins.analysis.core.model.FilesScanner.invoke(FilesScanner.java:72)
at io.jenkins.plugins.analysis.core.model.FilesScanner.invoke(FilesScanner.java:30)
at hudson.FilePath.act(FilePath.java:1164)
at hudson.FilePath.act(FilePath.java:1147)
at io.jenkins.plugins.analysis.core.model.ReportScanningTool.scanInWorkspace(ReportScanningTool.java:152)
at io.jenkins.plugins.analysis.core.model.ReportScanningTool.scan(ReportScanningTool.java:134)
at io.jenkins.plugins.analysis.core.steps.IssuesScanner.scan(IssuesScanner.java:95)
at io.jenkins.plugins.analysis.core.steps.ScanForIssuesStep$Execution.run(ScanForIssuesStep.java:214)
at io.jenkins.plugins.analysis.core.steps.ScanForIssuesStep$Execution.run(ScanForIssuesStep.java:175)
at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
```



-- 
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/eefe0887-c933-4541-aab3-1f286c04b371n%40googlegroups.com.


-- 
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].

-- 
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].

-- 
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/233a664a-9d1c-4833-b6e7-29f959b374cfn%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: How to publish cppcheck results in a pipeline?

Ulli Hafner
I don’t know. Don’t you have a dedicated forum to ask cppcheck questions? 

I still do not understand why you are redirecting stdout or stderr. I would assume that every tool that creates XML files automatically creates the file in your workspace. Did you check the workspace if there is a file if you omit the redirect (>)?
 

Am 26.03.2021 um 11:28 schrieb jesus fernandez <[hidden email]>:

Thanks for the replies but how woud the command be then? something like this cppcheck "E:/Source" --force — enable=all — inconclusive — xml — xml-version=2 . > cppcheck.xm

El jueves, 25 de marzo de 2021 a las 21:49:15 UTC+1, ullrich...@gmail.com escribió:
Yes, this is definitely not XML :-)
This is the stderr of your program! 

2 > cppcheck.xml pipes your stderr to a file. You do not need this part. 

Am 25.03.2021 um 20:08 schrieb jesus fernandez <jesusfern...@...>:

so it seems like if it basically is writting all the outputs the cmd throws

El jueves, 25 de marzo de 2021 a las 20:07:20 UTC+1, jesus fernandez escribió:
the supposely .xml does not have any format, these are the first 5 lines:
Checking E:\Source\Game\AchievementManager.cpp ...
Checking E:\Source\Game\AchievementManager.cpp: APP_STEAM;FINAL_RELEASE;_DEBUG...
Checking E:\Source\Game\AchievementManager.cpp: APP_STEAM;NEED_AOE1DE_ACHIEVEMENT_TEST;_DEBUG...
Checking E:\Source\Game\AchievementManager.cpp: APP_STEAM;NEED_AOE3DE_ACHIEVEMENT_TEST;_DEBUG...
Checking E:\Source\Game\AchievementManager.cpp: APP_STEAM;_DEBUG...

El jueves, 25 de marzo de 2021 a las 19:47:22 UTC+1, [hidden email] escribió:
If you can’t check on your own if the file contains valid XML can you please show the first 5 lines of the XML file here?

Am 25.03.2021 um 19:36 schrieb jesus fernandez <[hidden email]>:

I thought the  ```bat'cppcheck "E:/Source" --force — enable=all — inconclusive — xml — xml-version=2 . 2 > cppcheck.xml'``` command does genearate a valid xml. is it a matter of missing parameters or a matter of having to parse the output? in the documentation and the SO link I attached it is supposed to be done like that... what am I missing here?

El jueves, 25 de marzo de 2021 a las 18:21:38 UTC+1, ullrich...@gmail.com escribió:
The exception says it is not a valid XML file. Is it a valid XML file? Seems that there is content before the fir XML tag. Can you open it in an editor that can validate the XML?

Am 25.03.2021 um 17:57 schrieb jesus fernandez <[hidden email]>:

Thanks for replying, I have opened and it has 2000 lines of code but I do not know if it is valid or not as I have never used cppcheck before, and if it is not valid is it because I am not using the right parameters when calling cppcheck or how?



El jueves, 25 de marzo de 2021 a las 17:44:44 UTC+1, ullrich...@gmail.com escribió:
It look like your create XML is not valid. Can you please open the XML file and check? 

Am 25.03.2021 um 17:40 schrieb jesus fernandez <[hidden email]>:

I am learning about Jenkins on my own, and I wanted to try the cppcheck plugin, I have setup the following sample pipeline:
```
pipeline {
    agent any

    stages {
        stage('analysis') {
            steps {
                script{
                    bat'cppcheck "E:/Source" --force — enable=all — inconclusive — xml — xml-version=2 . 2 > cppcheck.xml'
                }
            }
        }
    }
    post {
        always {
            // scanForIssues tool: cppCheck(pattern: 'cppcheck.xml')
            publishCppcheck pattern:'cppcheck.xml'
        }
    }
}
```

But I get an error in the post step which I do not know if it is related to my projecto or if I am doing something wrong. I have follow the instructions on this thread [cppcheck][1]but it does not seem to work, wehther I use ```publushCppcheck``` :
```
[Pipeline] { (Declarative: Post Actions)
[Pipeline] publishCppcheck (hide)
[Cppcheck] Starting the cppcheck analysis.
[Cppcheck] Processing 1 files with the pattern 'cppcheck.xml'.
[Cppcheck] Parsing throws exceptions. javax.xml.bind.UnmarshalException
 - with linked exception:
[org.xml.sax.SAXParseException; systemId: file:/C:/Users/anton/.jenkins/workspace/JOB4/cppcheck.xml; lineNumber: 1; columnNumber: 1; El contenido no está permitido en el prólogo.]
[Cppcheck] java.io.IOException: javax.xml.bind.UnmarshalException
 - with linked exception:
[org.xml.sax.SAXParseException; systemId: file:/C:/Users/anton/.jenkins/workspace/JOB4/cppcheck.xml; lineNumber: 1; columnNumber: 1; El contenido no está permitido en el prólogo.]
at org.jenkinsci.plugins.cppcheck.parser.CppcheckParser.parse(CppcheckParser.java:67)
at org.jenkinsci.plugins.cppcheck.CppcheckParserResult.invoke(CppcheckParserResult.java:69)
at org.jenkinsci.plugins.cppcheck.CppcheckParserResult.invoke(CppcheckParserResult.java:24)
at hudson.FilePath.act(FilePath.java:1164)
at hudson.FilePath.act(FilePath.java:1147)
at org.jenkinsci.plugins.cppcheck.CppcheckPublisher.perform(CppcheckPublisher.java:337)
at jenkins.tasks.SimpleBuildStep.perform(SimpleBuildStep.java:123)
at org.jenkinsci.plugins.workflow.steps.CoreStep$Execution.run(CoreStep.java:99)
at org.jenkinsci.plugins.workflow.steps.CoreStep$Execution.run(CoreStep.java:69)
at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: javax.xml.bind.UnmarshalException
```

or ```scanforIssues``` from warnings ng plugin::
```
[Pipeline] { (Declarative: Post Actions)
[Pipeline] scanForIssues
[CPPCheck] [-ERROR-] Parsing of file 'C:\Users\anton\.jenkins\workspace\JOB4\cppcheck.xml' failed due to an exception:
[CPPCheck] [-ERROR-] com.ctc.wstx.exc.WstxUnexpectedCharException: Unexpected character 'C' (code 67) in prolog; expected '<'
 at [row,col {unknown-source}]: [1,1]
[CPPCheck] [-ERROR-]  at [row,col {unknown-source}]: [1,1]
[CPPCheck] [-ERROR-]  at com.ctc.wstx.sr.StreamScanner.throwUnexpectedChar(StreamScanner.java:648)
[CPPCheck] [-ERROR-]  at com.ctc.wstx.sr.BasicStreamReader.nextFromProlog(BasicStreamReader.java:2047)
[CPPCheck] [-ERROR-]  at com.ctc.wstx.sr.BasicStreamReader.next(BasicStreamReader.java:1069)
[CPPCheck] [-ERROR-]  at se.bjurr.violations.lib.parsers.CPPCheckParser.parseReportOutput(CPPCheckParser.java:43)
[CPPCheck] [-ERROR-]  at edu.hm.hafner.analysis.parser.violations.AbstractViolationAdapter.parse(AbstractViolationAdapter.java:35)
[CPPCheck] [-ERROR-]  at io.jenkins.plugins.analysis.core.model.FilesScanner.aggregateIssuesOfFile(FilesScanner.java:105)
[CPPCheck] [-ERROR-]  at io.jenkins.plugins.analysis.core.model.FilesScanner.scanFiles(FilesScanner.java:89)
[CPPCheck] [-ERROR-]  at io.jenkins.plugins.analysis.core.model.FilesScanner.invoke(FilesScanner.java:72)
[CPPCheck] [-ERROR-]  at io.jenkins.plugins.analysis.core.model.FilesScanner.invoke(FilesScanner.java:30)
[CPPCheck] [-ERROR-]  at hudson.FilePath.act(FilePath.java:1164)
[CPPCheck] [-ERROR-]  at hudson.FilePath.act(FilePath.java:1147)
[CPPCheck] [-ERROR-]  at io.jenkins.plugins.analysis.core.model.ReportScanningTool.scanInWorkspace(ReportScanningTool.java:152)
[CPPCheck] [-ERROR-]  at io.jenkins.plugins.analysis.core.model.ReportScanningTool.scan(ReportScanningTool.java:134)
[CPPCheck] [-ERROR-]  at io.jenkins.plugins.analysis.core.steps.IssuesScanner.scan(IssuesScanner.java:95)
[CPPCheck] [-ERROR-]  at io.jenkins.plugins.analysis.core.steps.ScanForIssuesStep$Execution.run(ScanForIssuesStep.java:214)
[CPPCheck] [-ERROR-]  at io.jenkins.plugins.analysis.core.steps.ScanForIssuesStep$Execution.run(ScanForIssuesStep.java:175)
[CPPCheck] [-ERROR-]  at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47)
[CPPCheck] [-ERROR-]  at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
[CPPCheck] [-ERROR-]  at java.util.concurrent.FutureTask.run(Unknown Source)
[CPPCheck] [-ERROR-]  at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
[CPPCheck] [-ERROR-]  at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
[CPPCheck] [-ERROR-]  at java.lang.Thread.run(Unknown Source)
[CPPCheck] [-ERROR-]  [wrapped] edu.hm.hafner.analysis.ParsingException: Exception occurred during parsing
WstxUnexpectedCharException: Unexpected character 'C' (code 67) in prolog; expected '<'
 at [row,col {unknown-source}]: [1,1]
com.ctc.wstx.exc.WstxUnexpectedCharException: Unexpected character 'C' (code 67) in prolog; expected '<'
 at [row,col {unknown-source}]: [1,1]
at com.ctc.wstx.sr.StreamScanner.throwUnexpectedChar(StreamScanner.java:648)
at com.ctc.wstx.sr.BasicStreamReader.nextFromProlog(BasicStreamReader.java:2047)
at com.ctc.wstx.sr.BasicStreamReader.next(BasicStreamReader.java:1069)
at se.bjurr.violations.lib.parsers.CPPCheckParser.parseReportOutput(CPPCheckParser.java:43)
at edu.hm.hafner.analysis.parser.violations.AbstractViolationAdapter.parse(AbstractViolationAdapter.java:35)
at io.jenkins.plugins.analysis.core.model.FilesScanner.aggregateIssuesOfFile(FilesScanner.java:105)
at io.jenkins.plugins.analysis.core.model.FilesScanner.scanFiles(FilesScanner.java:89)
at io.jenkins.plugins.analysis.core.model.FilesScanner.invoke(FilesScanner.java:72)
at io.jenkins.plugins.analysis.core.model.FilesScanner.invoke(FilesScanner.java:30)
at hudson.FilePath.act(FilePath.java:1164)
at hudson.FilePath.act(FilePath.java:1147)
at io.jenkins.plugins.analysis.core.model.ReportScanningTool.scanInWorkspace(ReportScanningTool.java:152)
at io.jenkins.plugins.analysis.core.model.ReportScanningTool.scan(ReportScanningTool.java:134)
at io.jenkins.plugins.analysis.core.steps.IssuesScanner.scan(IssuesScanner.java:95)
at io.jenkins.plugins.analysis.core.steps.ScanForIssuesStep$Execution.run(ScanForIssuesStep.java:214)
at io.jenkins.plugins.analysis.core.steps.ScanForIssuesStep$Execution.run(ScanForIssuesStep.java:175)
at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
```



-- 
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/eefe0887-c933-4541-aab3-1f286c04b371n%40googlegroups.com.


-- 
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].

-- 
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].

-- 
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-use...@....

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/233a664a-9d1c-4833-b6e7-29f959b374cfn%40googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/A54FBCD1-C520-4109-9A5B-4CEECF0B8F4B%40gmail.com.
Reply | Threaded
Open this post in threaded view
|

Re: How to publish cppcheck results in a pipeline?

Jérôme Godbout

You probably need something like this:

cppcheck --xml-version=2 --enable=all <path1> <path2> 2>samplecppcheck.xml

 

https://stackoverflow.com/questions/10611011/cannot-generate-xml-output-from-cppcheck

 

cppcheck is a pain from command line, the command line was an after though, they screw big time. I stop using it just for that reason, the CLI is not matching the GUI and the results are unpredictable in case of errors. The fact that it requires the redirection of std_err, just that show a bad design from people who doesn’t give a damn about CLI. I strongly recommend you find something else to do your static analysis into your CI.

 

 

Jérôme Godbout, B. Ing.


Software / Firmware Team Lead
O: (418) 682-3636 ext.: 114  

C: (581) 777-0050 
[hidden email]

signature_1613841900

dimonoff.com

1015 Avenue Wilfrid-Pelletier, 

Québec, QC G1W 0C4, 4e étage

 

 

From: [hidden email] <[hidden email]> on behalf of Ullrich Hafner <[hidden email]>
Date: Friday, March 26, 2021 at 7:44 AM
To: Jenkins Users <[hidden email]>
Subject: Re: How to publish cppcheck results in a pipeline?

I don’t know. Don’t you have a dedicated forum to ask cppcheck questions? 

 

I still do not understand why you are redirecting stdout or stderr. I would assume that every tool that creates XML files automatically creates the file in your workspace. Did you check the workspace if there is a file if you omit the redirect (>)?

 



Am 26.03.2021 um 11:28 schrieb jesus fernandez <[hidden email]>:

 

Thanks for the replies but how woud the command be then? something like this cppcheck "E:/Source" --force — enable=all — inconclusive — xml — xml-version=2 . > cppcheck.xm

El jueves, 25 de marzo de 2021 a las 21:49:15 UTC+1, ullrich...@gmail.com escribió:

Yes, this is definitely not XML :-)

This is the stderr of your program! 

 

2 > cppcheck.xml pipes your stderr to a file. You do not need this part. 



Am 25.03.2021 um 20:08 schrieb jesus fernandez <[hidden email]>:

 

so it seems like if it basically is writting all the outputs the cmd throws

El jueves, 25 de marzo de 2021 a las 20:07:20 UTC+1, jesus fernandez escribió:

the supposely .xml does not have any format, these are the first 5 lines:

Checking E:\Source\Game\AchievementManager.cpp ...

Checking E:\Source\Game\AchievementManager.cpp: APP_STEAM;FINAL_RELEASE;_DEBUG...

Checking E:\Source\Game\AchievementManager.cpp: APP_STEAM;NEED_AOE1DE_ACHIEVEMENT_TEST;_DEBUG...

Checking E:\Source\Game\AchievementManager.cpp: APP_STEAM;NEED_AOE3DE_ACHIEVEMENT_TEST;_DEBUG...

Checking E:\Source\Game\AchievementManager.cpp: APP_STEAM;_DEBUG...

 

El jueves, 25 de marzo de 2021 a las 19:47:22 UTC+1, [hidden email] escribió:

If you can’t check on your own if the file contains valid XML can you please show the first 5 lines of the XML file here?



Am 25.03.2021 um 19:36 schrieb jesus fernandez <[hidden email]>:

 

I thought the  ```bat'cppcheck "E:/Source" --force — enable=all — inconclusive — xml — xml-version=2 . 2 > cppcheck.xml'``` command does genearate a valid xml. is it a matter of missing parameters or a matter of having to parse the output? in the documentation and the SO link I attached it is supposed to be done like that... what am I missing here?

El jueves, 25 de marzo de 2021 a las 18:21:38 UTC+1, ullrich...@gmail.com escribió:

The exception says it is not a valid XML file. Is it a valid XML file? Seems that there is content before the fir XML tag. Can you open it in an editor that can validate the XML?



Am 25.03.2021 um 17:57 schrieb jesus fernandez <[hidden email]>:

 

Thanks for replying, I have opened and it has 2000 lines of code but I do not know if it is valid or not as I have never used cppcheck before, and if it is not valid is it because I am not using the right parameters when calling cppcheck or how?

 

 

El jueves, 25 de marzo de 2021 a las 17:44:44 UTC+1, ullrich...@gmail.com escribió:

It look like your create XML is not valid. Can you please open the XML file and check? 



Am 25.03.2021 um 17:40 schrieb jesus fernandez <[hidden email]>:

 

I am learning about Jenkins on my own, and I wanted to try the cppcheck plugin, I have setup the following sample pipeline:

```

pipeline {

    agent any

 

    stages {

        stage('analysis') {

            steps {

                script{

                    bat'cppcheck "E:/Source" --force — enable=all — inconclusive — xml — xml-version=2 . 2 > cppcheck.xml'

                }

            }

        }

    }

    post {

        always {

            // scanForIssues tool: cppCheck(pattern: 'cppcheck.xml')

            publishCppcheck pattern:'cppcheck.xml'

        }

    }

}

```

 

But I get an error in the post step which I do not know if it is related to my projecto or if I am doing something wrong. I have follow the instructions on this thread [cppcheck][1]but it does not seem to work, wehther I use ```publushCppcheck``` :

```

[Pipeline] { (Declarative: Post Actions)

[Pipeline] publishCppcheck (hide)

[Cppcheck] Starting the cppcheck analysis.

[Cppcheck] Processing 1 files with the pattern 'cppcheck.xml'.

[Cppcheck] Parsing throws exceptions. javax.xml.bind.UnmarshalException

 - with linked exception:

[org.xml.sax.SAXParseException; systemId: file:/C:/Users/anton/.jenkins/workspace/JOB4/cppcheck.xml; lineNumber: 1; columnNumber: 1; El contenido no está permitido en el prólogo.]

[Cppcheck] java.io.IOException: javax.xml.bind.UnmarshalException

 - with linked exception:

[org.xml.sax.SAXParseException; systemId: file:/C:/Users/anton/.jenkins/workspace/JOB4/cppcheck.xml; lineNumber: 1; columnNumber: 1; El contenido no está permitido en el prólogo.]

at org.jenkinsci.plugins.cppcheck.parser.CppcheckParser.parse(CppcheckParser.java:67)

at org.jenkinsci.plugins.cppcheck.CppcheckParserResult.invoke(CppcheckParserResult.java:69)

at org.jenkinsci.plugins.cppcheck.CppcheckParserResult.invoke(CppcheckParserResult.java:24)

at hudson.FilePath.act(FilePath.java:1164)

at hudson.FilePath.act(FilePath.java:1147)

at org.jenkinsci.plugins.cppcheck.CppcheckPublisher.perform(CppcheckPublisher.java:337)

at jenkins.tasks.SimpleBuildStep.perform(SimpleBuildStep.java:123)

at org.jenkinsci.plugins.workflow.steps.CoreStep$Execution.run(CoreStep.java:99)

at org.jenkinsci.plugins.workflow.steps.CoreStep$Execution.run(CoreStep.java:69)

at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47)

at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)

at java.util.concurrent.FutureTask.run(Unknown Source)

at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)

at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)

at java.lang.Thread.run(Unknown Source)

Caused by: javax.xml.bind.UnmarshalException

```

 

or ```scanforIssues``` from warnings ng plugin::

```

[Pipeline] { (Declarative: Post Actions)

[Pipeline] scanForIssues

[CPPCheck] [-ERROR-] Parsing of file 'C:\Users\anton\.jenkins\workspace\JOB4\cppcheck.xml' failed due to an exception:

[CPPCheck] [-ERROR-] com.ctc.wstx.exc.WstxUnexpectedCharException: Unexpected character 'C' (code 67) in prolog; expected '<'

 at [row,col {unknown-source}]: [1,1]

[CPPCheck] [-ERROR-]  at [row,col {unknown-source}]: [1,1]

[CPPCheck] [-ERROR-]  at com.ctc.wstx.sr.StreamScanner.throwUnexpectedChar(StreamScanner.java:648)

[CPPCheck] [-ERROR-]  at com.ctc.wstx.sr.BasicStreamReader.nextFromProlog(BasicStreamReader.java:2047)

[CPPCheck] [-ERROR-]  at com.ctc.wstx.sr.BasicStreamReader.next(BasicStreamReader.java:1069)

[CPPCheck] [-ERROR-]  at se.bjurr.violations.lib.parsers.CPPCheckParser.parseReportOutput(CPPCheckParser.java:43)

[CPPCheck] [-ERROR-]  at edu.hm.hafner.analysis.parser.violations.AbstractViolationAdapter.parse(AbstractViolationAdapter.java:35)

[CPPCheck] [-ERROR-]  at io.jenkins.plugins.analysis.core.model.FilesScanner.aggregateIssuesOfFile(FilesScanner.java:105)

[CPPCheck] [-ERROR-]  at io.jenkins.plugins.analysis.core.model.FilesScanner.scanFiles(FilesScanner.java:89)

[CPPCheck] [-ERROR-]  at io.jenkins.plugins.analysis.core.model.FilesScanner.invoke(FilesScanner.java:72)

[CPPCheck] [-ERROR-]  at io.jenkins.plugins.analysis.core.model.FilesScanner.invoke(FilesScanner.java:30)

[CPPCheck] [-ERROR-]  at hudson.FilePath.act(FilePath.java:1164)

[CPPCheck] [-ERROR-]  at hudson.FilePath.act(FilePath.java:1147)

[CPPCheck] [-ERROR-]  at io.jenkins.plugins.analysis.core.model.ReportScanningTool.scanInWorkspace(ReportScanningTool.java:152)

[CPPCheck] [-ERROR-]  at io.jenkins.plugins.analysis.core.model.ReportScanningTool.scan(ReportScanningTool.java:134)

[CPPCheck] [-ERROR-]  at io.jenkins.plugins.analysis.core.steps.IssuesScanner.scan(IssuesScanner.java:95)

[CPPCheck] [-ERROR-]  at io.jenkins.plugins.analysis.core.steps.ScanForIssuesStep$Execution.run(ScanForIssuesStep.java:214)

[CPPCheck] [-ERROR-]  at io.jenkins.plugins.analysis.core.steps.ScanForIssuesStep$Execution.run(ScanForIssuesStep.java:175)

[CPPCheck] [-ERROR-]  at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47)

[CPPCheck] [-ERROR-]  at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)

[CPPCheck] [-ERROR-]  at java.util.concurrent.FutureTask.run(Unknown Source)

[CPPCheck] [-ERROR-]  at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)

[CPPCheck] [-ERROR-]  at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)

[CPPCheck] [-ERROR-]  at java.lang.Thread.run(Unknown Source)

[CPPCheck] [-ERROR-]  [wrapped] edu.hm.hafner.analysis.ParsingException: Exception occurred during parsing

WstxUnexpectedCharException: Unexpected character 'C' (code 67) in prolog; expected '<'

 at [row,col {unknown-source}]: [1,1]

com.ctc.wstx.exc.WstxUnexpectedCharException: Unexpected character 'C' (code 67) in prolog; expected '<'

 at [row,col {unknown-source}]: [1,1]

at com.ctc.wstx.sr.StreamScanner.throwUnexpectedChar(StreamScanner.java:648)

at com.ctc.wstx.sr.BasicStreamReader.nextFromProlog(BasicStreamReader.java:2047)

at com.ctc.wstx.sr.BasicStreamReader.next(BasicStreamReader.java:1069)

at se.bjurr.violations.lib.parsers.CPPCheckParser.parseReportOutput(CPPCheckParser.java:43)

at edu.hm.hafner.analysis.parser.violations.AbstractViolationAdapter.parse(AbstractViolationAdapter.java:35)

at io.jenkins.plugins.analysis.core.model.FilesScanner.aggregateIssuesOfFile(FilesScanner.java:105)

at io.jenkins.plugins.analysis.core.model.FilesScanner.scanFiles(FilesScanner.java:89)

at io.jenkins.plugins.analysis.core.model.FilesScanner.invoke(FilesScanner.java:72)

at io.jenkins.plugins.analysis.core.model.FilesScanner.invoke(FilesScanner.java:30)

at hudson.FilePath.act(FilePath.java:1164)

at hudson.FilePath.act(FilePath.java:1147)

at io.jenkins.plugins.analysis.core.model.ReportScanningTool.scanInWorkspace(ReportScanningTool.java:152)

at io.jenkins.plugins.analysis.core.model.ReportScanningTool.scan(ReportScanningTool.java:134)

at io.jenkins.plugins.analysis.core.steps.IssuesScanner.scan(IssuesScanner.java:95)

at io.jenkins.plugins.analysis.core.steps.ScanForIssuesStep$Execution.run(ScanForIssuesStep.java:214)

at io.jenkins.plugins.analysis.core.steps.ScanForIssuesStep$Execution.run(ScanForIssuesStep.java:175)

at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47)

at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)

at java.util.concurrent.FutureTask.run(Unknown Source)

at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)

at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)

at java.lang.Thread.run(Unknown Source)

```

 

 

 

-- 
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/eefe0887-c933-4541-aab3-1f286c04b371n%40googlegroups.com.

 

 

-- 
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].

 

-- 
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].

 

-- 
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to 
[hidden email].

 

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/233a664a-9d1c-4833-b6e7-29f959b374cfn%40googlegroups.com.

 

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/A54FBCD1-C520-4109-9A5B-4CEECF0B8F4B%40gmail.com.

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/QB1PR01MB3844C2C47704FA2735D7C364CD619%40QB1PR01MB3844.CANPRD01.PROD.OUTLOOK.COM.
Reply | Threaded
Open this post in threaded view
|

Re: How to publish cppcheck results in a pipeline?

jesus fernandez
Thanks Jerome I use sonarqube at the moment ( I am also learning on this one, but at least is working) but I wanted to check other alternatives as sonarqibe slow down the pipeline as it takes quiet some computing time. Would you recommend sonarqube over cppcheck for a jenkins pipeline? 

El vie., 26 mar. 2021 14:52, Jérôme Godbout <[hidden email]> escribió:

You probably need something like this:

cppcheck --xml-version=2 --enable=all <path1> <path2> 2>samplecppcheck.xml

 

https://stackoverflow.com/questions/10611011/cannot-generate-xml-output-from-cppcheck

 

cppcheck is a pain from command line, the command line was an after though, they screw big time. I stop using it just for that reason, the CLI is not matching the GUI and the results are unpredictable in case of errors. The fact that it requires the redirection of std_err, just that show a bad design from people who doesn’t give a damn about CLI. I strongly recommend you find something else to do your static analysis into your CI.

 

 

Jérôme Godbout, B. Ing.


Software / Firmware Team Lead
O: (418) 682-3636 ext.: 114  

C: (581) 777-0050 
[hidden email]

dimonoff.com

1015 Avenue Wilfrid-Pelletier, 

Québec, QC G1W 0C4, 4e étage

 

 

From: [hidden email] <[hidden email]> on behalf of Ullrich Hafner <[hidden email]>
Date: Friday, March 26, 2021 at 7:44 AM
To: Jenkins Users <[hidden email]>
Subject: Re: How to publish cppcheck results in a pipeline?

I don’t know. Don’t you have a dedicated forum to ask cppcheck questions? 

 

I still do not understand why you are redirecting stdout or stderr. I would assume that every tool that creates XML files automatically creates the file in your workspace. Did you check the workspace if there is a file if you omit the redirect (>)?

 



Am 26.03.2021 um 11:28 schrieb jesus fernandez <[hidden email]>:

 

Thanks for the replies but how woud the command be then? something like this cppcheck "E:/Source" --force — enable=all — inconclusive — xml — xml-version=2 . > cppcheck.xm

El jueves, 25 de marzo de 2021 a las 21:49:15 UTC+1, ullrich...@gmail.com escribió:

Yes, this is definitely not XML :-)

This is the stderr of your program! 

 

2 > cppcheck.xml pipes your stderr to a file. You do not need this part. 



Am 25.03.2021 um 20:08 schrieb jesus fernandez <[hidden email]>:

 

so it seems like if it basically is writting all the outputs the cmd throws

El jueves, 25 de marzo de 2021 a las 20:07:20 UTC+1, jesus fernandez escribió:

the supposely .xml does not have any format, these are the first 5 lines:

Checking E:\Source\Game\AchievementManager.cpp ...

Checking E:\Source\Game\AchievementManager.cpp: APP_STEAM;FINAL_RELEASE;_DEBUG...

Checking E:\Source\Game\AchievementManager.cpp: APP_STEAM;NEED_AOE1DE_ACHIEVEMENT_TEST;_DEBUG...

Checking E:\Source\Game\AchievementManager.cpp: APP_STEAM;NEED_AOE3DE_ACHIEVEMENT_TEST;_DEBUG...

Checking E:\Source\Game\AchievementManager.cpp: APP_STEAM;_DEBUG...

 

El jueves, 25 de marzo de 2021 a las 19:47:22 UTC+1, [hidden email] escribió:

If you can’t check on your own if the file contains valid XML can you please show the first 5 lines of the XML file here?



Am 25.03.2021 um 19:36 schrieb jesus fernandez <[hidden email]>:

 

I thought the  ```bat'cppcheck "E:/Source" --force — enable=all — inconclusive — xml — xml-version=2 . 2 > cppcheck.xml'``` command does genearate a valid xml. is it a matter of missing parameters or a matter of having to parse the output? in the documentation and the SO link I attached it is supposed to be done like that... what am I missing here?

El jueves, 25 de marzo de 2021 a las 18:21:38 UTC+1, ullrich...@gmail.com escribió:

The exception says it is not a valid XML file. Is it a valid XML file? Seems that there is content before the fir XML tag. Can you open it in an editor that can validate the XML?



Am 25.03.2021 um 17:57 schrieb jesus fernandez <[hidden email]>:

 

Thanks for replying, I have opened and it has 2000 lines of code but I do not know if it is valid or not as I have never used cppcheck before, and if it is not valid is it because I am not using the right parameters when calling cppcheck or how?

 

 

El jueves, 25 de marzo de 2021 a las 17:44:44 UTC+1, ullrich...@gmail.com escribió:

It look like your create XML is not valid. Can you please open the XML file and check? 



Am 25.03.2021 um 17:40 schrieb jesus fernandez <[hidden email]>:

 

I am learning about Jenkins on my own, and I wanted to try the cppcheck plugin, I have setup the following sample pipeline:

```

pipeline {

    agent any

 

    stages {

        stage('analysis') {

            steps {

                script{

                    bat'cppcheck "E:/Source" --force — enable=all — inconclusive — xml — xml-version=2 . 2 > cppcheck.xml'

                }

            }

        }

    }

    post {

        always {

            // scanForIssues tool: cppCheck(pattern: 'cppcheck.xml')

            publishCppcheck pattern:'cppcheck.xml'

        }

    }

}

```

 

But I get an error in the post step which I do not know if it is related to my projecto or if I am doing something wrong. I have follow the instructions on this thread [cppcheck][1]but it does not seem to work, wehther I use ```publushCppcheck``` :

```

[Pipeline] { (Declarative: Post Actions)

[Pipeline] publishCppcheck (hide)

[Cppcheck] Starting the cppcheck analysis.

[Cppcheck] Processing 1 files with the pattern 'cppcheck.xml'.

[Cppcheck] Parsing throws exceptions. javax.xml.bind.UnmarshalException

 - with linked exception:

[org.xml.sax.SAXParseException; systemId: file:/C:/Users/anton/.jenkins/workspace/JOB4/cppcheck.xml; lineNumber: 1; columnNumber: 1; El contenido no está permitido en el prólogo.]

[Cppcheck] java.io.IOException: javax.xml.bind.UnmarshalException

 - with linked exception:

[org.xml.sax.SAXParseException; systemId: file:/C:/Users/anton/.jenkins/workspace/JOB4/cppcheck.xml; lineNumber: 1; columnNumber: 1; El contenido no está permitido en el prólogo.]

at org.jenkinsci.plugins.cppcheck.parser.CppcheckParser.parse(CppcheckParser.java:67)

at org.jenkinsci.plugins.cppcheck.CppcheckParserResult.invoke(CppcheckParserResult.java:69)

at org.jenkinsci.plugins.cppcheck.CppcheckParserResult.invoke(CppcheckParserResult.java:24)

at hudson.FilePath.act(FilePath.java:1164)

at hudson.FilePath.act(FilePath.java:1147)

at org.jenkinsci.plugins.cppcheck.CppcheckPublisher.perform(CppcheckPublisher.java:337)

at jenkins.tasks.SimpleBuildStep.perform(SimpleBuildStep.java:123)

at org.jenkinsci.plugins.workflow.steps.CoreStep$Execution.run(CoreStep.java:99)

at org.jenkinsci.plugins.workflow.steps.CoreStep$Execution.run(CoreStep.java:69)

at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47)

at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)

at java.util.concurrent.FutureTask.run(Unknown Source)

at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)

at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)

at java.lang.Thread.run(Unknown Source)

Caused by: javax.xml.bind.UnmarshalException

```

 

or ```scanforIssues``` from warnings ng plugin::

```

[Pipeline] { (Declarative: Post Actions)

[Pipeline] scanForIssues

[CPPCheck] [-ERROR-] Parsing of file 'C:\Users\anton\.jenkins\workspace\JOB4\cppcheck.xml' failed due to an exception:

[CPPCheck] [-ERROR-] com.ctc.wstx.exc.WstxUnexpectedCharException: Unexpected character 'C' (code 67) in prolog; expected '<'

 at [row,col {unknown-source}]: [1,1]

[CPPCheck] [-ERROR-]  at [row,col {unknown-source}]: [1,1]

[CPPCheck] [-ERROR-]  at com.ctc.wstx.sr.StreamScanner.throwUnexpectedChar(StreamScanner.java:648)

[CPPCheck] [-ERROR-]  at com.ctc.wstx.sr.BasicStreamReader.nextFromProlog(BasicStreamReader.java:2047)

[CPPCheck] [-ERROR-]  at com.ctc.wstx.sr.BasicStreamReader.next(BasicStreamReader.java:1069)

[CPPCheck] [-ERROR-]  at se.bjurr.violations.lib.parsers.CPPCheckParser.parseReportOutput(CPPCheckParser.java:43)

[CPPCheck] [-ERROR-]  at edu.hm.hafner.analysis.parser.violations.AbstractViolationAdapter.parse(AbstractViolationAdapter.java:35)

[CPPCheck] [-ERROR-]  at io.jenkins.plugins.analysis.core.model.FilesScanner.aggregateIssuesOfFile(FilesScanner.java:105)

[CPPCheck] [-ERROR-]  at io.jenkins.plugins.analysis.core.model.FilesScanner.scanFiles(FilesScanner.java:89)

[CPPCheck] [-ERROR-]  at io.jenkins.plugins.analysis.core.model.FilesScanner.invoke(FilesScanner.java:72)

[CPPCheck] [-ERROR-]  at io.jenkins.plugins.analysis.core.model.FilesScanner.invoke(FilesScanner.java:30)

[CPPCheck] [-ERROR-]  at hudson.FilePath.act(FilePath.java:1164)

[CPPCheck] [-ERROR-]  at hudson.FilePath.act(FilePath.java:1147)

[CPPCheck] [-ERROR-]  at io.jenkins.plugins.analysis.core.model.ReportScanningTool.scanInWorkspace(ReportScanningTool.java:152)

[CPPCheck] [-ERROR-]  at io.jenkins.plugins.analysis.core.model.ReportScanningTool.scan(ReportScanningTool.java:134)

[CPPCheck] [-ERROR-]  at io.jenkins.plugins.analysis.core.steps.IssuesScanner.scan(IssuesScanner.java:95)

[CPPCheck] [-ERROR-]  at io.jenkins.plugins.analysis.core.steps.ScanForIssuesStep$Execution.run(ScanForIssuesStep.java:214)

[CPPCheck] [-ERROR-]  at io.jenkins.plugins.analysis.core.steps.ScanForIssuesStep$Execution.run(ScanForIssuesStep.java:175)

[CPPCheck] [-ERROR-]  at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47)

[CPPCheck] [-ERROR-]  at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)

[CPPCheck] [-ERROR-]  at java.util.concurrent.FutureTask.run(Unknown Source)

[CPPCheck] [-ERROR-]  at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)

[CPPCheck] [-ERROR-]  at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)

[CPPCheck] [-ERROR-]  at java.lang.Thread.run(Unknown Source)

[CPPCheck] [-ERROR-]  [wrapped] edu.hm.hafner.analysis.ParsingException: Exception occurred during parsing

WstxUnexpectedCharException: Unexpected character 'C' (code 67) in prolog; expected '<'

 at [row,col {unknown-source}]: [1,1]

com.ctc.wstx.exc.WstxUnexpectedCharException: Unexpected character 'C' (code 67) in prolog; expected '<'

 at [row,col {unknown-source}]: [1,1]

at com.ctc.wstx.sr.StreamScanner.throwUnexpectedChar(StreamScanner.java:648)

at com.ctc.wstx.sr.BasicStreamReader.nextFromProlog(BasicStreamReader.java:2047)

at com.ctc.wstx.sr.BasicStreamReader.next(BasicStreamReader.java:1069)

at se.bjurr.violations.lib.parsers.CPPCheckParser.parseReportOutput(CPPCheckParser.java:43)

at edu.hm.hafner.analysis.parser.violations.AbstractViolationAdapter.parse(AbstractViolationAdapter.java:35)

at io.jenkins.plugins.analysis.core.model.FilesScanner.aggregateIssuesOfFile(FilesScanner.java:105)

at io.jenkins.plugins.analysis.core.model.FilesScanner.scanFiles(FilesScanner.java:89)

at io.jenkins.plugins.analysis.core.model.FilesScanner.invoke(FilesScanner.java:72)

at io.jenkins.plugins.analysis.core.model.FilesScanner.invoke(FilesScanner.java:30)

at hudson.FilePath.act(FilePath.java:1164)

at hudson.FilePath.act(FilePath.java:1147)

at io.jenkins.plugins.analysis.core.model.ReportScanningTool.scanInWorkspace(ReportScanningTool.java:152)

at io.jenkins.plugins.analysis.core.model.ReportScanningTool.scan(ReportScanningTool.java:134)

at io.jenkins.plugins.analysis.core.steps.IssuesScanner.scan(IssuesScanner.java:95)

at io.jenkins.plugins.analysis.core.steps.ScanForIssuesStep$Execution.run(ScanForIssuesStep.java:214)

at io.jenkins.plugins.analysis.core.steps.ScanForIssuesStep$Execution.run(ScanForIssuesStep.java:175)

at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47)

at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)

at java.util.concurrent.FutureTask.run(Unknown Source)

at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)

at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)

at java.lang.Thread.run(Unknown Source)

```

 

 

 

-- 
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/eefe0887-c933-4541-aab3-1f286c04b371n%40googlegroups.com.

 

 

-- 
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].

 

-- 
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].

 

-- 
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to 
[hidden email].

 

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/233a664a-9d1c-4833-b6e7-29f959b374cfn%40googlegroups.com.

 

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/A54FBCD1-C520-4109-9A5B-4CEECF0B8F4B%40gmail.com.

--
You received this message because you are subscribed to a topic in the Google Groups "Jenkins Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/jenkinsci-users/IEyGzpdo1-8/unsubscribe.
To unsubscribe from this group and all its topics, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/QB1PR01MB3844C2C47704FA2735D7C364CD619%40QB1PR01MB3844.CANPRD01.PROD.OUTLOOK.COM.

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CALZFchfsYmyonc-MPWFFt3yR_C_fSLs5VbO%2B%2B99jL9ZRVyxX%3Dg%40mail.gmail.com.

image001.png (18K) Download Attachment
image001.png (18K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: How to publish cppcheck results in a pipeline?

Jérôme Godbout

I cannot recommend it since I haven’t try it out, but you can find many over here:

https://en.wikipedia.org/wiki/List_of_tools_for_static_code_analysis#C,_C++

 

 

Moved to Visual Studio since we already have the license. But this depends on your needs. Cppcheck work great with GUI but the CLI is retarded.

This is the command I used into Jenkins when I did tried cppcheck:

String cmd = "cppcheck --project=${scriptConfig} --xml --xml-version=2 ${otherOptions} 2> ${outputXml}";

The first –xml should not be necessary according to the doc, but I added it anyway just in case, but failure is unreliable like you did discover.

 

When I got time I would give https://codechecker.readthedocs.io/en/latest/ a go to see what it can do, it use llvm/clang with a better CLI

 

Jérôme Godbout, B. Ing.


Software / Firmware Team Lead
O: (418) 682-3636 ext.: 114  

C: (581) 777-0050 
[hidden email]

signature_1664488747

dimonoff.com

1015 Avenue Wilfrid-Pelletier, 

Québec, QC G1W 0C4, 4e étage

 

 

From: [hidden email] <[hidden email]> on behalf of jesus fernandez <[hidden email]>
Date: Friday, March 26, 2021 at 10:38 AM
To: [hidden email] <[hidden email]>
Subject: Re: How to publish cppcheck results in a pipeline?

Thanks Jerome I use sonarqube at the moment ( I am also learning on this one, but at least is working) but I wanted to check other alternatives as sonarqibe slow down the pipeline as it takes quiet some computing time. Would you recommend sonarqube over cppcheck for a jenkins pipeline? 

 

El vie., 26 mar. 2021 14:52, Jérôme Godbout <[hidden email]> escribió:

You probably need something like this:

cppcheck --xml-version=2 --enable=all <path1> <path2> 2>samplecppcheck.xml

 

https://stackoverflow.com/questions/10611011/cannot-generate-xml-output-from-cppcheck

 

cppcheck is a pain from command line, the command line was an after though, they screw big time. I stop using it just for that reason, the CLI is not matching the GUI and the results are unpredictable in case of errors. The fact that it requires the redirection of std_err, just that show a bad design from people who doesn’t give a damn about CLI. I strongly recommend you find something else to do your static analysis into your CI.

 

 

Jérôme Godbout, B. Ing.


Software / Firmware Team Lead
O: (418) 682-3636 ext.: 114  

C: (581) 777-0050 
[hidden email]

dimonoff.com

1015 Avenue Wilfrid-Pelletier, 

Québec, QC G1W 0C4, 4e étage

 

 

From: [hidden email] <[hidden email]> on behalf of Ullrich Hafner <[hidden email]>
Date: Friday, March 26, 2021 at 7:44 AM
To: Jenkins Users <[hidden email]>
Subject: Re: How to publish cppcheck results in a pipeline?

I don’t know. Don’t you have a dedicated forum to ask cppcheck questions? 

 

I still do not understand why you are redirecting stdout or stderr. I would assume that every tool that creates XML files automatically creates the file in your workspace. Did you check the workspace if there is a file if you omit the redirect (>)?

 

 

Am 26.03.2021 um 11:28 schrieb jesus fernandez <[hidden email]>:

 

Thanks for the replies but how woud the command be then? something like this cppcheck "E:/Source" --force — enable=all — inconclusive — xml — xml-version=2 . > cppcheck.xm

El jueves, 25 de marzo de 2021 a las 21:49:15 UTC+1, ullrich...@gmail.com escribió:

Yes, this is definitely not XML :-)

This is the stderr of your program! 

 

2 > cppcheck.xml pipes your stderr to a file. You do not need this part. 

 

Am 25.03.2021 um 20:08 schrieb jesus fernandez <[hidden email]>:

 

so it seems like if it basically is writting all the outputs the cmd throws

El jueves, 25 de marzo de 2021 a las 20:07:20 UTC+1, jesus fernandez escribió:

the supposely .xml does not have any format, these are the first 5 lines:

Checking E:\Source\Game\AchievementManager.cpp ...

Checking E:\Source\Game\AchievementManager.cpp: APP_STEAM;FINAL_RELEASE;_DEBUG...

Checking E:\Source\Game\AchievementManager.cpp: APP_STEAM;NEED_AOE1DE_ACHIEVEMENT_TEST;_DEBUG...

Checking E:\Source\Game\AchievementManager.cpp: APP_STEAM;NEED_AOE3DE_ACHIEVEMENT_TEST;_DEBUG...

Checking E:\Source\Game\AchievementManager.cpp: APP_STEAM;_DEBUG...

 

El jueves, 25 de marzo de 2021 a las 19:47:22 UTC+1, [hidden email] escribió:

If you can’t check on your own if the file contains valid XML can you please show the first 5 lines of the XML file here?

 

Am 25.03.2021 um 19:36 schrieb jesus fernandez <[hidden email]>:

 

I thought the  ```bat'cppcheck "E:/Source" --force — enable=all — inconclusive — xml — xml-version=2 . 2 > cppcheck.xml'``` command does genearate a valid xml. is it a matter of missing parameters or a matter of having to parse the output? in the documentation and the SO link I attached it is supposed to be done like that... what am I missing here?

El jueves, 25 de marzo de 2021 a las 18:21:38 UTC+1, ullrich...@gmail.com escribió:

The exception says it is not a valid XML file. Is it a valid XML file? Seems that there is content before the fir XML tag. Can you open it in an editor that can validate the XML?

 

Am 25.03.2021 um 17:57 schrieb jesus fernandez <[hidden email]>:

 

Thanks for replying, I have opened and it has 2000 lines of code but I do not know if it is valid or not as I have never used cppcheck before, and if it is not valid is it because I am not using the right parameters when calling cppcheck or how?

 

 

El jueves, 25 de marzo de 2021 a las 17:44:44 UTC+1, ullrich...@gmail.com escribió:

It look like your create XML is not valid. Can you please open the XML file and check? 

 

Am 25.03.2021 um 17:40 schrieb jesus fernandez <[hidden email]>:

 

I am learning about Jenkins on my own, and I wanted to try the cppcheck plugin, I have setup the following sample pipeline:

```

pipeline {

    agent any

 

    stages {

        stage('analysis') {

            steps {

                script{

                    bat'cppcheck "E:/Source" --force — enable=all — inconclusive — xml — xml-version=2 . 2 > cppcheck.xml'

                }

            }

        }

    }

    post {

        always {

            // scanForIssues tool: cppCheck(pattern: 'cppcheck.xml')

            publishCppcheck pattern:'cppcheck.xml'

        }

    }

}

```

 

But I get an error in the post step which I do not know if it is related to my projecto or if I am doing something wrong. I have follow the instructions on this thread [cppcheck][1]but it does not seem to work, wehther I use ```publushCppcheck``` :

```

[Pipeline] { (Declarative: Post Actions)

[Pipeline] publishCppcheck (hide)

[Cppcheck] Starting the cppcheck analysis.

[Cppcheck] Processing 1 files with the pattern 'cppcheck.xml'.

[Cppcheck] Parsing throws exceptions. javax.xml.bind.UnmarshalException

 - with linked exception:

[org.xml.sax.SAXParseException; systemId: file:/C:/Users/anton/.jenkins/workspace/JOB4/cppcheck.xml; lineNumber: 1; columnNumber: 1; El contenido no está permitido en el prólogo.]

[Cppcheck] java.io.IOException: javax.xml.bind.UnmarshalException

 - with linked exception:

[org.xml.sax.SAXParseException; systemId: file:/C:/Users/anton/.jenkins/workspace/JOB4/cppcheck.xml; lineNumber: 1; columnNumber: 1; El contenido no está permitido en el prólogo.]

at org.jenkinsci.plugins.cppcheck.parser.CppcheckParser.parse(CppcheckParser.java:67)

at org.jenkinsci.plugins.cppcheck.CppcheckParserResult.invoke(CppcheckParserResult.java:69)

at org.jenkinsci.plugins.cppcheck.CppcheckParserResult.invoke(CppcheckParserResult.java:24)

at hudson.FilePath.act(FilePath.java:1164)

at hudson.FilePath.act(FilePath.java:1147)

at org.jenkinsci.plugins.cppcheck.CppcheckPublisher.perform(CppcheckPublisher.java:337)

at jenkins.tasks.SimpleBuildStep.perform(SimpleBuildStep.java:123)

at org.jenkinsci.plugins.workflow.steps.CoreStep$Execution.run(CoreStep.java:99)

at org.jenkinsci.plugins.workflow.steps.CoreStep$Execution.run(CoreStep.java:69)

at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47)

at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)

at java.util.concurrent.FutureTask.run(Unknown Source)

at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)

at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)

at java.lang.Thread.run(Unknown Source)

Caused by: javax.xml.bind.UnmarshalException

```

 

or ```scanforIssues``` from warnings ng plugin::

```

[Pipeline] { (Declarative: Post Actions)

[Pipeline] scanForIssues

[CPPCheck] [-ERROR-] Parsing of file 'C:\Users\anton\.jenkins\workspace\JOB4\cppcheck.xml' failed due to an exception:

[CPPCheck] [-ERROR-] com.ctc.wstx.exc.WstxUnexpectedCharException: Unexpected character 'C' (code 67) in prolog; expected '<'

 at [row,col {unknown-source}]: [1,1]

[CPPCheck] [-ERROR-]  at [row,col {unknown-source}]: [1,1]

[CPPCheck] [-ERROR-]  at com.ctc.wstx.sr.StreamScanner.throwUnexpectedChar(StreamScanner.java:648)

[CPPCheck] [-ERROR-]  at com.ctc.wstx.sr.BasicStreamReader.nextFromProlog(BasicStreamReader.java:2047)

[CPPCheck] [-ERROR-]  at com.ctc.wstx.sr.BasicStreamReader.next(BasicStreamReader.java:1069)

[CPPCheck] [-ERROR-]  at se.bjurr.violations.lib.parsers.CPPCheckParser.parseReportOutput(CPPCheckParser.java:43)

[CPPCheck] [-ERROR-]  at edu.hm.hafner.analysis.parser.violations.AbstractViolationAdapter.parse(AbstractViolationAdapter.java:35)

[CPPCheck] [-ERROR-]  at io.jenkins.plugins.analysis.core.model.FilesScanner.aggregateIssuesOfFile(FilesScanner.java:105)

[CPPCheck] [-ERROR-]  at io.jenkins.plugins.analysis.core.model.FilesScanner.scanFiles(FilesScanner.java:89)

[CPPCheck] [-ERROR-]  at io.jenkins.plugins.analysis.core.model.FilesScanner.invoke(FilesScanner.java:72)

[CPPCheck] [-ERROR-]  at io.jenkins.plugins.analysis.core.model.FilesScanner.invoke(FilesScanner.java:30)

[CPPCheck] [-ERROR-]  at hudson.FilePath.act(FilePath.java:1164)

[CPPCheck] [-ERROR-]  at hudson.FilePath.act(FilePath.java:1147)

[CPPCheck] [-ERROR-]  at io.jenkins.plugins.analysis.core.model.ReportScanningTool.scanInWorkspace(ReportScanningTool.java:152)

[CPPCheck] [-ERROR-]  at io.jenkins.plugins.analysis.core.model.ReportScanningTool.scan(ReportScanningTool.java:134)

[CPPCheck] [-ERROR-]  at io.jenkins.plugins.analysis.core.steps.IssuesScanner.scan(IssuesScanner.java:95)

[CPPCheck] [-ERROR-]  at io.jenkins.plugins.analysis.core.steps.ScanForIssuesStep$Execution.run(ScanForIssuesStep.java:214)

[CPPCheck] [-ERROR-]  at io.jenkins.plugins.analysis.core.steps.ScanForIssuesStep$Execution.run(ScanForIssuesStep.java:175)

[CPPCheck] [-ERROR-]  at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47)

[CPPCheck] [-ERROR-]  at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)

[CPPCheck] [-ERROR-]  at java.util.concurrent.FutureTask.run(Unknown Source)

[CPPCheck] [-ERROR-]  at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)

[CPPCheck] [-ERROR-]  at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)

[CPPCheck] [-ERROR-]  at java.lang.Thread.run(Unknown Source)

[CPPCheck] [-ERROR-]  [wrapped] edu.hm.hafner.analysis.ParsingException: Exception occurred during parsing

WstxUnexpectedCharException: Unexpected character 'C' (code 67) in prolog; expected '<'

 at [row,col {unknown-source}]: [1,1]

com.ctc.wstx.exc.WstxUnexpectedCharException: Unexpected character 'C' (code 67) in prolog; expected '<'

 at [row,col {unknown-source}]: [1,1]

at com.ctc.wstx.sr.StreamScanner.throwUnexpectedChar(StreamScanner.java:648)

at com.ctc.wstx.sr.BasicStreamReader.nextFromProlog(BasicStreamReader.java:2047)

at com.ctc.wstx.sr.BasicStreamReader.next(BasicStreamReader.java:1069)

at se.bjurr.violations.lib.parsers.CPPCheckParser.parseReportOutput(CPPCheckParser.java:43)

at edu.hm.hafner.analysis.parser.violations.AbstractViolationAdapter.parse(AbstractViolationAdapter.java:35)

at io.jenkins.plugins.analysis.core.model.FilesScanner.aggregateIssuesOfFile(FilesScanner.java:105)

at io.jenkins.plugins.analysis.core.model.FilesScanner.scanFiles(FilesScanner.java:89)

at io.jenkins.plugins.analysis.core.model.FilesScanner.invoke(FilesScanner.java:72)

at io.jenkins.plugins.analysis.core.model.FilesScanner.invoke(FilesScanner.java:30)

at hudson.FilePath.act(FilePath.java:1164)

at hudson.FilePath.act(FilePath.java:1147)

at io.jenkins.plugins.analysis.core.model.ReportScanningTool.scanInWorkspace(ReportScanningTool.java:152)

at io.jenkins.plugins.analysis.core.model.ReportScanningTool.scan(ReportScanningTool.java:134)

at io.jenkins.plugins.analysis.core.steps.IssuesScanner.scan(IssuesScanner.java:95)

at io.jenkins.plugins.analysis.core.steps.ScanForIssuesStep$Execution.run(ScanForIssuesStep.java:214)

at io.jenkins.plugins.analysis.core.steps.ScanForIssuesStep$Execution.run(ScanForIssuesStep.java:175)

at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47)

at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)

at java.util.concurrent.FutureTask.run(Unknown Source)

at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)

at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)

at java.lang.Thread.run(Unknown Source)

```

 

 

 

-- 
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/eefe0887-c933-4541-aab3-1f286c04b371n%40googlegroups.com.

 

 

-- 
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].

 

-- 
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].

 

-- 
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].

 

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/233a664a-9d1c-4833-b6e7-29f959b374cfn%40googlegroups.com.

 

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/A54FBCD1-C520-4109-9A5B-4CEECF0B8F4B%40gmail.com.

--
You received this message because you are subscribed to a topic in the Google Groups "Jenkins Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/jenkinsci-users/IEyGzpdo1-8/unsubscribe.
To unsubscribe from this group and all its topics, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/QB1PR01MB3844C2C47704FA2735D7C364CD619%40QB1PR01MB3844.CANPRD01.PROD.OUTLOOK.COM.

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CALZFchfsYmyonc-MPWFFt3yR_C_fSLs5VbO%2B%2B99jL9ZRVyxX%3Dg%40mail.gmail.com.

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/QB1PR01MB3844498655B66ADA3968555CCD619%40QB1PR01MB3844.CANPRD01.PROD.OUTLOOK.COM.
Reply | Threaded
Open this post in threaded view
|

Re: How to publish cppcheck results in a pipeline?

christop...@googlemail.com
Hi!

cppcheck has a command line argument to generate the proper xml-file, you don't have to pipe anything to a file.
This works for me:

cppcheck.exe --xml --output-file=cppcheck-result-all.xml  --enable=all .

I collect results like this:
recordIssues sourceCodeEncoding: 'ISO-8859-1', tools: [cppCheck(pattern:'**/cppcheck-result-*.xml', name: "CppCheck") ]

Best regards,
Christoph

Jérôme Godbout schrieb am Freitag, 26. März 2021 um 19:49:06 UTC+1:

I cannot recommend it since I haven’t try it out, but you can find many over here:

https://en.wikipedia.org/wiki/List_of_tools_for_static_code_analysis#C,_C++

 

 

Moved to Visual Studio since we already have the license. But this depends on your needs. Cppcheck work great with GUI but the CLI is retarded.

This is the command I used into Jenkins when I did tried cppcheck:

String cmd = "cppcheck --project=${scriptConfig} --xml --xml-version=2 ${otherOptions} 2> ${outputXml}";

The first –xml should not be necessary according to the doc, but I added it anyway just in case, but failure is unreliable like you did discover.

 

When I got time I would give https://codechecker.readthedocs.io/en/latest/ a go to see what it can do, it use llvm/clang with a better CLI

 

Jérôme Godbout, B. Ing.


Software / Firmware Team Lead
O: <a href="tel:(418)%20682-3636" value="+14186823636" target="_blank" rel="nofollow">(418) 682-3636 ext.: 114  

C: <a href="tel:(581)%20777-0050" value="+15817770050" target="_blank" rel="nofollow">(581) 777-0050 
[hidden email]

signature_1664488747

dimonoff.com

1015 Avenue Wilfrid-Pelletier, 

Québec, QC G1W 0C4, 4e étage

 

 

From: [hidden email] <[hidden email]> on behalf of jesus fernandez <[hidden email]>
Date: Friday, March 26, 2021 at 10:38 AM
To: [hidden email] <[hidden email]>
Subject: Re: How to publish cppcheck results in a pipeline?

Thanks Jerome I use sonarqube at the moment ( I am also learning on this one, but at least is working) but I wanted to check other alternatives as sonarqibe slow down the pipeline as it takes quiet some computing time. Would you recommend sonarqube over cppcheck for a jenkins pipeline? 

 

El vie., 26 mar. 2021 14:52, Jérôme Godbout <[hidden email]> escribió:

You probably need something like this:

cppcheck --xml-version=2 --enable=all <path1> <path2> 2>samplecppcheck.xml

 

https://stackoverflow.com/questions/10611011/cannot-generate-xml-output-from-cppcheck

 

cppcheck is a pain from command line, the command line was an after though, they screw big time. I stop using it just for that reason, the CLI is not matching the GUI and the results are unpredictable in case of errors. The fact that it requires the redirection of std_err, just that show a bad design from people who doesn’t give a damn about CLI. I strongly recommend you find something else to do your static analysis into your CI.

 

 

Jérôme Godbout, B. Ing.


Software / Firmware Team Lead
O: <a href="tel:(418)%20682-3636" value="+14186823636" target="_blank" rel="nofollow">(418) 682-3636 ext.: 114  

C: (581) 777-0050 
[hidden email]

signature_1613841900

dimonoff.com

1015 Avenue Wilfrid-Pelletier, 

Québec, QC G1W 0C4, 4e étage

 

 

From: [hidden email] <[hidden email]> on behalf of Ullrich Hafner <[hidden email]>
Date: Friday, March 26, 2021 at 7:44 AM
To: Jenkins Users <[hidden email]>
Subject: Re: How to publish cppcheck results in a pipeline?

I don’t know. Don’t you have a dedicated forum to ask cppcheck questions? 

 

I still do not understand why you are redirecting stdout or stderr. I would assume that every tool that creates XML files automatically creates the file in your workspace. Did you check the workspace if there is a file if you omit the redirect (>)?

 

 

Am 26.03.2021 um 11:28 schrieb jesus fernandez <[hidden email]>:

 

Thanks for the replies but how woud the command be then? something like this cppcheck "E:/Source" --force — enable=all — inconclusive — xml — xml-version=2 . > cppcheck.xm

El jueves, 25 de marzo de 2021 a las 21:49:15 UTC+1, ullrich...@gmail.com escribió:

Yes, this is definitely not XML :-)

This is the stderr of your program! 

 

2 > cppcheck.xml pipes your stderr to a file. You do not need this part. 

 

Am 25.03.2021 um 20:08 schrieb jesus fernandez <[hidden email]>:

 

so it seems like if it basically is writting all the outputs the cmd throws

El jueves, 25 de marzo de 2021 a las 20:07:20 UTC+1, jesus fernandez escribió:

the supposely .xml does not have any format, these are the first 5 lines:

Checking E:\Source\Game\AchievementManager.cpp ...

Checking E:\Source\Game\AchievementManager.cpp: APP_STEAM;FINAL_RELEASE;_DEBUG...

Checking E:\Source\Game\AchievementManager.cpp: APP_STEAM;NEED_AOE1DE_ACHIEVEMENT_TEST;_DEBUG...

Checking E:\Source\Game\AchievementManager.cpp: APP_STEAM;NEED_AOE3DE_ACHIEVEMENT_TEST;_DEBUG...

Checking E:\Source\Game\AchievementManager.cpp: APP_STEAM;_DEBUG...

 

El jueves, 25 de marzo de 2021 a las 19:47:22 UTC+1, [hidden email] escribió:

If you can’t check on your own if the file contains valid XML can you please show the first 5 lines of the XML file here?

 

Am 25.03.2021 um 19:36 schrieb jesus fernandez <[hidden email]>:

 

I thought the  ```bat'cppcheck "E:/Source" --force — enable=all — inconclusive — xml — xml-version=2 . 2 > cppcheck.xml'``` command does genearate a valid xml. is it a matter of missing parameters or a matter of having to parse the output? in the documentation and the SO link I attached it is supposed to be done like that... what am I missing here?

El jueves, 25 de marzo de 2021 a las 18:21:38 UTC+1, ullrich...@gmail.com escribió:

The exception says it is not a valid XML file. Is it a valid XML file? Seems that there is content before the fir XML tag. Can you open it in an editor that can validate the XML?

 

Am 25.03.2021 um 17:57 schrieb jesus fernandez <[hidden email]>:

 

Thanks for replying, I have opened and it has 2000 lines of code but I do not know if it is valid or not as I have never used cppcheck before, and if it is not valid is it because I am not using the right parameters when calling cppcheck or how?

 

 

El jueves, 25 de marzo de 2021 a las 17:44:44 UTC+1, ullrich...@gmail.com escribió:

It look like your create XML is not valid. Can you please open the XML file and check? 

 

Am 25.03.2021 um 17:40 schrieb jesus fernandez <[hidden email]>:

 

I am learning about Jenkins on my own, and I wanted to try the cppcheck plugin, I have setup the following sample pipeline:

```

pipeline {

    agent any

 

    stages {

        stage('analysis') {

            steps {

                script{

                    bat'cppcheck "E:/Source" --force — enable=all — inconclusive — xml — xml-version=2 . 2 > cppcheck.xml'

                }

            }

        }

    }

    post {

        always {

            // scanForIssues tool: cppCheck(pattern: 'cppcheck.xml')

            publishCppcheck pattern:'cppcheck.xml'

        }

    }

}

```

 

But I get an error in the post step which I do not know if it is related to my projecto or if I am doing something wrong. I have follow the instructions on this thread [cppcheck][1]but it does not seem to work, wehther I use ```publushCppcheck``` :

```

[Pipeline] { (Declarative: Post Actions)

[Pipeline] publishCppcheck (hide)

[Cppcheck] Starting the cppcheck analysis.

[Cppcheck] Processing 1 files with the pattern 'cppcheck.xml'.

[Cppcheck] Parsing throws exceptions. javax.xml.bind.UnmarshalException

 - with linked exception:

[org.xml.sax.SAXParseException; systemId: file:/C:/Users/anton/.jenkins/workspace/JOB4/cppcheck.xml; lineNumber: 1; columnNumber: 1; El contenido no está permitido en el prólogo.]

[Cppcheck] java.io.IOException: javax.xml.bind.UnmarshalException

 - with linked exception:

[org.xml.sax.SAXParseException; systemId: file:/C:/Users/anton/.jenkins/workspace/JOB4/cppcheck.xml; lineNumber: 1; columnNumber: 1; El contenido no está permitido en el prólogo.]

at org.jenkinsci.plugins.cppcheck.parser.CppcheckParser.parse(CppcheckParser.java:67)

at org.jenkinsci.plugins.cppcheck.CppcheckParserResult.invoke(CppcheckParserResult.java:69)

at org.jenkinsci.plugins.cppcheck.CppcheckParserResult.invoke(CppcheckParserResult.java:24)

at hudson.FilePath.act(FilePath.java:1164)

at hudson.FilePath.act(FilePath.java:1147)

at org.jenkinsci.plugins.cppcheck.CppcheckPublisher.perform(CppcheckPublisher.java:337)

at jenkins.tasks.SimpleBuildStep.perform(SimpleBuildStep.java:123)

at org.jenkinsci.plugins.workflow.steps.CoreStep$Execution.run(CoreStep.java:99)

at org.jenkinsci.plugins.workflow.steps.CoreStep$Execution.run(CoreStep.java:69)

at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47)

at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)

at java.util.concurrent.FutureTask.run(Unknown Source)

at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)

at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)

at java.lang.Thread.run(Unknown Source)

Caused by: javax.xml.bind.UnmarshalException

```

 

or ```scanforIssues``` from warnings ng plugin::

```

[Pipeline] { (Declarative: Post Actions)

[Pipeline] scanForIssues

[CPPCheck] [-ERROR-] Parsing of file 'C:\Users\anton\.jenkins\workspace\JOB4\cppcheck.xml' failed due to an exception:

[CPPCheck] [-ERROR-] com.ctc.wstx.exc.WstxUnexpectedCharException: Unexpected character 'C' (code 67) in prolog; expected '<'

 at [row,col {unknown-source}]: [1,1]

[CPPCheck] [-ERROR-]  at [row,col {unknown-source}]: [1,1]

[CPPCheck] [-ERROR-]  at com.ctc.wstx.sr.StreamScanner.throwUnexpectedChar(StreamScanner.java:648)

[CPPCheck] [-ERROR-]  at com.ctc.wstx.sr.BasicStreamReader.nextFromProlog(BasicStreamReader.java:2047)

[CPPCheck] [-ERROR-]  at com.ctc.wstx.sr.BasicStreamReader.next(BasicStreamReader.java:1069)

[CPPCheck] [-ERROR-]  at se.bjurr.violations.lib.parsers.CPPCheckParser.parseReportOutput(CPPCheckParser.java:43)

[CPPCheck] [-ERROR-]  at edu.hm.hafner.analysis.parser.violations.AbstractViolationAdapter.parse(AbstractViolationAdapter.java:35)

[CPPCheck] [-ERROR-]  at io.jenkins.plugins.analysis.core.model.FilesScanner.aggregateIssuesOfFile(FilesScanner.java:105)

[CPPCheck] [-ERROR-]  at io.jenkins.plugins.analysis.core.model.FilesScanner.scanFiles(FilesScanner.java:89)

[CPPCheck] [-ERROR-]  at io.jenkins.plugins.analysis.core.model.FilesScanner.invoke(FilesScanner.java:72)

[CPPCheck] [-ERROR-]  at io.jenkins.plugins.analysis.core.model.FilesScanner.invoke(FilesScanner.java:30)

[CPPCheck] [-ERROR-]  at hudson.FilePath.act(FilePath.java:1164)

[CPPCheck] [-ERROR-]  at hudson.FilePath.act(FilePath.java:1147)

[CPPCheck] [-ERROR-]  at io.jenkins.plugins.analysis.core.model.ReportScanningTool.scanInWorkspace(ReportScanningTool.java:152)

[CPPCheck] [-ERROR-]  at io.jenkins.plugins.analysis.core.model.ReportScanningTool.scan(ReportScanningTool.java:134)

[CPPCheck] [-ERROR-]  at io.jenkins.plugins.analysis.core.steps.IssuesScanner.scan(IssuesScanner.java:95)

[CPPCheck] [-ERROR-]  at io.jenkins.plugins.analysis.core.steps.ScanForIssuesStep$Execution.run(ScanForIssuesStep.java:214)

[CPPCheck] [-ERROR-]  at io.jenkins.plugins.analysis.core.steps.ScanForIssuesStep$Execution.run(ScanForIssuesStep.java:175)

[CPPCheck] [-ERROR-]  at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47)

[CPPCheck] [-ERROR-]  at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)

[CPPCheck] [-ERROR-]  at java.util.concurrent.FutureTask.run(Unknown Source)

[CPPCheck] [-ERROR-]  at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)

[CPPCheck] [-ERROR-]  at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)

[CPPCheck] [-ERROR-]  at java.lang.Thread.run(Unknown Source)

[CPPCheck] [-ERROR-]  [wrapped] edu.hm.hafner.analysis.ParsingException: Exception occurred during parsing

WstxUnexpectedCharException: Unexpected character 'C' (code 67) in prolog; expected '<'

 at [row,col {unknown-source}]: [1,1]

com.ctc.wstx.exc.WstxUnexpectedCharException: Unexpected character 'C' (code 67) in prolog; expected '<'

 at [row,col {unknown-source}]: [1,1]

at com.ctc.wstx.sr.StreamScanner.throwUnexpectedChar(StreamScanner.java:648)

at com.ctc.wstx.sr.BasicStreamReader.nextFromProlog(BasicStreamReader.java:2047)

at com.ctc.wstx.sr.BasicStreamReader.next(BasicStreamReader.java:1069)

at se.bjurr.violations.lib.parsers.CPPCheckParser.parseReportOutput(CPPCheckParser.java:43)

at edu.hm.hafner.analysis.parser.violations.AbstractViolationAdapter.parse(AbstractViolationAdapter.java:35)

at io.jenkins.plugins.analysis.core.model.FilesScanner.aggregateIssuesOfFile(FilesScanner.java:105)

at io.jenkins.plugins.analysis.core.model.FilesScanner.scanFiles(FilesScanner.java:89)

at io.jenkins.plugins.analysis.core.model.FilesScanner.invoke(FilesScanner.java:72)

at io.jenkins.plugins.analysis.core.model.FilesScanner.invoke(FilesScanner.java:30)

at hudson.FilePath.act(FilePath.java:1164)

at hudson.FilePath.act(FilePath.java:1147)

at io.jenkins.plugins.analysis.core.model.ReportScanningTool.scanInWorkspace(ReportScanningTool.java:152)

at io.jenkins.plugins.analysis.core.model.ReportScanningTool.scan(ReportScanningTool.java:134)

at io.jenkins.plugins.analysis.core.steps.IssuesScanner.scan(IssuesScanner.java:95)

at io.jenkins.plugins.analysis.core.steps.ScanForIssuesStep$Execution.run(ScanForIssuesStep.java:214)

at io.jenkins.plugins.analysis.core.steps.ScanForIssuesStep$Execution.run(ScanForIssuesStep.java:175)

at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47)

at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)

at java.util.concurrent.FutureTask.run(Unknown Source)

at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)

at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)

at java.lang.Thread.run(Unknown Source)

```

 

 

 

-- 
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/eefe0887-c933-4541-aab3-1f286c04b371n%40googlegroups.com.

 

 

-- 
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].

 

-- 
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].

 

-- 
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].

 

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/233a664a-9d1c-4833-b6e7-29f959b374cfn%40googlegroups.com.

 

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/A54FBCD1-C520-4109-9A5B-4CEECF0B8F4B%40gmail.com.

--
You received this message because you are subscribed to a topic in the Google Groups "Jenkins Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/jenkinsci-users/IEyGzpdo1-8/unsubscribe.
To unsubscribe from this group and all its topics, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/QB1PR01MB3844C2C47704FA2735D7C364CD619%40QB1PR01MB3844.CANPRD01.PROD.OUTLOOK.COM.

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/9746616b-995b-4f4c-8992-80e0a5e452f3n%40googlegroups.com.