Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cpplint parser does not recognize any violations #35

Closed
stoesselt opened this issue Apr 11, 2018 · 7 comments
Closed

cpplint parser does not recognize any violations #35

stoesselt opened this issue Apr 11, 2018 · 7 comments
Labels

Comments

@stoesselt
Copy link

stoesselt commented Apr 11, 2018

Hi, I use the Violations Comments to Bitbucket Server plug-in with cpplint. However, the plug-in does not find any violations. Below the configuration:

image

The file 'cpplint-result.xml' is located directly in the workspace. Content of the file is similar to the test file (https://github.com/tomasbjerre/violations-lib/blob/master/src/test/resources/cpplint/cpplint.txt):

pump/src/gui/controls/List/Group.cpp:175:  Tab found; better to use spaces  [whitespace/tab] [1]
pump/src/gui/controls/List/Group.cpp:176:  Tab found; better to use spaces  [whitespace/tab] [1]
pump/src/gui/controls/List/Group.cpp:177:  Tab found; better to use spaces  [whitespace/tab] [1]
pump/src/gui/controls/List/Group.cpp:178:  Tab found; better to use spaces  [whitespace/tab] [1]
pump/src/gui/controls/List/Group.cpp:253:  Add #include <utility> for pair<>  [build/include_what_you_use] [4]

The paths are relative to the workspace. Any idea what the problem might be?

@tomasbjerre
Copy link
Owner

Perhaps with pattern .*cpplint-result\.xml$.

@stoesselt
Copy link
Author

The configuration parser: 'CPPLINT', pattern: 'cpplint-result\\.xml', reporter: 'cpplint' produces the output from above.

parser: 'CPPLINT', pattern: '.*cpplint-result\\.xml$', reporter: 'cpplint' produces

cpplint with pattern .*cpplint-result\.xml$
Pull request: 8
Workspace: /srv/www/jenkins/workspace/code_PR-8-BWGCGEBPCKOFJ5QP735MFKG5WMBGRXSII2IFEHXISDEQNHQF3ARA
java.lang.RuntimeException: java.nio.file.NoSuchFileException: /srv/www/jenkins/workspace/code_PR-8-BWGCGEBPCKOFJ5QP735MFKG5WMBGRXSII2IFEHXISDEQNHQF3ARA/sed1XSuFS
	at se.bjurr.violations.lib.reports.ReportsFinder.findAllReports(ReportsFinder.java:36)
	at se.bjurr.violations.lib.ViolationsApi.violations(ViolationsApi.java:52)
	at org.jenkinsci.plugins.jvctb.perform.JvctbPerformer.doPerform(JvctbPerformer.java:86)
	at org.jenkinsci.plugins.jvctb.perform.JvctbPerformer$1.invoke(JvctbPerformer.java:220)
	at org.jenkinsci.plugins.jvctb.perform.JvctbPerformer$1.invoke(JvctbPerformer.java:208)
	at hudson.FilePath.act(FilePath.java:1009)
	at hudson.FilePath.act(FilePath.java:987)
	at org.jenkinsci.plugins.jvctb.perform.JvctbPerformer.jvctsPerform(JvctbPerformer.java:207)
	at org.jenkinsci.plugins.jvctb.ViolationsToBitbucketServerRecorder.perform(ViolationsToBitbucketServerRecorder.java:66)
	at org.jenkinsci.plugins.workflow.steps.CoreStep$Execution.run(CoreStep.java:80)
	at org.jenkinsci.plugins.workflow.steps.CoreStep$Execution.run(CoreStep.java:67)
	at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution$1$1.call(SynchronousNonBlockingStepExecution.java:49)
	at hudson.security.ACL.impersonate(ACL.java:290)
	at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution$1.run(SynchronousNonBlockingStepExecution.java:46)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)
Caused by: java.nio.file.NoSuchFileException: /srv/www/jenkins/workspace/code_PR-8-BWGCGEBPCKOFJ5QP735MFKG5WMBGRXSII2IFEHXISDEQNHQF3ARA/sed1XSuFS
	at sun.nio.fs.UnixException.translateToIOException(UnixException.java:86)
	at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:102)
	at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:107)
	at sun.nio.fs.UnixFileAttributeViews$Basic.readAttributes(UnixFileAttributeViews.java:55)
	at sun.nio.fs.UnixFileSystemProvider.readAttributes(UnixFileSystemProvider.java:144)
	at sun.nio.fs.LinuxFileSystemProvider.readAttributes(LinuxFileSystemProvider.java:99)
	at java.nio.file.Files.readAttributes(Files.java:1737)
	at java.nio.file.FileTreeWalker.getAttributes(FileTreeWalker.java:219)
	at java.nio.file.FileTreeWalker.visit(FileTreeWalker.java:276)
	at java.nio.file.FileTreeWalker.next(FileTreeWalker.java:372)
	at java.nio.file.Files.walkFileTree(Files.java:2706)
	at java.nio.file.Files.walkFileTree(Files.java:2742)
	at se.bjurr.violations.lib.reports.ReportsFinder.findAllReports(ReportsFinder.java:22)
	... 18 more

parser: 'CPPLINT', pattern: '.*cpplint-result\.xml$', reporter: 'cpplint' produces

org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
WorkflowScript: 251: unexpected char: '\' @ line 251, column 53.
   T', pattern: '.*cpplint-result\.xml$', r
                                 ^

1 error

	at org.codehaus.groovy.control.ErrorCollector.failIfErrors(ErrorCollector.java:310)
	at org.codehaus.groovy.control.ErrorCollector.addFatalError(ErrorCollector.java:150)
	at org.codehaus.groovy.control.ErrorCollector.addError(ErrorCollector.java:120)
	at org.codehaus.groovy.control.ErrorCollector.addError(ErrorCollector.java:132)
	at org.codehaus.groovy.control.SourceUnit.addError(SourceUnit.java:350)
	at org.codehaus.groovy.antlr.AntlrParserPlugin.transformCSTIntoAST(AntlrParserPlugin.java:139)
	at org.codehaus.groovy.antlr.AntlrParserPlugin.parseCST(AntlrParserPlugin.java:110)
	at org.codehaus.groovy.control.SourceUnit.parse(SourceUnit.java:234)
	at org.codehaus.groovy.control.CompilationUnit$1.call(CompilationUnit.java:168)
	at org.codehaus.groovy.control.CompilationUnit.applyToSourceUnits(CompilationUnit.java:943)
	at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:605)
	at org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:581)
	at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:558)
	at groovy.lang.GroovyClassLoader.doParseClass(GroovyClassLoader.java:298)
	at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:268)
	at groovy.lang.GroovyShell.parseClass(GroovyShell.java:688)
	at groovy.lang.GroovyShell.parse(GroovyShell.java:700)
	at org.jenkinsci.plugins.workflow.cps.CpsGroovyShell.doParse(CpsGroovyShell.java:133)
	at org.jenkinsci.plugins.workflow.cps.CpsGroovyShell.reparse(CpsGroovyShell.java:127)
	at org.jenkinsci.plugins.workflow.cps.CpsFlowExecution.parseScript(CpsFlowExecution.java:559)
	at org.jenkinsci.plugins.workflow.cps.CpsFlowExecution.start(CpsFlowExecution.java:520)
	at org.jenkinsci.plugins.workflow.job.WorkflowRun.run(WorkflowRun.java:319)
	at hudson.model.ResourceController.execute(ResourceController.java:97)
	at hudson.model.Executor.run(Executor.java:429)

So first configuration seems to find the file, but cannot find any violations. The file cpplint-result.xml begins with:

Done processing pump/src/gui/controls/TextValueHolder.cpp
pump/src/hal/stm32f4xx/devices/spi/spi_unit0_com.c:737:  Using C-style cast.  Use reinterpret_cast<uint8_t *>(...) instead  [readability/casting] [4]

Maybe this might be a problem, because in the test file lines as the first are only stated after the violations.

tomasbjerre added a commit that referenced this issue Apr 13, 2018
@tomasbjerre
Copy link
Owner

I added a test case:
8455fc5

The file can be parsed and pattern .*cpplint-result\\.xml$ works.

I can't figure out what the your file sed1XSuFS is... But it looks like it is something special about it that cases the code to crash when traversing the file tree. It is not the actual parsing that crashes in your first exception, it is something about this file...

@stoesselt
Copy link
Author

There is no such file sed1XSuFS in the whole output and not in the workspace. It is only a guess, but is this line also parsed correctly? Maybe problems with number and non letters in the file path?

pump/src/hal/stm32f4xx/devices/display/s1d13781_blt.c:221:  Tab found; better to use spaces  [whitespace/tab] [1]
pump/src/hal/stm32f4xx/devices/display/s1d13781-blt.c:221:  Tab found; better to use spaces  [whitespace/tab] [1]

If this is also no problem, I would send the ouput via mail as the next step.

@tomasbjerre
Copy link
Owner

tomasbjerre commented Apr 13, 2018 via email

@stoesselt
Copy link
Author

It works now! To be honest, I don't know why.

cpplint with pattern .*cpplint-result\.xml$
Pull request: 8
Workspace: /srv/www/jenkins/workspace/code_PR-8-BWGCGEBPCKOFJ5QP735MFKG5WMBGRXSII2IFEHXISDEQNHQF3ARA
Found 7218 violations from ViolationConfig [pattern=.*cpplint-result\.xml$, reporter=cpplint, parser=CPPLINT].

(Hopefully most warnings come from auto-generated files. ^^)

I have just given it a another try, after you added the test case. I did a little change in the Jenkinsfile and it worked. I reverted that change, retested it and it still works, so the change cannot be the reason.

Anyway, there might be the risk that it stops working as suddenly as it started, but for now, I am happy ;-) Thank you very much for your excellent and quick support.

@tomasbjerre
Copy link
Owner

great!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants