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

Expose more analysis details via API

    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

          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!

            People

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

              Dates

              • Created:
                Updated:
                Resolved: