|
5 | 5 | <!-- Only scan PHP files. -->
|
6 | 6 | <arg name="extensions" value="php"/>
|
7 | 7 |
|
8 |
| - <!-- Set the memory limit to 256M. |
| 8 | + <!-- Set the memory limit to 512M. |
9 | 9 | For most standard PHP configurations, this means the memory limit will temporarily be raised.
|
10 | 10 | Ref: https://github.com/squizlabs/PHP_CodeSniffer/wiki/Advanced-Usage#specifying-phpini-settings
|
11 | 11 | -->
|
12 |
| - <ini name="memory_limit" value="256M"/> |
| 12 | + <ini name="memory_limit" value="512M"/> |
13 | 13 |
|
14 | 14 | <!-- Strip the filepaths down to the relevant bit. -->
|
15 | 15 | <arg name="basepath" value="./"/>
|
|
20 | 20 | <!-- Show sniff codes in all reports. -->
|
21 | 21 | <arg value="ps"/>
|
22 | 22 |
|
23 |
| - <file>.</file> |
| 23 | + <!-- |
| 24 | + ############################################################################# |
| 25 | + FILE SELECTION |
| 26 | + Set which files will be subject to the scans executed using this ruleset. |
| 27 | + ############################################################################# |
| 28 | + --> |
24 | 29 |
|
25 |
| - <rule ref="WordPress-Core"/> |
26 |
| - <rule ref="WordPress-Docs"/> |
| 30 | + <file>.</file> |
27 | 31 |
|
28 | 32 | <!-- Directories and third party library exclusions. -->
|
29 | 33 | <exclude-pattern>/vendor/*</exclude-pattern>
|
30 |
| - <!-- <exclude-pattern>/tests/*</exclude-pattern> --> |
| 34 | + <exclude-pattern>/wp-includes/sqlite/class-wp-sqlite-crosscheck-db.php</exclude-pattern> |
31 | 35 |
|
32 |
| - <!-- Allow the WP DB Class and related tests for usage of direct database access functions. --> |
33 |
| - <rule ref="WordPress.DB.RestrictedClasses.mysql__PDO"> |
34 |
| - <exclude-pattern>/wp-includes/*.php</exclude-pattern> |
| 36 | + <!-- |
| 37 | + ############################################################################# |
| 38 | + SET UP THE RULESET |
| 39 | + ############################################################################# |
| 40 | + --> |
| 41 | + |
| 42 | + <rule ref="WordPress-Core"/> |
| 43 | + |
| 44 | + |
| 45 | + <!-- |
| 46 | + ############################################################################# |
| 47 | + SNIFF-SPECIFIC CONFIGURATION |
| 48 | + ############################################################################# |
| 49 | + --> |
| 50 | + |
| 51 | + <!-- These rules are being set as warnings instead of errors, so we can error check the entire codebase. --> |
| 52 | + <rule ref="Generic.Files.OneObjectStructurePerFile.MultipleFound"> |
| 53 | + <type>warning</type> |
| 54 | + <!-- Exclude the unit tests as no warnings are allowed there. Note: these issues should be fixed and the exclude removed! --> |
| 55 | + <exclude-pattern>/tests/phpunit/*</exclude-pattern> |
35 | 56 | </rule>
|
36 |
| - <rule ref="WordPress.DB.RestrictedFunctions"> |
37 |
| - <exclude-pattern>/wp-includes/*.php</exclude-pattern> |
| 57 | + <rule ref="WordPress.DB.PreparedSQL.InterpolatedNotPrepared"> |
| 58 | + <type>warning</type> |
| 59 | + </rule> |
| 60 | + <rule ref="WordPress.DB.PreparedSQL.NotPrepared"> |
| 61 | + <type>warning</type> |
| 62 | + </rule> |
| 63 | + <rule ref="WordPress.Files.FileName.InvalidClassFileName"> |
| 64 | + <type>warning</type> |
| 65 | + </rule> |
| 66 | + <rule ref="WordPress.NamingConventions.ValidVariableName.VariableNotSnakeCase"> |
| 67 | + <type>warning</type> |
38 | 68 | </rule>
|
39 | 69 |
|
40 |
| - <!-- Disable some more checks. --> |
41 |
| - <rule ref="Generic.Commenting.Todo.CommentFound"> |
42 |
| - <severity>0</severity> |
| 70 | + <rule ref="WordPress.NamingConventions.ValidVariableName"> |
| 71 | + <properties> |
| 72 | + <property name="allowed_custom_properties" type="array"> |
| 73 | + <!-- From database structure queries. --> |
| 74 | + <element value="Collation"/> |
| 75 | + <element value="Column_name"/> |
| 76 | + <element value="Default"/> |
| 77 | + <element value="Extra"/> |
| 78 | + <element value="Field"/> |
| 79 | + <element value="Index_type"/> |
| 80 | + <element value="Key"/> |
| 81 | + <element value="Key_name"/> |
| 82 | + <element value="Msg_text"/> |
| 83 | + <element value="Non_unique"/> |
| 84 | + <element value="Null"/> |
| 85 | + <element value="Sub_part"/> |
| 86 | + <element value="Type"/> |
| 87 | + <!-- From plugin/theme data. --> |
| 88 | + <element value="authorAndUri"/> |
| 89 | + <element value="Name"/> |
| 90 | + <element value="Version"/> |
| 91 | + <!-- From the result of wp_xmlrpc_server::wp_getPageList(). --> |
| 92 | + <element value="dateCreated"/> |
| 93 | + |
| 94 | + <!-- From DOMDocument. --> |
| 95 | + <element value="childNodes"/> |
| 96 | + <element value="firstChild"/> |
| 97 | + <element value="formatOutput"/> |
| 98 | + <element value="lastChild"/> |
| 99 | + <element value="nodeName"/> |
| 100 | + <element value="nodeType"/> |
| 101 | + <element value="nodeValue"/> |
| 102 | + <element value="parentNode"/> |
| 103 | + <element value="preserveWhiteSpace"/> |
| 104 | + <element value="textContent"/> |
| 105 | + <!-- From PHPMailer. --> |
| 106 | + <element value="AltBody"/> |
| 107 | + <element value="Body"/> |
| 108 | + <element value="CharSet"/> |
| 109 | + <element value="ContentType"/> |
| 110 | + <element value="Encoding"/> |
| 111 | + <element value="Hostname"/> |
| 112 | + <element value="mailHeader"/> |
| 113 | + <element value="MIMEBody"/> |
| 114 | + <element value="MIMEHeader"/> |
| 115 | + <element value="Sender"/> |
| 116 | + <element value="Subject"/> |
| 117 | + <!-- From PHPUnit_Util_Getopt. --> |
| 118 | + <element value="longOptions"/> |
| 119 | + <!-- From POP3. --> |
| 120 | + <element value="ERROR"/> |
| 121 | + <!-- From ZipArchive. --> |
| 122 | + <element value="numFiles"/> |
| 123 | + </property> |
| 124 | + </properties> |
43 | 125 | </rule>
|
44 |
| - <rule ref="Squiz.Commenting.LongConditionClosingComment.Missing"> |
45 |
| - <severity>0</severity> |
| 126 | + |
| 127 | + <rule ref="WordPress.PHP.NoSilencedErrors"> |
| 128 | + <properties> |
| 129 | + <property name="customAllowedFunctionsList" type="array"> |
| 130 | + <element value="ssh2_connect"/> |
| 131 | + <element value="ssh2_auth_password"/> |
| 132 | + <element value="ssh2_auth_pubkey_file"/> |
| 133 | + <element value="ftp_ssl_connect"/> |
| 134 | + <element value="ftp_connect"/> |
| 135 | + <element value="ftp_get_option"/> |
| 136 | + <element value="ftp_set_option"/> |
| 137 | + <element value="disk_free_space"/> |
| 138 | + <element value="getimagesize"/> |
| 139 | + <element value="iptcparse"/> |
| 140 | + <element value="exif_read_data"/> |
| 141 | + <element value="gzinflate"/> |
| 142 | + <element value="gzuncompress"/> |
| 143 | + <element value="gzdecode"/> |
| 144 | + <element value="imagecreatefromwebp"/> |
| 145 | + <element value="imagecreatefromavif"/> |
| 146 | + </property> |
| 147 | + </properties> |
46 | 148 | </rule>
|
47 |
| - <rule ref="Squiz.Commenting.PostStatementComment.Found"> |
48 |
| - <severity>0</severity> |
| 149 | + |
| 150 | + |
| 151 | + <!-- |
| 152 | + ############################################################################# |
| 153 | + SELECTIVE EXCLUSIONS |
| 154 | + Exclude specific files for specific sniffs and/or exclude sub-groups in sniffs. |
| 155 | +
|
| 156 | + These exclusions are listed ordered by alphabetic sniff name. |
| 157 | + ############################################################################# |
| 158 | + --> |
| 159 | + |
| 160 | + <rule ref="WordPress.DB.RestrictedClasses.mysql__PDO"> |
| 161 | + <exclude-pattern>/wp-includes/sqlite/class-wp-sqlite-translator.php</exclude-pattern> |
| 162 | + </rule> |
| 163 | + |
| 164 | + <!-- Assignments in while conditions are a valid method of looping over iterables. --> |
| 165 | + <rule ref="Generic.CodeAnalysis.AssignmentInCondition.FoundInWhileCondition"> |
| 166 | + <exclude-pattern>*</exclude-pattern> |
49 | 167 | </rule>
|
50 | 168 |
|
51 |
| - <!-- Disable some tests for the tests/ files. --> |
52 |
| - <rule ref="Squiz.Commenting"> |
| 169 | + <rule ref="WordPress.DB.RestrictedClasses"> |
| 170 | + <exclude-pattern>/src/wp-includes/sqlite/*\.php</exclude-pattern> |
53 | 171 | <exclude-pattern>/tests/*</exclude-pattern>
|
54 |
| - <exclude-pattern>/wp-includes/sqlite/class-wp-sqlite-crosscheck-db.php</exclude-pattern> |
55 | 172 | </rule>
|
56 |
| - <rule ref="WordPress.DB.RestrictedClasses.mysql__PDO"> |
| 173 | + |
| 174 | + <!-- Exclude the unit tests from the file name rules. --> |
| 175 | + <rule ref="WordPress.Files.FileName"> |
57 | 176 | <exclude-pattern>/tests/*</exclude-pattern>
|
| 177 | + </rule> |
| 178 | + <rule ref="WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase"> |
58 | 179 | <exclude-pattern>/wp-includes/sqlite/class-wp-sqlite-crosscheck-db.php</exclude-pattern>
|
59 | 180 | </rule>
|
60 |
| - <rule ref="Generic.Commenting"> |
| 181 | + <rule ref="WordPress.NamingConventions.ValidFunctionName.FunctionNameInvalid"> |
| 182 | + <exclude-pattern>/tests/*</exclude-pattern> |
| 183 | + </rule> |
| 184 | + <rule ref="WordPress.Files.FileName.NotHyphenatedLowercase"> |
61 | 185 | <exclude-pattern>/tests/*</exclude-pattern>
|
62 |
| - <exclude-pattern>/wp-includes/sqlite/class-wp-sqlite-crosscheck-db.php</exclude-pattern> |
63 | 186 | </rule>
|
64 | 187 | <rule ref="WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase">
|
65 | 188 | <exclude-pattern>/tests/*</exclude-pattern>
|
66 |
| - <exclude-pattern>/wp-includes/sqlite/class-wp-sqlite-crosscheck-db.php</exclude-pattern> |
67 | 189 | </rule>
|
68 | 190 | <rule ref="WordPress.Files.FileName.InvalidClassFileName">
|
69 | 191 | <exclude-pattern>/wp-includes/sqlite/class-wp-sqlite-crosscheck-db.php</exclude-pattern>
|
|
0 commit comments