| <?xml version="1.0"?> |
| <!-- |
| |
| Licensed to the Apache Software Foundation (ASF) under one or more |
| contributor license agreements. See the NOTICE file distributed with |
| this work for additional information regarding copyright ownership. |
| The ASF licenses this file to You under the Apache License, Version 2.0 |
| (the "License"); you may not use this file except in compliance with |
| the License. You may obtain a copy of the License at |
| |
| http://www.apache.org/licenses/LICENSE-2.0 |
| |
| Unless required by applicable law or agreed to in writing, software |
| distributed under the License is distributed on an "AS IS" BASIS, |
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| See the License for the specific language governing permissions and |
| limitations under the License. |
| |
| --> |
| <ruleset name="Naming Rules" |
| 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" |
| xsi:noNamespaceSchemaLocation="http://pmd.sf.net/ruleset_xml_schema.xsd"> |
| |
| <description> |
| The Basic As3 Ruleset contains a collection of good practices which everyone should follow. |
| </description> |
| |
| <rule class="org.apache.flex.pmd.rules.naming.TooShortVariableRule" |
| message="This variable name is too short ({0} characters minimum, but {1} actually)"> |
| <description>Detects when a field, local, or parameter has a very short name.</description> |
| <priority>5</priority> |
| <properties> |
| <property name="minimum"> |
| <value>3</value> |
| </property> |
| </properties> |
| <example> |
| public class Something |
| { |
| private var q : int = 15; // VIOLATION - Field |
| |
| public function foo( as : String ) : void // VIOLATION - Formal |
| { |
| var r : int = 20 + q; // VIOLATION - Local |
| } |
| } |
| </example> |
| </rule> |
| |
| <rule class="org.apache.flex.pmd.rules.naming.PackageCaseRule" |
| message="A package name should be lower case ({0})"> |
| <description>Detects when a package definition contains upper case characters.</description> |
| <priority>3</priority> |
| <example> |
| <![CDATA[ |
| package com.MyCompany // VIOLATION <- should be lower case name |
| { |
| public class SomeClass |
| { |
| } |
| } |
| ]]> |
| </example> |
| </rule> |
| |
| <rule class="org.apache.flex.pmd.rules.naming.VariableNameEndingWithNumericRule" |
| message="Using digits at the end of a symbol does not help understanging the meaning of it. ({0})"> |
| <priority>3</priority> |
| <example> |
| <![CDATA[ |
| public class SomeClass |
| { |
| public var correctField1 : int = 0; // VIOLATION <- numeric suffix is forbidden |
| } |
| ]]> |
| </example> |
| </rule> |
| |
| <rule class="org.apache.flex.pmd.rules.naming.PropertyHiddenByLocalVariableRule" |
| message="A class property is hidden by this local variable ({0})"> |
| <priority>3</priority> |
| <example> |
| public class SomeClass |
| { |
| public var myField : int = 0; |
| |
| public function foo() : void |
| { |
| var myField : int = 9; // VIOLATION |
| } |
| } |
| </example> |
| </rule> |
| |
| <rule class="org.apache.flex.pmd.rules.naming.IncorrectClassCase" |
| message="A class name must start by an uppercase character"> |
| <description></description> |
| <priority>3</priority> |
| <example> |
| public class foo // VIOLATION |
| { |
| } |
| </example> |
| </rule> |
| |
| <rule class="org.apache.flex.pmd.rules.naming.WronglyNamedVariableRule" |
| message="This variable ({0}) seems to be incorrectly named. Let your creativity flow"> |
| <priority>3</priority> |
| <example> |
| <![CDATA[ |
| public class SomeClass |
| { |
| public var myField : int = 0; // VIOLATION <- my prefix is forbidden |
| |
| public function tmpFoo() : void // VIOLATION <- tmp prefix is forbidden |
| { |
| var tempFoo : int = 9; // VIOLATION <- temp prefix is forbidden |
| } |
| } |
| ]]> |
| </example> |
| </rule> |
| |
| <rule class="org.apache.flex.pmd.rules.naming.BooleanAttributeShouldContainIsHasRule" |
| message="Differentiate the Boolean variables from other variable types ({0}); for example: canAnimate, isConnected, or hasChildren."> |
| <priority>5</priority> |
| </rule> |
| |
| <rule class="org.apache.flex.pmd.rules.naming.CapitalizeConstantsRule" |
| message="Constant variables should be in all CAPS with each word separated by an underscore ({0})"> |
| <priority>3</priority> |
| </rule> |
| |
| <rule class="org.apache.flex.pmd.rules.naming.InterfaceNamingRule" |
| message="Interface name should start with I"> |
| <priority>1</priority> |
| </rule> |
| |
| <rule class="org.apache.flex.pmd.rules.naming.TooLongFunctionNameRule" |
| message="This function name ({0}) is too long ({1} characters minimum, but {2} actually)"> |
| <priority>5</priority> |
| <properties> |
| <property name="minimum"> |
| <value>3</value> |
| </property> |
| </properties> |
| </rule> |
| |
| <rule class="org.apache.flex.pmd.rules.naming.IncorrectEventHandlerNameRule" |
| message="This event handler name ({0}) is not correct. You should use [{1}] as prefix and [{2}] as suffix"> |
| <priority>5</priority> |
| <properties> |
| <property name="prefix"> |
| <value>on</value> |
| </property> |
| <property name="suffix"> |
| <value></value> |
| </property> |
| </properties> |
| </rule> |
| </ruleset> |