forked from moodlehq/moodle-cs
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
57bd4db
commit aff8985
Showing
4 changed files
with
82 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,11 +12,16 @@ | |
{ | ||
"name": "Andrew Lyons", | ||
"email": "[email protected]" | ||
}, | ||
{ | ||
"name": "Eloy Lafuente", | ||
"email": "[email protected]" | ||
} | ||
], | ||
"require": { | ||
"dealerdirect/phpcodesniffer-composer-installer": "^1.0.0", | ||
"squizlabs/php_codesniffer": "^3.7.2", | ||
"phpcsstandards/phpcsextra": "^1.1.0", | ||
"phpcompatibility/php-compatibility": "dev-develop#0a17f9ed" | ||
}, | ||
"config": { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
<?xml version="1.0"?> | ||
<ruleset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:noNamespaceSchemaLocation="https://raw.githubusercontent.com/squizlabs/PHP_CodeSniffer/master/phpcs.xsd" | ||
name="moodle-strict" | ||
namespace="MoodleHQ\MoodleCS\MoodleExtra"> | ||
|
||
<description>Best Practices for Moodle development beyond the core Coding Standards</description> | ||
|
||
<!-- Extend the standard Moodle coding style --> | ||
<rule ref="moodle"/> | ||
|
||
<!-- Include the PSR-12 ruleset with relevant Moodle exclusions --> | ||
<rule ref="PSR12"> | ||
|
||
<!-- Moodle has a header manager and places its copyright on the first line after the opening tag --> | ||
<exclude name="PSR12.Files.FileHeader.SpacingAfterBlock"/> | ||
|
||
<!-- Moodle already defines its own line length, so remove this from the PSR-12 standard --> | ||
<exclude name="Generic.Files.LineLength.TooLong"/> | ||
|
||
<!-- Moodle has its own custom sniff for side effects --> | ||
<exclude name="PSR1.Files.SideEffects.FoundWithSymbols"/> | ||
|
||
<!-- Moodle does not support camel case at all --> | ||
<exclude name="PSR1.Methods.CamelCapsMethodName.NotCamelCaps"/> | ||
|
||
<!-- Moodle contains a lot of code which pre-dates PHP 7.1 and did not support constant visibility --> | ||
<exclude name="PSR12.Properties.ConstantVisibility.NotFound"/> | ||
|
||
<!-- Moodle does not place the opening brace on a new line --> | ||
<exclude name="PSR2.Classes.ClassDeclaration.OpenBraceNewLine"/> | ||
|
||
<!-- Moodle allows use of else if--> | ||
<exclude name="PSR2.ControlStructures.ElseIfDeclaration.NotAllowed"/> | ||
|
||
<!-- Moodle casing rules do not allow camel case at all --> | ||
<exclude name="Squiz.Classes.ValidClassName.NotCamelCaps"/> | ||
|
||
<!-- Moodle casing currently places the brace in the same line --> | ||
<exclude name="Squiz.Functions.MultiLineFunctionDeclaration.BraceOnSameLine"/> | ||
</rule> | ||
|
||
<!-- Detect duplicate array keys --> | ||
<rule ref="Universal.Arrays.DuplicateArrayKey"/> | ||
|
||
<!-- Require a comma after the last element in a multi-line array, but prevent in a single-line array definition --> | ||
<rule ref="NormalizedArrays.Arrays.CommaAfterLast"/> | ||
|
||
<!-- Disallow use of list() instead of [] --> | ||
<rule ref="Universal.Lists.DisallowLongListSyntax"/> | ||
|
||
<!-- Enusre that ::class is lower-cased --> | ||
<rule ref="Universal.Constants.LowercaseClassResolutionKeyword"/> | ||
|
||
<!-- Require a consistent modifier keyword order for OO constant declarations --> | ||
<rule ref="Universal.Constants.ModifierKeywordOrder"/> | ||
|
||
<!-- Enforce that the names used in a class/enum "implements" statement or an interface "extends" statement are listed in alphabetic order --> | ||
<rule ref="Universal.OOStructures.AlphabeticExtendsImplements"/> | ||
|
||
<!-- Enforce the use of a single space after the use, function, const keywords and both before and after the as keyword in import use statements --> | ||
<rule ref="Universal.UseStatements.KeywordSpacing"/> | ||
|
||
<!-- Enforce lowercase function/const --> | ||
<rule ref="Universal.UseStatements.LowercaseFunctionConst"/> | ||
|
||
<!-- Detect useless class imports (aliases) --> | ||
<rule ref="Universal.UseStatements.NoUselessAliases"/> | ||
|
||
<!-- Enfore comma, spacing, like, this --> | ||
<rule ref="Universal.WhiteSpace.CommaSpacing"/> | ||
|
||
</ruleset> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters