Mantis Bug Tracker

View Issue DetailsJump to Notes ] Wiki ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0000053jquantlib[All Projects] toolspublic2008-12-20 00:022009-03-09 00:12
ReporterRichard Gomes 
Assigned ToUeli Hofstetter 
PriorityhighSeveritymajorReproducibilityhave not tried
StatusclosedResolutionfixed 
PlatformOSOS Version
Product Version 
Target Version0.1.2Fixed in Version0.1.2 
Summary0000053: Create PMD rule which detects default package protected methods and classes
DescriptionCreate PMD rule which detects default package protected methods and classes.

This is a "marking task", i.e: once PMD produces the report, we need to create tasks for every case reported by PMD (or groups of cases, at least) and then solve all occurrences.
TagsNo tags attached.
Attached Files

- Relationships
child of 0000030closedRichard Gomes Remove Macker 

-  Notes
(0000103)
Richard Gomes (manager)
2009-02-02 02:34

* I've created colt.xml and fastutil.xml under directory src/main/pmd as example.

* I've integrated these 2 rulesets in pom.xml near line 900:
              <ruleset>${basedir}/src/main/pmd/colt.xml</ruleset>
              <ruleset>${basedir}/src/main/pmd/fastutil.xml</ruleset>

* The following articles explain how PMD rulesets can be created:
  http://pmd.sourceforge.net/howtowritearule.html [^]
  http://www.onjava.com/pub/a/onjava/2003/04/09/pmd_rules.html [^]
(0000108)
Ueli Hofstetter (developer)
2009-02-02 19:36

DefaultPackage rule is already there in controversial rules
(http://pmd.sourceforge.net/rules/controversial.html [^]), that detects
default package level fields and methods, are we looking to detect
nested classes too ?
(Satyendra)
(0000142)
Richard Gomes (manager)
2009-02-08 18:25

I've found the source for controversial.xml at
http://pmd.svn.sourceforge.net/viewvc/pmd/trunk/pmd/rulesets/java/controversial.xml?revision=6630&view=markup [^]

  286 <rule name="DefaultPackage"
  287 language="java"
  288 since="3.4"
  289 message="Use explicit scoping instead of the default package private level"
  290 class="net.sourceforge.pmd.lang.rule.XPathRule"
  291 externalInfoUrl="http://pmd.sourceforge.net/rules/java/controversial.html#DefaultPackage"> [^]
  292 <description>
  293 Use explicit scoping instead of the default package private level.
  294 </description>
  295 <priority>3</priority>
  296 <properties>
  297 <property name="xpath">
  298 <value><![CDATA[
  299 //ClassOrInterfaceDeclaration[@Interface='false']
  300 /ClassOrInterfaceBody
  301 /ClassOrInterfaceBodyDeclaration
  302 [
  303 FieldDeclaration[@PackagePrivate='true']
  304 or MethodDeclaration[@PackagePrivate='true']
  305 ]
  306 ]]></value>
  307 </property>
  308 </properties>
  309 </rule>

As far as I understood, class declarations (nested classes) are not detected, and it should, IMHO.
(0000147)
Ueli Hofstetter (developer)
2009-02-08 21:07

hi richard,

not sure whether i got what you mean. are we just looking for stuff like

class AClass{}

instead of

public/private/.. classAClass{} ?

i added such a rule (packageprivatclasses.xml). let me know if there are additional requirements, eg. inner (is that what you mean by nested?) classes etc.

cheers
(0000148)
Richard Gomes (manager)
2009-02-08 21:49

Yes, we are interested on detecting class declarations without public/protect/private.

I'm afraid you haven'n commited packageprivateclasses.xml yet.

Thanks
(0000237)
Richard Gomes (manager)
2009-03-09 00:12

Rule moved to architectural.xml

I've created 3 separate rules for:
* classes
* methods
* fields

- Issue History
Date Modified Username Field Change
2008-12-20 00:02 Richard Gomes New Issue
2008-12-27 14:18 Richard Gomes Description Updated
2009-01-25 22:41 Richard Gomes Target Version => 0.1.2
2009-01-25 23:25 Richard Gomes Relationship added child of 0000030
2009-02-02 02:34 Richard Gomes Note Added: 0000103
2009-02-02 19:36 Ueli Hofstetter Note Added: 0000108
2009-02-02 19:40 Ueli Hofstetter Status new => assigned
2009-02-02 19:40 Ueli Hofstetter Assigned To => Richard Gomes
2009-02-08 18:15 Richard Gomes Issue Monitored: Satyendra Gurjar
2009-02-08 18:15 Richard Gomes Issue Monitored: Srinivas Hasti
2009-02-08 18:15 Richard Gomes Issue Monitored: Dominik Holenstein
2009-02-08 18:16 Richard Gomes Issue Monitored: Ueli Hofstetter
2009-02-08 18:16 Richard Gomes Issue Monitored: Richard Gomes
2009-02-08 18:25 Richard Gomes Note Added: 0000142
2009-02-08 18:26 Richard Gomes Assigned To Richard Gomes => Ueli Hofstetter
2009-02-08 21:07 Ueli Hofstetter Note Added: 0000147
2009-02-08 21:07 Ueli Hofstetter Status assigned => feedback
2009-02-08 21:49 Richard Gomes Note Added: 0000148
2009-02-08 21:49 Richard Gomes Status feedback => assigned
2009-02-08 22:37 Ueli Hofstetter Status assigned => resolved
2009-02-08 22:37 Ueli Hofstetter Resolution open => fixed
2009-03-09 00:12 Richard Gomes Note Added: 0000237
2009-03-09 00:12 Richard Gomes Status resolved => closed
2009-03-09 00:12 Richard Gomes Fixed in Version => 0.1.2


Copyright © 2000 - 2009 MantisBT Group
Powered by Mantis Bugtracker