-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merged in feature/POLICY-3 (pull request #1)
Create ruleset Approved-by: Klaas Sangers
- Loading branch information
Showing
2 changed files
with
122 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# Introduction | ||
|
||
This is the MediaCT coding standard for Magento 1 projects. It is a mix of the | ||
default MediaCT coding standard and the Magento marketplace standard. | ||
|
||
Some tests have been removed from both of the standards to create a workable | ||
and fast standard. | ||
|
||
# Installation | ||
|
||
Use composer to require the standard in a project. | ||
|
||
```shell | ||
$ composer require --dev mediact/coding-standard-magento1 | ||
``` | ||
|
||
To let PHPCS know that this standard should be used add a phpcs.xml file in the | ||
root of the project. | ||
|
||
```xml | ||
<?xml version="1.0"?> | ||
<ruleset> | ||
<rule ref="./vendor/mediact/coding-standard-magento1/src/MediactMagento1"/> | ||
</ruleset> | ||
``` | ||
|
||
# Integration with PHPStorm | ||
|
||
When the phpcs.xml file exists it will be automatically configured by | ||
`media/coding-standard-phpstorm`. This is triggered by the composer command. | ||
|
||
```shell | ||
$ composer install | ||
``` | ||
|
||
# Contribution guidelines | ||
|
||
Contributions are welcome. Please create pull requests which add or remove | ||
tests. |
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,83 @@ | ||
<?xml version="1.0"?> | ||
<!-- | ||
/** | ||
* Copyright MediaCT. All rights reserved. | ||
* https://www.mediact.nl | ||
*/ | ||
--> | ||
<ruleset name="Mediact/Magento1"> | ||
<description>MediaCT coding standards for Magento1.</description> | ||
<arg name="colors" /> | ||
<arg name="extensions" value="php/PHP,phtml/PHP,js/JS,css/CSS" /> | ||
|
||
<!-- Base rules on MediaCT --> | ||
<rule ref="../../../coding-standard/src/MediactCommon"> | ||
<exclude name="PSR1.Classes.ClassDeclaration"/> | ||
<exclude name="Squiz.Classes.ValidClassName.NotCamelCaps" /> | ||
<exclude name="Squiz.Commenting.FunctionComment.ScalarTypeHintMissing" /> | ||
<exclude name="MediactCommon.Php7.ReturnType" /> | ||
<exclude name="Squiz.Commenting.FunctionComment.TypeHintMissing" /> | ||
<exclude name="PSR2.Methods.MethodDeclaration.Underscore" /> | ||
<exclude name="PSR2.Classes.PropertyDeclaration.Underscore" /> | ||
<exclude name="Squiz.Commenting.FunctionComment.EmptyThrows" /> | ||
<exclude name="Generic.Formatting.MultipleStatementAlignment.NotSameWarning" /> | ||
<exclude name="Generic.Commenting.DocComment.TagValueIndent" /> | ||
<exclude name="Squiz.Commenting.FunctionComment.SpacingAfterParamType" /> | ||
<exclude name="Generic.PHP.Syntax"/> | ||
</rule> | ||
|
||
<!-- Base rules on Magento Marketplace --> | ||
<rule ref="../../../../magento/marketplace-eqp/MEQP1"> | ||
<exclude name="PSR1.Classes.ClassDeclaration" /> | ||
<exclude name="Zend.NamingConventions.ValidVariableName.PrivateNoUnderscore"/> | ||
<exclude name="Generic.Arrays.DisallowShortArraySyntax" /> | ||
<exclude name="MEQP1.PHP.PrivateClassMember" /> | ||
<exclude name="MEQP1.Performance.EmptyCheck.FoundCount" /> | ||
<exclude name="MEQP1.Security.DiscouragedFunction" /> | ||
<exclude name="MEQP1.Performance.Loop" /> | ||
<exclude name="MEQP1.SQL.SlowQuery" /> | ||
<exclude name="MEQP1.Performance.InefficientMethods"/> | ||
<exclude name="Generic.Functions.OpeningFunctionBraceBsdAllman" /> | ||
<exclude name="MEQP1.Performance.CollectionCount"/> | ||
<exclude name="MEQP1.Templates.XssTemplate"/> | ||
<exclude name="PEAR.Functions.FunctionCallSignature.SpaceAfterOpenBracket"/> | ||
<exclude name="MEQP1.PHP.Syntax"/> | ||
<exclude name="MEQP1.Stdlib.DateTime"/> | ||
</rule> | ||
|
||
<rule ref="MEQP1.Classes.ResourceModel.OutsideOfResourceModel"> | ||
<exclude-pattern>Model/Resource</exclude-pattern> | ||
</rule> | ||
<rule ref="MediactCommon.NamingConventions.ValidVariableName"> | ||
<properties> | ||
<property name="allowedNames" type="array" value="_eventPrefix,_eventObject,_cacheTag,_addButtonLabel,_backButtonLabel,_blockGroup,_GET,_POST,_COOKIE,_FILES,_REQUEST,_SERVER,_SESSION"/> | ||
</properties> | ||
<exclude-pattern>*.phtml</exclude-pattern> | ||
</rule> | ||
<rule ref="Squiz.PHP.CommentedOutCode"> | ||
<properties> | ||
<property name="maxPercentage" value="80"/> | ||
</properties> | ||
</rule> | ||
<rule ref="Zend.NamingConventions.ValidVariableName.NotCamelCaps"> | ||
<exclude-pattern>*.phtml</exclude-pattern> | ||
</rule> | ||
<rule ref="Generic.Files.LineLength.TooLong"> | ||
<exclude-pattern>*.phtml</exclude-pattern> | ||
</rule> | ||
<rule ref="Squiz.ControlStructures.ControlSignature"> | ||
<exclude-pattern>*.phtml</exclude-pattern> | ||
</rule> | ||
<rule ref="Squiz.WhiteSpace.ScopeClosingBrace"> | ||
<exclude-pattern>*.phtml</exclude-pattern> | ||
</rule> | ||
<rule ref="PEAR.WhiteSpace.ScopeClosingBrace.Line"> | ||
<exclude-pattern>*.phtml</exclude-pattern> | ||
</rule> | ||
<rule ref="Squiz.WhiteSpace.ControlStructureSpacing"> | ||
<exclude-pattern>*.phtml</exclude-pattern> | ||
</rule> | ||
<rule ref="Generic.CodeAnalysis.ForLoopWithTestFunctionCall.NotAllowed"> | ||
<exclude-pattern>*.phtml</exclude-pattern> | ||
</rule> | ||
</ruleset> |