Mojo

Parent dashboard report is inconsistent with the child dashboard reports

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: None
  • Fix Version/s: None
  • Component/s: dashboard
  • Labels:
    None
  • Environment:
    Maven version: 2.0.8
    Java version: 1.4.2
    OS name: "windows xp" version: "5.1" arch: "x86" Family: "windows"
  • Complexity:
    Intermediate
  • Number of attachments :
    1

Description

I found that the number of errors per checkstyle categories (element <checkstyleerror>) of the children is incorrect in the dashboard-report.xml file(Parent dashboard report) .

For example, you have a parent project and two children: A and B. Now child A has 10 errors of category1 and child B has 16 errors of category1. The parent should have in total 26 errors of category1 but the parent dashboard displays 26 errors of category1 for child B instead of 16.

In the dashboard report of children:

child A:
<module>
< org.codehaus.mojo.dashboard.report.plugin.beans.CheckstyleReportBean>
<errors>
            <checkstyleerror>
                    <category>category1</category>
                     <nberror>10</nberror>
            </checkstyleerror>
</errors>
< org.codehaus.mojo.dashboard.report.plugin.beans.CheckstyleReportBean>
</module>
child B:
<module>
< org.codehaus.mojo.dashboard.report.plugin.beans.CheckstyleReportBean>
<errors>
            <checkstyleerror>

                    <category>category1</category>
                     <nberror>16</nberror>
            </checkstyleerror>
</errors>
< org.codehaus.mojo.dashboard.report.plugin.beans.CheckstyleReportBean>
</module>

In the Parent dashboard report :

parent (contains Child A and Child B):
***********************************child A*******************************************

<module>
< org.codehaus.mojo.dashboard.report.plugin.beans.CheckstyleReportBean>
<errors>
            <checkstyleerror>
                    <category>category1</category>
                     <nberror>10</nberror>
            </checkstyleerror>
</errors>
< org.codehaus.mojo.dashboard.report.plugin.beans.CheckstyleReportBean>
</module>
 
***********************************child B*******************************************
<module>
< org.codehaus.mojo.dashboard.report.plugin.beans.CheckstyleReportBean>
<errors>
            <checkstyleerror>

                    <category>category1</category>
                     <nberror>26</nberror>
            </checkstyleerror>
</errors>
< org.codehaus.mojo.dashboard.report.plugin.beans.CheckstyleReportBean>
</module>
***********************************parent*******************************************
<report>
< org.codehaus.mojo.dashboard.report.plugin.beans.CheckstyleReportBean>
<errors>
            <checkstyleerror>
                    <category>category1</category>
                     <nberror>26</nberror>
            </checkstyleerror>
</errors>
< org.codehaus.mojo.dashboard.report.plugin.beans.CheckstyleReportBean>
</report>

Find attached the sample dashboard-report.xml .

The error according to me is with the method addAllError( List errorsList ) of the CheckstyleReportBean.java file.

Activity

Hide
David Vicente added a comment -

Could you give as attachment a sample project with your checkstyle xml file ?

Best regards

David Vicente

Show
David Vicente added a comment - Could you give as attachment a sample project with your checkstyle xml file ? Best regards David Vicente
Hide
vishwanee Haranghi added a comment -

Please find attached the sample project with checkstyle-report.xml.

i have also found that when tried to persist the detailed checkstyle error for 4 projects (3 children and 1 parent), only 3 project get persisted (2 children and 1 parent).

For 3 projects (2 children and 1 parent), only 2 project get persisted (1 child and 1 parent).

The following modification was made to the dashboard.hbm.xml to persist the detailed checkstyle error:

<class name="CheckstyleReportBean"
		table="CheckstyleReportBean">
		<id name="id" type="long" column="report_id">
			<generator class="native" />
		</id>
		<many-to-one name="mavenProject" column="MAVENPROJECT_ID"
			class="DashBoardMavenProject" />
		<property name="dateGeneration" column="dateGeneration"
			type="timestamp" />
		<property name="nbClasses" column="nbClasses" type="int" />
		<property name="nbInfos" column="nbInfos" type="int" />
		<property name="nbErrors" column="nbErrors" type="int" />
		<property name="nbWarnings" column="nbWarnings" type="int" />
		<property name="nbTotal" column="nbTotal" type="int" />
		
		<list name="errors" cascade="all">
            <key column="report_id"/>
            <index column="id_list" /> 
            <one-to-many class="CheckstyleError"/>
        </list>
 
		
		<query name="getCheckstyleByDashBoardMavenProjectID">
			<![CDATA[
		select c from CheckstyleReportBean c,DashBoardMavenProject m where c.mavenProject = m and m.id = :id
		]]>
		</query>
		<query name="getCheckstyleByPeriod">
			<![CDATA[
		select c from CheckstyleReportBean c,DashBoardMavenProject m where c.mavenProject = m and m.id = :id and c.dateGeneration >= :startdate and c.dateGeneration <= :enddate 
		]]>
		</query>
	</class>

 <class name="CheckstyleError" table="CheckstyleError">
		 <id name="id" type="long" column="id">
			<generator class="native" />
		</id> 
		<property name="nameClass" column="nameClass" type="string" />
		<property name="type" column="type" type="string" />
		<property name="message" column="message" type="string" />
		<property name="nbIteration" column="nbErrors" type="int" />
		<many-to-one name="checkstyleReportBean" class="CheckstyleReportBean" column="report_id"/>

	</class>

The following attributes should also be added in the CheckstyleError.java file:

private long id;

private CheckstyleReportBean checkstyleReportBean;

Show
vishwanee Haranghi added a comment - Please find attached the sample project with checkstyle-report.xml. i have also found that when tried to persist the detailed checkstyle error for 4 projects (3 children and 1 parent), only 3 project get persisted (2 children and 1 parent). For 3 projects (2 children and 1 parent), only 2 project get persisted (1 child and 1 parent). The following modification was made to the dashboard.hbm.xml to persist the detailed checkstyle error:
<class name="CheckstyleReportBean"
		table="CheckstyleReportBean">
		<id name="id" type="long" column="report_id">
			<generator class="native" />
		</id>
		<many-to-one name="mavenProject" column="MAVENPROJECT_ID"
			class="DashBoardMavenProject" />
		<property name="dateGeneration" column="dateGeneration"
			type="timestamp" />
		<property name="nbClasses" column="nbClasses" type="int" />
		<property name="nbInfos" column="nbInfos" type="int" />
		<property name="nbErrors" column="nbErrors" type="int" />
		<property name="nbWarnings" column="nbWarnings" type="int" />
		<property name="nbTotal" column="nbTotal" type="int" />
		
		<list name="errors" cascade="all">
            <key column="report_id"/>
            <index column="id_list" /> 
            <one-to-many class="CheckstyleError"/>
        </list>
 
		
		<query name="getCheckstyleByDashBoardMavenProjectID">
			<![CDATA[
		select c from CheckstyleReportBean c,DashBoardMavenProject m where c.mavenProject = m and m.id = :id
		]]>
		</query>
		<query name="getCheckstyleByPeriod">
			<![CDATA[
		select c from CheckstyleReportBean c,DashBoardMavenProject m where c.mavenProject = m and m.id = :id and c.dateGeneration >= :startdate and c.dateGeneration <= :enddate 
		]]>
		</query>
	</class>

 <class name="CheckstyleError" table="CheckstyleError">
		 <id name="id" type="long" column="id">
			<generator class="native" />
		</id> 
		<property name="nameClass" column="nameClass" type="string" />
		<property name="type" column="type" type="string" />
		<property name="message" column="message" type="string" />
		<property name="nbIteration" column="nbErrors" type="int" />
		<many-to-one name="checkstyleReportBean" class="CheckstyleReportBean" column="report_id"/>

	</class>
The following attributes should also be added in the CheckstyleError.java file: private long id; private CheckstyleReportBean checkstyleReportBean;
Hide
David Vicente added a comment -

Ok done.

The same problem exists with Findbugs.

The Clone method for these beans must be "deep" (for objects list).

I hope to deploy a new snapshot release this afternoon.

No persistance of CheckstyleError value is planned at this time. If you want some help, contact me with my gmail adress

Show
David Vicente added a comment - Ok done. The same problem exists with Findbugs. The Clone method for these beans must be "deep" (for objects list). I hope to deploy a new snapshot release this afternoon. No persistance of CheckstyleError value is planned at this time. If you want some help, contact me with my gmail adress
Hide
David Vicente added a comment -

desployed the 2008-04-05 as 1.0-SNAPSHOT ( dashboard-maven-plugin-1.0-20080405.182352-19.jar)

Show
David Vicente added a comment - desployed the 2008-04-05 as 1.0-SNAPSHOT ( dashboard-maven-plugin-1.0-20080405.182352-19.jar)

People

Vote (0)
Watch (1)

Dates

  • Created:
    Updated:
    Resolved: