mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-08 04:18:52 +00:00
[task/code-sniffer] Add code sniffer rulesets.
PHPBB3-11980
This commit is contained in:
parent
c230701e48
commit
8c83acb28b
3 changed files with 79 additions and 0 deletions
12
build/code_sniffer/ruleset-minimum.xml
Normal file
12
build/code_sniffer/ruleset-minimum.xml
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
<?xml version="1.0"?>
|
||||||
|
<ruleset name="phpBB Minimum Standard">
|
||||||
|
|
||||||
|
<description>phpBB minimum coding standard</description>
|
||||||
|
|
||||||
|
<!-- All code files MUST use only UTF-8 without BOM. -->
|
||||||
|
<rule ref="Generic.Files.ByteOrderMark" />
|
||||||
|
|
||||||
|
<!-- All code files MUST use the Unix LF (linefeed) line ending. -->
|
||||||
|
<rule ref="Generic.Files.LineEndings" />
|
||||||
|
|
||||||
|
</ruleset>
|
25
build/code_sniffer/ruleset-php-legacy.xml
Normal file
25
build/code_sniffer/ruleset-php-legacy.xml
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
<?xml version="1.0"?>
|
||||||
|
<ruleset name="phpBB PHP Legacy Standard">
|
||||||
|
|
||||||
|
<description>phpBB legacy coding standard for PHP files</description>
|
||||||
|
|
||||||
|
<rule ref="./ruleset-minimum.xml" />
|
||||||
|
|
||||||
|
<!-- The body of each structure MUST be enclosed by braces. -->
|
||||||
|
<rule ref="Generic.ControlStructures.InlineControlStructure" />
|
||||||
|
|
||||||
|
<!-- All PHP files MUST end with a single blank line. -->
|
||||||
|
|
||||||
|
<!-- Class constants MUST be declared in all upper case with underscore separators. -->
|
||||||
|
<rule ref="Generic.NamingConventions.UpperCaseConstantName" />
|
||||||
|
|
||||||
|
<!-- Only <?php, no short tags. -->
|
||||||
|
<rule ref="Generic.PHP.DisallowShortOpenTag.EchoFound" />
|
||||||
|
|
||||||
|
<!-- Method arguments with default values MUST go at the end of the argument list. -->
|
||||||
|
<rule ref="PEAR.Functions.ValidDefaultValue" />
|
||||||
|
|
||||||
|
<!-- The ?> closing tag MUST be omitted from files containing only PHP. -->
|
||||||
|
<rule ref="Zend.Files.ClosingTag" />
|
||||||
|
|
||||||
|
</ruleset>
|
42
build/code_sniffer/ruleset-php-strict.xml
Normal file
42
build/code_sniffer/ruleset-php-strict.xml
Normal file
|
@ -0,0 +1,42 @@
|
||||||
|
<?xml version="1.0"?>
|
||||||
|
<ruleset name="phpBB PHP Strict Standard">
|
||||||
|
|
||||||
|
<description>phpBB coding standard for PHP files</description>
|
||||||
|
|
||||||
|
<rule ref="./ruleset-php-legacy.xml" />
|
||||||
|
|
||||||
|
<!-- There SHOULD NOT be more than 80 characters per line
|
||||||
|
There MUST NOT be more than 120 characters per line -->
|
||||||
|
<!--
|
||||||
|
<rule ref="Generic.Files.LineLength">
|
||||||
|
<properties>
|
||||||
|
<property name="lineLimit" value="80"/>
|
||||||
|
<property name="absoluteLineLimit" value="120"/>
|
||||||
|
</properties>
|
||||||
|
</rule>
|
||||||
|
-->
|
||||||
|
|
||||||
|
<!-- The PHP constants true, false, and null MUST be in lower case. -->
|
||||||
|
<rule ref="Generic.PHP.LowerCaseConstant" />
|
||||||
|
|
||||||
|
<!-- PHP keywords MUST be in lower case. -->
|
||||||
|
<rule ref="Generic.PHP.LowerCaseKeyword" />
|
||||||
|
|
||||||
|
<!-- There MUST NOT be trailing whitespace at the end of lines. -->
|
||||||
|
<rule ref="Squiz.WhiteSpace.SuperfluousWhitespace" />
|
||||||
|
|
||||||
|
<!-- There MUST NOT be whitespace before the first content of a file -->
|
||||||
|
<rule ref="Squiz.WhiteSpace.SuperfluousWhitespace.StartFile" />
|
||||||
|
|
||||||
|
<!-- There MUST NOT be whitespace after the last content of a file -->
|
||||||
|
<rule ref="Squiz.WhiteSpace.SuperfluousWhitespace.EndFile" />
|
||||||
|
|
||||||
|
<!-- Functions MUST NOT contain multiple empty lines in a row -->
|
||||||
|
<rule ref="Squiz.WhiteSpace.SuperfluousWhitespace.EmptyLines" />
|
||||||
|
|
||||||
|
<!-- When present, all use declarations MUST go after the namespace declaration.
|
||||||
|
There MUST be one use keyword per declaration.
|
||||||
|
There MUST be one blank line after the use block. -->
|
||||||
|
<rule ref="PSR2.Namespaces.UseDeclaration" />
|
||||||
|
|
||||||
|
</ruleset>
|
Loading…
Add table
Reference in a new issue