aboutsummaryrefslogtreecommitdiffstats
path: root/tests/phpcs/OpenCart/ruleset.xml
blob: 7823ffb720bf4510ea44c861d35bf7d94f765430 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
<?xml version="1.0"?>
<ruleset name="OpenCart">
    <description>The Code Sniffer rule set for OpenCart</description>

    <exclude-pattern>*/system/vendor/*</exclude-pattern>

    <rule ref="Squiz.ControlStructures.InlineIfDeclaration" />

    <!-- Closing PHP tags are not allowed -->
    <rule ref="Zend.Files.ClosingTag">
        <severity>5</severity>
        <type>error</type>
    </rule>

    <!-- Test the spacing of inline control statements -->
    <rule ref="Squiz.ControlStructures.InlineIfDeclaration" />

    <!-- Check for whitespace after lines of code and checks for spaces/indents on empty lines -->
    <rule ref="Squiz.WhiteSpace.SuperfluousWhitespace">
        <severity>1</severity>
        <type>warning</type>
    </rule>
    <rule ref="Squiz.WhiteSpace.SuperfluousWhitespace.StartFile" />
    <rule ref="Squiz.WhiteSpace.SuperfluousWhitespace.EndFile" />
    <rule ref="Squiz.WhiteSpace.SuperfluousWhitespace.EmptyLines" />

    <!-- Check to ensure no PHP deprecated functions have been used -->
    <rule ref="Generic.PHP.DeprecatedFunctions">
        <severity>5</severity>
        <type>error</type>
    </rule>

    <!-- PHP opening tag must be full <?php, no shorthand or ASP tags -->
    <rule ref="Generic.PHP.DisallowShortOpenTag">
        <severity>5</severity>
        <type>error</type>
    </rule>

    <!-- In PHP files make sure there is no character before the opening tag -->
    <rule ref="Generic.PHP.CharacterBeforePHPOpeningTag"/>

    <!-- true, false, null etc should all be lowercase only -->
    <rule ref="Generic.PHP.LowerCaseConstant" />

    <!-- Type casting should be immediately followed by the variable, no space -->
    <rule ref="Generic.Formatting.NoSpaceAfterCast" />

    <!-- Pass by reference is now only supported in the method/function params -->
    <rule ref="Generic.Functions.CallTimePassByReference" />

    <!-- keep the spacing between function/method params space after comma -->
    <rule ref="Generic.Functions.FunctionCallArgumentSpacing" />

    <!-- method names should always be camel case -->
    <rule ref="Generic.NamingConventions.CamelCapsFunctionName"/>

    <!-- constants should always be uppercase -->
    <rule ref="Generic.NamingConventions.UpperCaseConstantName"/>

    <!-- Detect BOMs to avoid curruptions -->
    <rule ref="Generic.Files.ByteOrderMark"/>

    <rule ref="Generic.WhiteSpace.DisallowSpaceIndent">
        <exclude-pattern>*.tpl</exclude-pattern>
        <exclude-pattern>*.css</exclude-pattern>
        <exclude-pattern>*.html</exclude-pattern>
        <exclude-pattern>*.ini</exclude-pattern>
        <exclude-pattern>*.txt</exclude-pattern>
        <severity>1</severity>
        <type>warning</type>
    </rule>

    <!-- To do comments should be reported and completed -->
    <rule ref="Generic.Commenting.Todo.CommentFound">
        <message>Please review this TODO comment: %s</message>
        <severity>3</severity>
        <type>warning</type>
    </rule>

    <!-- Fix me comments should be reported and fixed -->
    <rule ref="Generic.Commenting.Todo.Fixme">
        <message>Please review this FIXME comment: %s</message>
        <severity>5</severity>
        <type>warning</type>
    </rule>

    <!-- Check that line endings are only \n -->
    <rule ref="Generic.Files.LineEndings">
        <properties>
            <property name="eolChar" value="\n"/>
        </properties>
    </rule>

    <!-- <rule ref="Squiz.ControlStructures.ControlSignature" /> -->
    <!-- <rule ref="Generic.ControlStructures.InlineControlStructure"></rule> -->

    <!-- exclude the actual tests directory from being tested! -->
    <exclude-pattern>*/tests/*</exclude-pattern>
</ruleset>

<!-- @todo - A Sniff test needs to be added to ensure short echo tags are not used -->
<!-- @todo - A Sniff test to allow helper functions (normal functions) to be snake case -->