Changeset 23273


Ignore:
Timestamp:
2013/11/18 12:00:25 (8 years ago)
Author:
kimoto
Message:

ref #150 rulesetがsampleのままで現実に即していないのでPSR2に変更

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/version-2_13-dev/tests/ruleset.xml

    r22128 r23273  
    11<?xml version="1.0"?> 
    2 <ruleset name="Sample"> 
    3  <description>A sample coding standard</description> 
     2<ruleset name="PSR2"> 
     3 <description>The PSR-2 coding standard.</description> 
    44 
    5  <!-- Include all sniffs in the PEAR standard --> 
    6  <rule ref="Zend"> 
    7    <exclude name="Generic.Functions.OpeningFunctionBraceBsdAllman.BraceOnSameLine"/> 
    8    <exclude name="Zend.NamingConventions.ValidVariableName.NotCamelCaps"/> 
    9    <exclude name="PEAR.Classes.ClassDeclaration.OpenBraceNewLine"/> 
    10  </rule> 
     5 <!-- 2. General --> 
    116 
    12  <!-- Include some specific sniffs --> 
    13  <rule ref="Generic.ControlStructures.InlineControlStructure"/> 
    14  <rule ref="Generic.Functions.FunctionCallArgumentSpacing"/> 
     7 <!-- 2.1 Basic Coding Standard --> 
    158 
    16  <!-- Change the settings of the Line Length sniff --> 
    17  <rule ref="Generic.Files.LineLength"> 
     9 <!-- Include the whole PSR-1 standard --> 
     10 <rule ref="PSR1"/> 
     11 
     12 <!-- 2.2 Files --> 
     13 
     14 <!-- All PHP files MUST use the Unix LF (linefeed) line ending. --> 
     15 <rule ref="Generic.Files.LineEndings"> 
    1816  <properties> 
    19    <property name="lineLimit" value="80"/> 
    20    <property name="absoluteLineLimit" value="200"/> 
     17   <property name="eolChar" value="\n"/> 
    2118  </properties> 
    2219 </rule> 
    2320 
    24   <!-- Change both Line Length messages --> 
    25  <rule ref="Generic.Files.LineLength.MaxExceeded"> 
    26   <message>Line longer than the max of %s; has %s chars</message> 
    27  </rule> 
    28  <rule ref="Generic.Files.LineLength.TooLong"> 
    29   <message>Line longer than %s chars; has %s chars</message> 
     21 <!-- All PHP files MUST end with a single blank line. --> 
     22 <!-- checked in Files/EndFileNewlineSniff --> 
     23 
     24 <!-- The closing ?> tag MUST be omitted from files containing only PHP. --> 
     25 <rule ref="Zend.Files.ClosingTag"/> 
     26 
     27 <!-- 2.3 Lines --> 
     28 
     29 <!-- The soft limit on line length MUST be 120 characters; automated style checkers MUST warn but MUST NOT error at the soft limit. --> 
     30 <rule ref="Generic.Files.LineLength"> 
     31  <properties> 
     32   <property name="lineLimit" value="120"/> 
     33   <property name="absoluteLineLimit" value="0"/> 
     34  </properties> 
    3035 </rule> 
    3136 
    32  <!-- Disable internal message for missing code and short open tags --> 
    33  <rule ref="Internal.NoCodeFound"> 
     37 <!-- There MUST NOT be trailing whitespace at the end of non-blank lines. --> 
     38 <rule ref="Squiz.WhiteSpace.SuperfluousWhitespace"> 
     39  <properties> 
     40   <property name="ignoreBlankLines" value="true"/> 
     41   </properties> 
     42 </rule> 
     43 <rule ref="Squiz.WhiteSpace.SuperfluousWhitespace.StartFile"> 
    3444  <severity>0</severity> 
    3545 </rule> 
    36 </ruleset>  
     46 <rule ref="Squiz.WhiteSpace.SuperfluousWhitespace.EndFile"> 
     47  <severity>0</severity> 
     48 </rule> 
     49 <rule ref="Squiz.WhiteSpace.SuperfluousWhitespace.EmptyLines"> 
     50  <severity>0</severity> 
     51 </rule> 
    3752 
     53 <!-- There MUST NOT be more than one statement per line. --> 
     54 <rule ref="Generic.Formatting.DisallowMultipleStatements"/> 
     55 
     56 <!-- 2.4 Indenting --> 
     57 
     58 <!-- Code MUST use an indent of 4 spaces, and MUST NOT use tabs for indenting. --> 
     59 <rule ref="Generic.WhiteSpace.ScopeIndent"> 
     60  <properties> 
     61   <property name="ignoreIndentationTokens" type="array" value="T_COMMENT,T_DOC_COMMENT"/> 
     62  </properties> 
     63 </rule> 
     64 <rule ref="Generic.WhiteSpace.DisallowTabIndent"/> 
     65 
     66 <!-- 2.5 Keywords and True/False/Null --> 
     67 
     68 <!-- PHP keywords MUST be in lower case. --> 
     69 <rule ref="Generic.PHP.LowerCaseKeyword"/> 
     70 
     71 <!-- The PHP constants true, false, and null MUST be in lower case. --> 
     72 <rule ref="Generic.PHP.LowerCaseConstant"/> 
     73 
     74 <!-- 3. Namespace and Use Declarations --> 
     75 
     76 <!-- When present, there MUST be one blank line after the namespace declaration. --> 
     77 <!-- checked in Namespaces/NamespaceDeclarationSniff --> 
     78 
     79 <!-- When present, all use declarations MUST go after the namespace declaration. 
     80      There MUST be one use keyword per declaration. 
     81      There MUST be one blank line after the use block. --> 
     82 <!-- checked in Namespaces/UseDeclarationSniff --> 
     83 
     84 <!-- 4. Classes, Properties, and Methods --> 
     85 
     86 <!-- 4.1. Extends and Implements --> 
     87 
     88 <!-- The extends and implements keywords MUST be declared on the same line as the class name. 
     89      The opening brace for the class go MUST go on its own line; the closing brace for the class MUST go on the next line after the body. 
     90      Lists of implements MAY be split across multiple lines, where each subsequent line is indented once. When doing so, the first item in the list MUST be on the next line, and there MUST be only one interface per line. --> 
     91 <!-- checked in Classes/ClassDeclarationSniff --> 
     92 
     93 <!-- 4.2. Properties --> 
     94 
     95 <!-- Visibility MUST be declared on all properties. 
     96      The var keyword MUST NOT be used to declare a property. 
     97      There MUST NOT be more than one property declared per statement. 
     98      Property names SHOULD NOT be prefixed with a single underscore to indicate protected or private visibility. --> 
     99 <!-- checked in Classes/PropertyDeclarationSniff --> 
     100 
     101 <!-- 4.3 Methods --> 
     102 
     103 <!-- Visibility MUST be declared on all methods. --> 
     104 <rule ref="Squiz.Scope.MethodScope"/> 
     105 <rule ref="Squiz.WhiteSpace.ScopeKeywordSpacing"/> 
     106 
     107 <!-- Method names SHOULD NOT be prefixed with a single underscore to indicate protected or private visibility. --> 
     108 <!-- checked in Methods/MethodDeclarationSniff --> 
     109 
     110 <!-- Method names MUST NOT be declared with a space after the method name. The opening brace MUST go on its own line, and the closing brace MUST go on the next line following the body. There MUST NOT be a space after the opening parenthesis, and there MUST NOT be a space before the closing parenthesis. --> 
     111 <rule ref="Squiz.Functions.FunctionDeclaration"/> 
     112 <rule ref="Squiz.Functions.LowercaseFunctionKeywords"/> 
     113 
     114 <!-- 4.4 Method Arguments --> 
     115 
     116 <!-- In the argument list, there MUST NOT be a space before each comma, and there MUST be one space after each comma. --> 
     117 <rule ref="Squiz.Functions.FunctionDeclarationArgumentSpacing"> 
     118  <properties> 
     119   <property name="equalsSpacing" value="1"/> 
     120  </properties> 
     121 </rule> 
     122 <rule ref="Squiz.Functions.FunctionDeclarationArgumentSpacing.SpacingAfterHint"> 
     123  <severity>0</severity> 
     124 </rule> 
     125 
     126 <!-- Method arguments with default values MUST go at the end of the argument list. --> 
     127 <rule ref="PEAR.Functions.ValidDefaultValue"/> 
     128 
     129 <!-- Argument lists MAY be split across multiple lines, where each subsequent line is indented once. When doing so, the first item in the list MUST be on the next line, and there MUST be only one argument per line. When the argument list is split across multiple lines, the closing parenthesis and opening brace MUST be placed together on their own line with one space between them. --> 
     130 <rule ref="Squiz.Functions.MultiLineFunctionDeclaration"/> 
     131 
     132 <!-- 4.5 abstract, final, and static --> 
     133 
     134 <!-- When present, the abstract and final declarations MUST precede the visibility declaration. 
     135      When present, the static declaration MUST come after the visibility declaration. --> 
     136 <!-- checked in Methods/MethodDeclarationSniff --> 
     137 
     138 <!-- 4.6 Method and Function Calls --> 
     139 
     140 <!-- When making a method or function call, there MUST NOT be a space between the method or function name and the opening parenthesis, there MUST NOT be a space after the opening parenthesis, and there MUST NOT be a space before the closing parenthesis. In the argument list, there MUST NOT be a space before each comma, and there MUST be one space after each comma. 
     141 Argument lists MAY be split across multiple lines, where each subsequent line is indented once. When doing so, the first item in the list MUST be on the next line, and there MUST be only one argument per line. --> 
     142 <rule ref="Generic.Functions.FunctionCallArgumentSpacing"/> 
     143 <rule ref="PSR2.Methods.FunctionCallSignature.SpaceAfterCloseBracket"> 
     144  <severity>0</severity> 
     145 </rule> 
     146 
     147 <!-- 5. Control Structures --> 
     148 
     149 <!-- The general style rules for control structures are as follows: 
     150 There MUST be one space after the control structure keyword 
     151 There MUST NOT be a space after the opening parenthesis 
     152 There MUST NOT be a space before the closing parenthesis 
     153 There MUST be one space between the closing parenthesis and the opening brace 
     154 The structure body MUST be indented once 
     155 The closing brace MUST be on the next line after the body --> 
     156 <rule ref="Squiz.ControlStructures.ControlSignature"> 
     157  <properties> 
     158   <property name="ignoreComments" value="true"/> 
     159  </properties> 
     160 </rule> 
     161 <rule ref="Squiz.WhiteSpace.ScopeClosingBrace"/> 
     162 <rule ref="Squiz.ControlStructures.ForEachLoopDeclaration"/> 
     163 <rule ref="Squiz.ControlStructures.ForLoopDeclaration"/> 
     164 <rule ref="Squiz.ControlStructures.LowercaseDeclaration"/> 
     165 <!-- checked in ControlStructures/ControlStructureSpacingSniff --> 
     166 
     167 <!-- The body of each structure MUST be enclosed by braces. This standardizes how the structures look, and reduces the likelihood of introducing errors as new lines get added to the body. --> 
     168 <rule ref="Generic.ControlStructures.InlineControlStructure"/> 
     169 
     170 <!-- 5.1. if, elseif, else --> 
     171 
     172 <!-- The keyword elseif SHOULD be used instead of else if so that all control keywords look like single words. --> 
     173 <!-- checked in ControlStructures/ElseIfDeclarationSniff --> 
     174 
     175 <!-- 5.2. switch, case --> 
     176 
     177 <!-- The case statement MUST be indented once from switch, and the break keyword (or other terminating keyword) MUST be indented at the same level as the case body. There MUST be a comment such as // no break when fall-through is intentional in a non-empty case body. --> 
     178 <!-- checked in ControlStructures/SwitchDeclarationSniff --> 
     179 
     180 <!-- 6. Closures --> 
     181 
     182 <!-- Closures MUST be declared with a space after the function keyword, and a space before and after the use keyword. 
     183 The opening brace MUST go on the same line, and the closing brace MUST go on the next line following the body. 
     184 There MUST NOT be a space after the opening parenthesis of the argument list or variable list, and there MUST NOT be a space before the closing parenthesis of the argument list or variable list. 
     185 In the argument list and variable list, there MUST NOT be a space before each comma, and there MUST be one space after each comma. 
     186 Closure arguments with default values MUST go at the end of the argument list. 
     187 Argument lists and variable lists MAY be split across multiple lines, where each subsequent line is indented once. When doing so, the first item in the list MUST be on the next line, and there MUST be only one argument or variable per line. 
     188 When the ending list (whether or arguments or variables) is split across multiple lines, the closing parenthesis and opening brace MUST be placed together on their own line with one space between them. --> 
     189 <!-- checked in Squiz.Functions.MultiLineFunctionDeclaration --> 
     190</ruleset> 
Note: See TracChangeset for help on using the changeset viewer.