Skip to content

Commit bba635e

Browse files
committed
build: change rules
Rules were modified. Closes #4
1 parent dd45bef commit bba635e

File tree

2 files changed

+258
-52
lines changed

2 files changed

+258
-52
lines changed

phpcs.xml

+193-11
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,199 @@
1-
<?xml version="1.0"?>
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<ruleset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="PSR12">
3+
<description>Coding standard.</description>
4+
<arg name="tab-width" value="4" />
25

3-
<ruleset name="PHP Coding Standards">
46

5-
<description>PHP Coding Standards</description>
7+
<rule ref="PSR1" />
68

7-
<rule ref="Generic.NamingConventions.UpperCaseConstantName"/>
8-
<rule ref="Generic.CodeAnalysis.UnusedFunctionParameter"/>
9-
<rule ref="Generic.Strings.UnnecessaryStringConcat"/>
10-
11-
<rule ref="PSR2" />
129

13-
<exclude-pattern>node_modules</exclude-pattern>
14-
<exclude-pattern>resources</exclude-pattern>
15-
<exclude-pattern>vendor</exclude-pattern>
10+
<rule ref="PSR12" />
1611

12+
13+
<rule ref="Generic.Classes.DuplicateClassName" />
14+
15+
16+
<rule ref="Generic.CodeAnalysis.EmptyStatement" />
17+
<rule ref="Generic.CodeAnalysis.ForLoopShouldBeWhileLoop" />
18+
<rule ref="Generic.CodeAnalysis.ForLoopWithTestFunctionCall" />
19+
<rule ref="Generic.CodeAnalysis.JumbledIncrementer" />
20+
<rule ref="Generic.CodeAnalysis.UnconditionalIfStatement" />
21+
<rule ref="Generic.CodeAnalysis.UnnecessaryFinalModifier" />
22+
<rule ref="Generic.CodeAnalysis.UnusedFunctionParameter" />
23+
<rule ref="Generic.CodeAnalysis.UselessOverridingMethod" />
24+
25+
26+
<rule ref="Generic.Commenting.Todo" />
27+
<rule ref="Generic.Commenting.Fixme" />
28+
29+
30+
<rule ref="Generic.ControlStructures.InlineControlStructure" />
31+
32+
33+
<rule ref="Generic.Files.ByteOrderMark" />
34+
<rule ref="Generic.Files.LineEndings">
35+
<properties>
36+
<property name="eolChar" value="\n" />
37+
</properties>
38+
</rule>
39+
<rule ref="Generic.Files.LineLength">
40+
<properties>
41+
<property name="lineLimit" value="100" />
42+
<property name="absoluteLineLimit" value="100" />
43+
</properties>
44+
</rule>
45+
46+
47+
<rule ref="Generic.Formatting.DisallowMultipleStatements" />
48+
<rule ref="Generic.Formatting.MultipleStatementAlignment" />
49+
<rule ref="Generic.Formatting.SpaceAfterCast" />
50+
51+
52+
<rule ref="Generic.Functions.CallTimePassByReference" />
53+
<rule ref="Generic.Functions.FunctionCallArgumentSpacing" />
54+
55+
56+
<rule ref="Generic.Metrics.CyclomaticComplexity">
57+
<properties>
58+
<property name="complexity" value="50" />
59+
<property name="absoluteComplexity" value="100" />
60+
</properties>
61+
</rule>
62+
<rule ref="Generic.Metrics.NestingLevel">
63+
<properties>
64+
<property name="nestingLevel" value="10" />
65+
<property name="absoluteNestingLevel" value="30" />
66+
</properties>
67+
</rule>
68+
69+
70+
<rule ref="Generic.NamingConventions.ConstructorName" />
71+
72+
73+
<rule ref="Generic.PHP.DeprecatedFunctions" />
74+
<rule ref="Generic.PHP.DisallowShortOpenTag" />
75+
<rule ref="Generic.PHP.ForbiddenFunctions" />
76+
<rule ref="Generic.PHP.LowerCaseConstant" />
77+
<rule ref="Generic.PHP.LowerCaseKeyword" />
78+
<rule ref="Generic.PHP.LowerCaseType" />
79+
<rule ref="Generic.PHP.NoSilencedErrors" />
80+
81+
82+
<rule ref="Generic.Strings.UnnecessaryStringConcat" />
83+
84+
85+
<rule ref="Generic.WhiteSpace.DisallowTabIndent" />
86+
<rule ref="Generic.WhiteSpace.IncrementDecrementSpacing" />
87+
<rule ref="Generic.WhiteSpace.ScopeIndent">
88+
<properties>
89+
<property name="indent" value="4" />
90+
<property name="tabIndent" value="true" />
91+
</properties>
92+
</rule>
93+
94+
95+
<rule ref="PEAR.Functions.ValidDefaultValue" />
96+
97+
98+
<rule ref="PSR1.Classes.ClassDeclaration" />
99+
<rule ref="PSR1.Files.SideEffects" />
100+
101+
102+
<rule ref="PSR2.Classes.ClassDeclaration" />
103+
<rule ref="PSR2.Classes.PropertyDeclaration" />
104+
105+
106+
<rule ref="PSR2.ControlStructures.ControlStructureSpacing" />
107+
<rule ref="PSR2.ControlStructures.ElseIfDeclaration" />
108+
<rule ref="PSR2.ControlStructures.SwitchDeclaration" />
109+
110+
111+
<rule ref="PSR2.Files.ClosingTag" />
112+
<rule ref="PSR2.Files.EndFileNewline" />
113+
114+
115+
<rule ref="PSR2.Methods.FunctionCallSignature" />
116+
<rule ref="PSR2.Methods.FunctionCallSignature.OpeningIndent">
117+
<severity>0</severity>
118+
</rule>
119+
<rule ref="PSR2.Methods.FunctionCallSignature.SpaceAfterCloseBracket">
120+
<severity>0</severity>
121+
</rule>
122+
<rule ref="PSR2.Methods.FunctionClosingBrace" />
123+
<rule ref="PSR2.Methods.MethodDeclaration" />
124+
<rule ref="PSR2.Methods.MethodDeclaration.Underscore">
125+
<type>error</type>
126+
<message>Method name "%s" must not be prefixed with an underscore to indicate visibility</message>
127+
</rule>
128+
129+
130+
<rule ref="PSR2.Namespaces.NamespaceDeclaration" />
131+
<rule ref="PSR2.Namespaces.UseDeclaration" />
132+
133+
134+
<rule ref="Squiz.ControlStructures.ControlSignature" />
135+
<rule ref="Squiz.ControlStructures.ForEachLoopDeclaration" />
136+
<rule ref="Squiz.ControlStructures.ForEachLoopDeclaration.AsNotLower">
137+
<severity>0</severity>
138+
</rule>
139+
<rule ref="Squiz.ControlStructures.ForEachLoopDeclaration.SpaceAfterOpen">
140+
<severity>0</severity>
141+
</rule>
142+
<rule ref="Squiz.ControlStructures.ForEachLoopDeclaration.SpaceBeforeClose">
143+
<severity>0</severity>
144+
</rule>
145+
<rule ref="Squiz.ControlStructures.ForLoopDeclaration">
146+
<properties>
147+
<property name="ignoreNewlines" value="true" />
148+
</properties>
149+
</rule>
150+
<rule ref="Squiz.ControlStructures.ForLoopDeclaration.SpacingAfterOpen">
151+
<severity>0</severity>
152+
</rule>
153+
<rule ref="Squiz.ControlStructures.ForLoopDeclaration.SpacingBeforeClose">
154+
<severity>0</severity>
155+
</rule>
156+
<rule ref="Squiz.ControlStructures.LowercaseDeclaration" />
157+
158+
159+
<rule ref="Squiz.Functions.FunctionDeclaration" />
160+
<rule ref="Squiz.Functions.FunctionDeclarationArgumentSpacing">
161+
<properties>
162+
<property name="equalsSpacing" value="1" />
163+
</properties>
164+
</rule>
165+
<rule ref="Squiz.Functions.LowercaseFunctionKeywords" />
166+
<rule ref="Squiz.Functions.MultiLineFunctionDeclaration" />
167+
168+
169+
<rule ref="Squiz.Scope.MethodScope" />
170+
171+
172+
<rule ref="Squiz.WhiteSpace.CastSpacing" />
173+
<rule ref="Squiz.WhiteSpace.ControlStructureSpacing.SpacingAfterOpen" />
174+
<rule ref="Squiz.WhiteSpace.ControlStructureSpacing.SpacingBeforeClose" />
175+
<rule ref="Squiz.WhiteSpace.ScopeClosingBrace" />
176+
<rule ref="Squiz.WhiteSpace.ScopeKeywordSpacing" />
177+
<rule ref="Squiz.WhiteSpace.SuperfluousWhitespace" />
178+
<rule ref="Squiz.WhiteSpace.SuperfluousWhitespace.EmptyLines">
179+
<severity>0</severity>
180+
</rule>
181+
<rule ref="Squiz.WhiteSpace.SuperfluousWhitespace.EndFile">
182+
<severity>0</severity>
183+
</rule>
184+
<rule ref="Squiz.WhiteSpace.SuperfluousWhitespace.StartFile">
185+
<severity>0</severity>
186+
</rule>
187+
188+
189+
<rule ref="Zend.Files.ClosingTag" />
190+
191+
192+
<arg name="colors" />
193+
<arg value="spvnl" />
194+
<ini name="memory_limit" value="128M" />
195+
196+
197+
<exclude-pattern>node_modules</exclude-pattern>
198+
<exclude-pattern>vendor</exclude-pattern>
17199
</ruleset>

phpmd.xml

+65-41
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,69 @@
1-
<ruleset
2-
xmlns="http://pmd.sf.net/ruleset/1.0.0"
3-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4-
xsi:schemaLocation="http://pmd.sf.net/ruleset/1.0.0 http://pmd.sf.net/ruleset_xml_schema.xsd"
5-
xsi:noNamespaceSchemaLocation="http://pmd.sf.net/ruleset_xml_schema.xsd">
6-
<!--codesize-->
7-
<!--<rule ref="rulesets/codesize.xml/CyclomaticComplexity"/>-->
8-
<rule ref="rulesets/codesize.xml/NPathComplexity"/>
9-
<rule ref="rulesets/codesize.xml/ExcessiveClassComplexity"/>
10-
<rule ref="rulesets/codesize.xml/ExcessiveClassLength"/>
11-
<rule ref="rulesets/codesize.xml/ExcessiveMethodLength"/>
12-
<rule ref="rulesets/codesize.xml/ExcessiveParameterList"/>
13-
<rule ref="rulesets/codesize.xml/ExcessivePublicCount"/>
14-
<rule ref="rulesets/codesize.xml/TooManyFields"/>
15-
<rule ref="rulesets/codesize.xml/TooManyMethods"/>
16-
<!--design-->
17-
<rule ref="rulesets/design.xml/EvalExpression"/>
18-
<rule ref="rulesets/design.xml/ExitExpression"/>
19-
<rule ref="rulesets/design.xml/GotoStatement"/>
20-
<rule ref="rulesets/design.xml/NumberOfChildren"/>
21-
<rule ref="rulesets/design.xml/DepthOfInheritance"/>
1+
<?xml version="1.0"?>
2+
<ruleset name="PHPMD rule set"
3+
xmlns="http://pmd.sf.net/ruleset/1.0.0"
4+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://pmd.sf.net/ruleset/1.0.0
5+
http://pmd.sf.net/ruleset_xml_schema.xsd" xsi:noNamespaceSchemaLocation="
6+
http://pmd.sf.net/ruleset_xml_schema.xsd">
7+
<description>Coding standard.</description>
8+
9+
<!--Clean Code Rules-->
10+
<rule ref="rulesets/cleancode.xml/BooleanArgumentFlag" />
11+
<rule ref="rulesets/cleancode.xml/ElseExpression" />
12+
<!--<rule ref="rulesets/cleancode.xml/StaticAccess"/>-->
13+
<rule ref="rulesets/cleancode.xml/IfStatementAssignment" />
14+
<rule ref="rulesets/cleancode.xml/DuplicatedArrayKey" />
15+
<rule ref="rulesets/cleancode.xml/MissingImport" />
16+
<rule ref="rulesets/cleancode.xml/UndefinedVariable" />
17+
<rule ref="rulesets/cleancode.xml/ErrorControlOperator" />
18+
19+
<!--Code Size Rules-->
20+
<rule ref="rulesets/codesize.xml/CyclomaticComplexity" />
21+
<rule ref="rulesets/codesize.xml/NPathComplexity" />
22+
<rule ref="rulesets/codesize.xml/ExcessiveMethodLength" />
23+
<rule ref="rulesets/codesize.xml/ExcessiveClassLength" />
24+
<rule ref="rulesets/codesize.xml/ExcessiveParameterList" />
25+
<rule ref="rulesets/codesize.xml/ExcessivePublicCount" />
26+
<rule ref="rulesets/codesize.xml/TooManyFields" />
27+
<rule ref="rulesets/codesize.xml/TooManyMethods" />
28+
<rule ref="rulesets/codesize.xml/TooManyPublicMethods" />
29+
<rule ref="rulesets/codesize.xml/ExcessiveClassComplexity" />
30+
31+
<!--Controversial Rules-->
32+
<rule ref="rulesets/controversial.xml/Superglobals" />
33+
<rule ref="rulesets/controversial.xml/CamelCaseClassName" />
34+
<rule ref="rulesets/controversial.xml/CamelCasePropertyName" />
35+
<rule ref="rulesets/controversial.xml/CamelCaseMethodName" />
36+
<rule ref="rulesets/controversial.xml/CamelCaseParameterName" />
37+
<rule ref="rulesets/controversial.xml/CamelCaseVariableName" />
38+
39+
<!--Design Rules-->
40+
<rule ref="rulesets/design.xml/ExitExpression" />
41+
<rule ref="rulesets/design.xml/EvalExpression" />
42+
<rule ref="rulesets/design.xml/GotoStatement" />
43+
<rule ref="rulesets/design.xml/NumberOfChildren" />
44+
<rule ref="rulesets/design.xml/DepthOfInheritance" />
2245
<rule ref="rulesets/design.xml/CouplingBetweenObjects">
2346
<properties>
24-
<property name="minimum" value="14"/>
47+
<property name="minimum" value="14" />
2548
</properties>
2649
</rule>
27-
<!--naming-->
28-
<rule ref="rulesets/naming.xml/ConstantNamingConventions"/>
29-
<rule ref="rulesets/naming.xml/BooleanGetMethodName"/>
30-
<!--unusedcode-->
31-
<rule ref="rulesets/unusedcode.xml/UnusedFormalParameter"/>
32-
<!--<rule ref="rulesets/unusedcode.xml/UnusedLocalVariable"/>-->
33-
<rule ref="rulesets/unusedcode.xml/UnusedPrivateField"/>
34-
<rule ref="rulesets/unusedcode.xml/UnusedPrivateMethod"/>
35-
<!--controversial-->
36-
<rule ref="rulesets/controversial.xml/Superglobals"/>
37-
<rule ref="rulesets/controversial.xml/CamelCaseClassName"/>
38-
<rule ref="rulesets/controversial.xml/CamelCasePropertyName"/>
39-
<rule ref="rulesets/controversial.xml/CamelCaseMethodName"/>
40-
<rule ref="rulesets/controversial.xml/CamelCaseParameterName"/>
41-
<rule ref="rulesets/controversial.xml/CamelCaseVariableName"/>
42-
<!--cleancode-->
43-
<!--<rule ref="rulesets/cleancode.xml/BooleanArgumentFlag"/>-->
44-
<!--<rule ref="rulesets/cleancode.xml/ElseExpression"/>-->
45-
</ruleset>
50+
<rule ref="rulesets/design.xml/DevelopmentCodeFragment" />
51+
<rule ref="rulesets/design.xml/EmptyCatchBlock" />
52+
<rule ref="rulesets/design.xml/CountInLoopExpression" />
53+
54+
<!--Naming Rules-->
55+
<rule ref="rulesets/naming.xml/LongClassName" />
56+
<rule ref="rulesets/naming.xml/ShortClassName" />
57+
<rule ref="rulesets/naming.xml/ShortVariable" />
58+
<rule ref="rulesets/naming.xml/LongVariable" />
59+
<rule ref="rulesets/naming.xml/ShortMethodName" />
60+
<rule ref="rulesets/naming.xml/ConstructorWithNameAsEnclosingClass" />
61+
<rule ref="rulesets/naming.xml/ConstantNamingConventions" />
62+
<rule ref="rulesets/naming.xml/BooleanGetMethodName" />
63+
64+
<!--Unused Code Rules-->
65+
<rule ref="rulesets/unusedcode.xml/UnusedPrivateField" />
66+
<rule ref="rulesets/unusedcode.xml/UnusedLocalVariable" />
67+
<rule ref="rulesets/unusedcode.xml/UnusedPrivateMethod" />
68+
<rule ref="rulesets/unusedcode.xml/UnusedFormalParameter" />
69+
</ruleset>

0 commit comments

Comments
 (0)