All Downloads are FREE. Search and download functionalities are using the official Maven repository.

rulesets.java.comments.xml Maven / Gradle / Ivy

There is a newer version: 2.0.9
Show newest version
<?xml version="1.0"?>

<ruleset name="Comments"
    xmlns="http://pmd.sourceforge.net/ruleset/2.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://pmd.sourceforge.net/ruleset/2.0.0 http://pmd.sourceforge.net/ruleset_2_0_0.xsd">

  <description>
Rules intended to catch errors related to code comments
  </description>

   <rule name="CommentRequired"
    		  since="5.1"
        message="Comment is required"
        class="net.sourceforge.pmd.lang.java.rule.comments.CommentRequiredRule"
          externalInfoUrl="https://pmd.github.io/pmd-5.4.1/pmd-java/rules/java/comments.html#CommentRequired">
    <description>
Denotes whether comments are required (or unwanted) for specific language elements.
    </description>
    <priority>3</priority>
    <example>
<![CDATA[
/**
* 
*
* @author George Bush
*/
]]>
    </example>
  </rule>
  
    <rule name="CommentSize"
    		  since="5.0"
        message="Comment is too large"
        class="net.sourceforge.pmd.lang.java.rule.comments.CommentSizeRule"
          externalInfoUrl="https://pmd.github.io/pmd-5.4.1/pmd-java/rules/java/comments.html#CommentSize">
    <description>
Determines whether the dimensions of non-header comments found are within the specified limits.
    </description>
    <priority>3</priority>
    <example>
<![CDATA[
/**
*
*	too many lines!
*
*
*
*
*
*
*
*
*
*
*
*
*/
]]>
    </example>
  </rule>

  <rule name="CommentContent"
    		  since="5.0"
     message="Invalid words or phrases found"
     class="net.sourceforge.pmd.lang.java.rule.comments.CommentContentRule"
          externalInfoUrl="https://pmd.github.io/pmd-5.4.1/pmd-java/rules/java/comments.html#CommentContent">
     <description>
A rule for the politically correct... we don't want to offend anyone.
  </description>
  <priority>3</priority>
  <example>
      <![CDATA[
//	OMG, this is horrible, Bob is an idiot !!!
      ]]>
  </example>
   </rule>

  <rule name="CommentDefaultAccessModifier"
      since="5.4.0"
      class="net.sourceforge.pmd.lang.java.rule.comments.CommentDefaultAccessModifierRule"
      message="Missing commented default access modifier"
      externalInfoUrl="https://pmd.github.io/pmd-5.4.1/pmd-java/rules/java/comments.html#CommentDefaultAccessModifier">
    <description>
        To avoid mistakes if we want that a Method, Field or Nested class have a default access modifier
        we must add a comment at the beginning of the Method, Field or Nested class.
        By default the comment must be /* default */, if you want another, you have to provide a regex.
    </description>
    <priority>3</priority>
    <properties>
        <property name="regex">
            <value>
                <![CDATA[
\/\*\s+default\s+\*\/
                ]]>
            </value>
        </property>
    </properties>
    <example>
        <![CDATA[
        public class Foo {
            final String stringValue = "some string";
            String getString() {
               return stringValue;
            }

            class NestedFoo {
            }
        }

        // should be
        public class Foo {
            /* default */ final String stringValue = "some string";
            /* default */ String getString() {
               return stringValue;
            }

            /* default */ class NestedFoo {
            }
        }
        ]]>
    </example>
  </rule>

 </ruleset>




© 2015 - 2025 Weber Informatics LLC | Privacy Policy