• Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • violations-plugin
    • None

      Gendarme will report that it found 100 defects, but the violations plugin only shows 50 violations. Also it will put Type rule defects into the assembly file model.

          [JENKINS-11227] Gendarme does not show some violations

          Code changed in jenkins
          User: Erik Ramfelt
          Path:
          src/main/java/hudson/plugins/violations/types/gendarme/GendarmeParser.java
          src/test/java/hudson/plugins/violations/types/gendarme/GendarmeParserTest.java
          src/test/resources/hudson/plugins/violations/types/gendarme/gendarme-2.xml
          src/test/resources/hudson/plugins/violations/types/gendarme/gendarme-2_unix.xml
          http://jenkins-ci.org/commit/violations-plugin/8a6c7321f62c5803a3b477c4b5bf385cfe4ff35d
          Log:
          [FIXED JENKINS-11227] Fixed so the gendarme parser support multiple defects in a rule target, and Type and Method rule violations get the correct source file

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Erik Ramfelt Path: src/main/java/hudson/plugins/violations/types/gendarme/GendarmeParser.java src/test/java/hudson/plugins/violations/types/gendarme/GendarmeParserTest.java src/test/resources/hudson/plugins/violations/types/gendarme/gendarme-2.xml src/test/resources/hudson/plugins/violations/types/gendarme/gendarme-2_unix.xml http://jenkins-ci.org/commit/violations-plugin/8a6c7321f62c5803a3b477c4b5bf385cfe4ff35d Log: [FIXED JENKINS-11227] Fixed so the gendarme parser support multiple defects in a rule target, and Type and Method rule violations get the correct source file

          Code changed in jenkins
          User: Erik Ramfelt
          Path:
          src/main/java/hudson/plugins/violations/types/gendarme/GendarmeParser.java
          src/test/java/hudson/plugins/violations/types/gendarme/GendarmeParserTest.java
          src/test/resources/hudson/plugins/violations/types/gendarme/gendarme-2.xml
          src/test/resources/hudson/plugins/violations/types/gendarme/gendarme-2_unix.xml
          http://jenkins-ci.org/commit/violations-plugin/a2f3db98f5d9d6d020844e562bc4bc76eeab2627
          Log:
          JENKINS-11227 Fixed so the Critical severity is marked as High and not Medium

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Erik Ramfelt Path: src/main/java/hudson/plugins/violations/types/gendarme/GendarmeParser.java src/test/java/hudson/plugins/violations/types/gendarme/GendarmeParserTest.java src/test/resources/hudson/plugins/violations/types/gendarme/gendarme-2.xml src/test/resources/hudson/plugins/violations/types/gendarme/gendarme-2_unix.xml http://jenkins-ci.org/commit/violations-plugin/a2f3db98f5d9d6d020844e562bc4bc76eeab2627 Log: JENKINS-11227 Fixed so the Critical severity is marked as High and not Medium

          Robert Lieske added a comment -

          If there are two defects in a target, only the first one is recognized. Thats why a Gendarme run on Nunit-Money example shows 16 defects on console and in XML, but Jenkins-Violations plugin only reports 14 defects.

          The following is extracted from the generated XML:

          {{
          <rule Name="AvoidRepetitiveCastsRule" Uri="https://github.com/spouliot/gendarme/wiki/Gendarme.Rules.Performance.AvoidRepetitiveCastsRule(2.10)">
          <problem>The method seems to repeat the same cast operation multiple times.</problem>
          <solution>Change the logic to ensure the (somewhat expensive) cast is done once.</solution>
          <target Name="System.Boolean NUnit.Samples.Money.Money::Equals(System.Object)" Assembly="cs-money, Version=2.2.0.0, Culture=neutral, PublicKeyToken=null">
          <defect Severity="Medium" Confidence="Normal" Location="System.Boolean NUnit.Samples.Money.Money::Equals(System.Object)" Source="c:\test\money\Money.cs(≈60)">'anObject' is casted 2 times for type 'NUnit.Samples.Money.IMoney'.</defect>
          <defect Severity="Medium" Confidence="Normal" Location="System.Boolean NUnit.Samples.Money.Money::Equals(System.Object)" Source="c:\test\money\Money.cs(≈62)">'anObject' is casted 2 times for type 'NUnit.Samples.Money.Money'.</defect>
          </target>
          <target Name="System.Boolean NUnit.Samples.Money.MoneyBag::Equals(System.Object)" Assembly="cs-money, Version=2.2.0.0, Culture=neutral, PublicKeyToken=null">
          <defect Severity="Medium" Confidence="Normal" Location="System.Boolean NUnit.Samples.Money.MoneyBag::Equals(System.Object)" Source="c:\test\money\MoneyBag.cs(≈93)">'anObject' is casted 2 times for type 'NUnit.Samples.Money.IMoney'.</defect>
          <defect Severity="Medium" Confidence="Normal" Location="System.Boolean NUnit.Samples.Money.MoneyBag::Equals(System.Object)" Source="c:\test\money\MoneyBag.cs(≈96)">'anObject' is casted 2 times for type 'NUnit.Samples.Money.MoneyBag'.</defect>
          </target>
          </rule>
          }}

          Robert Lieske added a comment - If there are two defects in a target, only the first one is recognized. Thats why a Gendarme run on Nunit-Money example shows 16 defects on console and in XML, but Jenkins-Violations plugin only reports 14 defects. The following is extracted from the generated XML: {{ <rule Name="AvoidRepetitiveCastsRule" Uri="https://github.com/spouliot/gendarme/wiki/Gendarme.Rules.Performance.AvoidRepetitiveCastsRule(2.10)"> <problem>The method seems to repeat the same cast operation multiple times.</problem> <solution>Change the logic to ensure the (somewhat expensive) cast is done once.</solution> <target Name="System.Boolean NUnit.Samples.Money.Money::Equals(System.Object)" Assembly="cs-money, Version=2.2.0.0, Culture=neutral, PublicKeyToken=null"> <defect Severity="Medium" Confidence="Normal" Location="System.Boolean NUnit.Samples.Money.Money::Equals(System.Object)" Source="c:\test\money\Money.cs(≈60)">'anObject' is casted 2 times for type 'NUnit.Samples.Money.IMoney'.</defect> <defect Severity="Medium" Confidence="Normal" Location="System.Boolean NUnit.Samples.Money.Money::Equals(System.Object)" Source="c:\test\money\Money.cs(≈62)">'anObject' is casted 2 times for type 'NUnit.Samples.Money.Money'.</defect> </target> <target Name="System.Boolean NUnit.Samples.Money.MoneyBag::Equals(System.Object)" Assembly="cs-money, Version=2.2.0.0, Culture=neutral, PublicKeyToken=null"> <defect Severity="Medium" Confidence="Normal" Location="System.Boolean NUnit.Samples.Money.MoneyBag::Equals(System.Object)" Source="c:\test\money\MoneyBag.cs(≈93)">'anObject' is casted 2 times for type 'NUnit.Samples.Money.IMoney'.</defect> <defect Severity="Medium" Confidence="Normal" Location="System.Boolean NUnit.Samples.Money.MoneyBag::Equals(System.Object)" Source="c:\test\money\MoneyBag.cs(≈96)">'anObject' is casted 2 times for type 'NUnit.Samples.Money.MoneyBag'.</defect> </target> </rule> }}

            peterkittreilly peterkittreilly
            redsolo redsolo
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: