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

FxCop results not being displayed for non-source files

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Won't Fix
    • Icon: Major Major
    • violations-plugin
    • Windows Server 2008 R2 Enterprise, Jenkins 1.510, Violations plugin 0.7.11

      If a violation is found (by FxCop) for which there is no source code (such as a DLL), the Violations plugin does not display the actual violation message (just blank page with a red triangle with an "!" in it).

      This appears to be due to the plugin only displaying the "popup-message" for the errors when the user mouses-over the warning in the code view.

      However, if there is no code to view, there is no method to display the violations. Also, the violation "message" section is not displayed in either case (it needs to be as it contains valuable information).

      More Info

      Specifying FxCop output (XML) file in the Violations plugin will cause the Violation plugin to parse the (FxCop) XML file(s) generating violation (XML) files for each file (each of these XML files can contain multiple violations). These (Violation plugin) XML files are stored in the "~\jobs\<jenkins_job_name>\builds\<build_date_&_time>\violations\file" folder with ".xml" appended to the original file name (e.g.: domain.interface.dll -> domain.interface.dll.xml). When the user clicks on a source file (within the Violations plugin results page, the Violations XML file is parsed and displayed on the screen.)

      Each of these (Violations plugin) XML files contain a "file", (multiple) "violation", "line" and "type" sections.

      File Section

      The "file" section (of the XML file) contains the file "name", "last-modified" date, and a link to the "file" (if applicable):

      <file name="Server/Project.Server/Project.Domain.Model/ImageMetaData.cs"
      last-modified="1365521927609" file="c:\Jenkins\workspace\Project_Server_FxCop\Server\Projecty.Server\Project.Domain.Model\ImageMetaData.cs"
      >

      Violations

      The "violations" section contain the "line", violation "source", violation "severity", violation "type", violation "message", violation "severity-level", and the violation "popup-message":

      <violation
      line="82"
      source="Naming#CA1702"
      severity="Medium High"
      type="fxcop"
      message="<a href="http://msdn.microsoft.com/library/bb264474(VS.100).aspx">CompoundWordsShouldBeCasedCorrectly</a> - In member 'ImageMetaData.IsMetaDataEqual(ImageMetaData)', the compound word 'MetaData' in parameter name 'imageMetaData' exists as a discrete term. If your usage is intended to be single word, case it as 'Metadata' or strip the first token entirely if it represents any sort of Hungarian notation."
      severity-level="1"
      popup-message="Avoid creating compound words from terms which exist in the dictionary as discrete terms. Do not create a compound word such as 'StopWatch' or 'PopUp'. These terms are recognized in the dictionary and should be cased as 'Stopwatch' and 'Popup'."
      />

      Line Number

      Next, the Violations XML file contains a section containing zero or multiple "line number" entries which contain code from the source file.

      <line number='81'> public virtual bool IsMetaDataEqual(ImageMetaData imageMetaData)</line>
      <line number='82'> {</line>
      <line number='83'> if (Hash == imageMetaData.Hash &&</line>
      <line number='84'> Type == imageMetaData.Type &&</line>
      <line number='85'> FileLength == imageMetaData.FileLength</line>
      <line number='86'> )</line>
      <line number='87'> {</line>

      Type

      Finally, the "type" section indicates that it is "fxcop" and also contains the total number of violations found:

      <type type='fxcop' number='2' suppressed='0'/>

      If the file does not contain code, then all the violation line numbers are set to 0 (zero) and there is no "line number" section in the Violations plugin XML files. (See attached files: "ImageMetaData.cs.xml" and "Project.Domain.Model.Interfaces.IProjectStub.xml")

      The problem is two-fold: First if the file is not a source code file then no violations are displayed at all (see attached screenshot). Second, the "message" data is not displayed in either case (and in most cases contains more valuable information than the "popup-message").

      The Violations plugin should display a table of the "messages" and "popup-messages" if there is no code to display, and the "messages" text should be added to the pop-up table when there is code to display.

            peterkittreilly peterkittreilly
            jeff_hughes Jeff Hughes
            Votes:
            6 Vote for this issue
            Watchers:
            9 Start watching this issue

              Created:
              Updated:
              Resolved: