Plugin idea: publish the analysis result (reading from the jxlint xml format)

38 views
Skip to first unread message

Jérémie Bresson

unread,
Aug 18, 2017, 7:41:39 AM8/18/17
to Jenkins Developers

Dear Jenkins Developers,

 

In the “Before starting a new plugin” section of the documentation, you mention that we should contact you.

 

JXLint is a framework to create static analysis tool (linter) in java. See http://selesse.com/jxlint/

I am working on a tool based on this framework.

There is the possibility to obtain an HTML report or to get an XML report that looks like this:

 

<?xml version="1.0" encoding="UTF-8"?>

<issues>

    <issue

        name="Lines should not be longer than 80 characters"

        severity="Warning"

        message="Line 2 is too long (length: 105)"

        category="Format"

        summary="The line length should be less than or equal to 80."

        explanation="In a text file (ending with `.txt`) the line should not be longer than 80 characters..."

        location="***/example-project-txt/src/file.txt"

        lineNumber="2"

    />

    <issue

        name="Multiple new lines at the end of the document"

        severity="Warning"

        message="Line 9 is one of the multiple empty new lines at the end of the document. This is not allowed"

        category="Format"

        summary="Text document should end with zero or one new line. Additional new lines should be removed."

        explanation="In a text file (ending with `.txt`) there should be no multiple new line at the end of the document..."

        location="***/example-project-txt/src/file.txt"

        lineNumber="9"

    />

</issues>

 

I would like to be able to see the results directly in Jenkins. There is already great support with the analysis-core functionality. I somehow need to bridge both frameworks together. This would be a new "jxlint-analysis-plugin" project (similar to "android-lint-plugin" for example https://wiki.jenkins.io/display/JENKINS/Android+Lint+Plugin ).

 

Features are straight forward:

  • This add a new post-processing build step
  • One input (configuration in the Job) to indicates where the xml Files are located.
  • During the build the files are parsed and transformed to the structure that Jenkins needs to produce its report.

Thank you in advance for your feedback,

 

Cheers,

Jérémie

Victor Martinez

unread,
Aug 18, 2017, 8:18:30 AM8/18/17
to Jenkins Developers
Maybe https://wiki.jenkins.io/display/JENKINS/xUnit+Plugin could be extended to support this use case?

Robert Sandell

unread,
Aug 18, 2017, 9:13:48 AM8/18/17
to jenkin...@googlegroups.com
Unit test reports and static analysis reports are not the same thing. Analysis-core would be the way to go iiuc.

/B

2017-08-18 14:18 GMT+02:00 Victor Martinez <victormar...@gmail.com>:
Maybe https://wiki.jenkins.io/display/JENKINS/xUnit+Plugin could be extended to support this use case?

--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-dev+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/187c0802-8500-4365-87fb-b788fc074c25%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
Robert Sandell
Software Engineer
CloudBees Inc.

Ullrich Hafner

unread,
Aug 18, 2017, 3:58:12 PM8/18/17
to Jenkins Developers
You don’t need to create a new plugin. What you need is an XML parser for the warnings plugin (which uses analysis-core). In [1] you find some hints on how to create your own parser. You can also look at some other XML parsers in the parsers package to see what actually needs to be done.

If your parser is ready, you can file a PR for this plugin in order to get the parser included for the next release. 



--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-de...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/82dedac3-1a57-4dca-b8fa-ba4c2e2950f6%40googlegroups.com.
signature.asc

Jérémie Bresson

unread,
Aug 19, 2017, 5:02:14 AM8/19/17
to Jenkins Developers
Thank you a lot for this pointer.

I know about the Warnings Plugin, but I was thinking that it parses Log Files (console or a specific configured file), line by line with a regex.
An XML Report is not a Log file and therefor I was thinking that I could not do it like this.

I will have a look at the source code.

Jérémie Bresson

unread,
Apr 18, 2019, 2:41:12 AM4/18/19
to Jenkins Developers
I know this thread is old, but I took time to work again on this idea.

Since then, the code was reorganized into:

I would like to collect feedback on the format that could be used, I have opened JENKINS-57098 to discuss this.

In particular, in the asciidoctor case, I am facing the fact that the log-appender that I can create is not notified when the analysis is terminated.
This means that working with a file format where I can just append a new record is easier... This is why I have switched from XML (where a root container is required) to a file containing a list of JSON structures on each line (à la logstash).

I would appreciate feedback...

Ullrich Hafner

unread,
Apr 18, 2019, 2:27:10 PM4/18/19
to Jenkins Developers
Am 18.04.2019 um 08:41 schrieb Jérémie Bresson <jebr...@gmail.com>:

I know this thread is old, but I took time to work again on this idea.

Since then, the code was reorganized into: 

I would like to collect feedback on the format that could be used, I have opened JENKINS-57098 to discuss this. 

In particular, in the asciidoctor case, I am facing the fact that the log-appender that I can create is not notified when the analysis is terminated.
This means that working with a file format where I can just append a new record is easier... This is why I have switched from XML (where a root container is required) to a file containing a list of JSON structures on each line (à la logstash).

I would appreciate feedback…

I’ll comment in Jira…  

Reply all
Reply to author
Forward
0 new messages