Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-5195

Expose more analysis details via API

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      I would like to be able to generate emails that tell users the new (and maybe also fixed) warnings for the reports generated via the static analysis plugin. I didn't see a 'Component' for that, so although this is filed for 'findbugs', I'd really like to see it for pmd and cpd as well.

      I would like to be able to generate a report that includes, for each new/fixed violation:

      The file name.
      A link to the file source.
      The violation details: category, rule, description.

      Basically, everything I see when I go to findbugsResult/new/tab.all/?, which is something like this:

      ----- example ------

      File: I18nContextImpl.java, Line: 47, Type: HE_EQUALS_USE_HASHCODE, Priority: High, Category: BAD_PRACTICE

      cj.internationalization.I18nContextImpl defines equals and uses Object.hashCode()

      This class overrides equals(Object), but does not override hashCode(), and inherits the implementation of hashCode() from java.lang.Object (which returns the identity hash code, an arbitrary value assigned to the object by the VM). Therefore, the class is very likely to violate the invariant that equal objects must have equal hashcodes.

      If you don't think instances of this class will ever be inserted into a HashMap/HashTable, the recommended hashCode implementation to use is:

      public int hashCode()

      { assert false : "hashCode not designed"; return 42; // any arbitrary constant will do }

      --------------------

      If all those bits were in an xml document with nice descriptive tags (and of course the URL for the file details exposed), that would be awesome. Then I could mix and match as our needs evolve. For example, to start with, I would include all the details in the email, but later probably just the summary ("cj.internationalization.I18nContextImpl defines equals and uses Object.hashCode()") as a link to the source code.

      With the file name and path, I should be able to poll the source control to determine who checked in the file last, and therefore who to blame.

      Thanks!

        Attachments

          Activity

          emmulator emmulator created issue -
          drulli Ulli Hafner made changes -
          Field Original Value New Value
          Status Open [ 1 ] In Progress [ 3 ]
          drulli Ulli Hafner made changes -
          Component/s pmd [ 15511 ]
          Component/s warnings [ 15513 ]
          Component/s checkstyle [ 15512 ]
          Component/s tasks-plugin [ 15498 ]
          Component/s dry [ 15591 ]
          Hide
          scm_issue_link SCM/JIRA link daemon added a comment -

          Code changed in hudson
          User: : drulli
          Path:
          trunk/hudson/plugins/analysis-core/go.sh
          trunk/hudson/plugins/analysis-core/src/main/java/hudson/plugins/analysis/core/BuildResult.java
          trunk/hudson/plugins/analysis-core/src/main/java/hudson/plugins/analysis/util/model/AbstractAnnotation.java
          http://fisheye4.cenqua.com/changelog/hudson/?cs=25756
          Log:
          [FIXED JENKINS-5195]: Expose more analysis details via API.

          Show
          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in hudson User: : drulli Path: trunk/hudson/plugins/analysis-core/go.sh trunk/hudson/plugins/analysis-core/src/main/java/hudson/plugins/analysis/core/BuildResult.java trunk/hudson/plugins/analysis-core/src/main/java/hudson/plugins/analysis/util/model/AbstractAnnotation.java http://fisheye4.cenqua.com/changelog/hudson/?cs=25756 Log: [FIXED JENKINS-5195] : Expose more analysis details via API.
          scm_issue_link SCM/JIRA link daemon made changes -
          Status In Progress [ 3 ] Resolved [ 5 ]
          Resolution Fixed [ 1 ]
          Hide
          emmulator emmulator added a comment -

          I just got the new version and the improvements are great – thanks!

          There's just one part missing that I'd like to see, and that's a way to link to the source of the warning, which was one of the things I asked for in the original request. If there's an easy way for me to derive the URL from what's currently in the warning, please let me know. Otherwise, would it be difficult to include a link in the data provided by the API?

          Thanks again!

          Show
          emmulator emmulator added a comment - I just got the new version and the improvements are great – thanks! There's just one part missing that I'd like to see, and that's a way to link to the source of the warning, which was one of the things I asked for in the original request. If there's an easy way for me to derive the URL from what's currently in the warning, please let me know. Otherwise, would it be difficult to include a link in the data provided by the API? Thanks again!
          Hide
          drulli Ulli Hafner added a comment -

          With link to the source you don't mean the filename of the warning? What should be the target of the link? The detail page of the rendered source code of the Hudson server?

          Show
          drulli Ulli Hafner added a comment - With link to the source you don't mean the filename of the warning? What should be the target of the link? The detail page of the rendered source code of the Hudson server?
          Hide
          emmulator emmulator added a comment -

          Yes, please. The rendered source with the highlighted violation. Since the URL for this seems to be some ids rather than anything I can derive from the filename itself, it would be nice to have the link provided. Thanks!

          Show
          emmulator emmulator added a comment - Yes, please. The rendered source with the highlighted violation. Since the URL for this seems to be some ids rather than anything I can derive from the filename itself, it would be nice to have the link provided. Thanks!
          Hide
          drulli Ulli Hafner added a comment -

          Hmm, I can add a relative link from the results page, i.e. something like "source.${warning.key}/#${warning.primaryLineNumber}". However, the warning does not know its prefix URL (since it could be rendered in different views). Is that sufficient? I think you need to know the prefix in your script anyway, since it is the same prefix as the call to the remote API.

          Show
          drulli Ulli Hafner added a comment - Hmm, I can add a relative link from the results page, i.e. something like "source.${warning.key}/#${warning.primaryLineNumber}". However, the warning does not know its prefix URL (since it could be rendered in different views). Is that sufficient? I think you need to know the prefix in your script anyway, since it is the same prefix as the call to the remote API.
          Hide
          emmulator emmulator added a comment -

          Yes, that would work. Or, if it would seem cleaner to you, now that I know the pattern, if you just exposed the warning.key I could build that path myself, right?

          Show
          emmulator emmulator added a comment - Yes, that would work. Or, if it would seem cleaner to you, now that I know the pattern, if you just exposed the warning.key I could build that path myself, right?
          Hide
          drulli Ulli Hafner added a comment -

          That would be even better Then the warning does not need to know how it will be shown in any view.

          Show
          drulli Ulli Hafner added a comment - That would be even better Then the warning does not need to know how it will be shown in any view.
          Hide
          scm_issue_link SCM/JIRA link daemon added a comment -

          Code changed in hudson
          User: : drulli
          Path:
          trunk/hudson/plugins/analysis-core/src/main/java/hudson/plugins/analysis/util/model/AbstractAnnotation.java
          http://jenkins-ci.org/commit/26951
          Log:
          JENKINS-5195 Added warning key to the exposed API.

          Show
          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in hudson User: : drulli Path: trunk/hudson/plugins/analysis-core/src/main/java/hudson/plugins/analysis/util/model/AbstractAnnotation.java http://jenkins-ci.org/commit/26951 Log: JENKINS-5195 Added warning key to the exposed API.
          Hide
          emmulator emmulator added a comment -

          Awesome – thanks!

          Show
          emmulator emmulator added a comment - Awesome – thanks!
          abayer Andrew Bayer made changes -
          Status Resolved [ 5 ] Closed [ 6 ]
          rtyler R. Tyler Croy made changes -
          Workflow JNJira [ 135284 ] JNJira + In-Review [ 203381 ]

            People

            • Assignee:
              drulli Ulli Hafner
              Reporter:
              emmulator emmulator
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: