Skip to content

Commit cac15ca

Browse files
author
Dan Wallis
committed
Import official Magento2 coding standard
1 parent 9371055 commit cac15ca

File tree

3 files changed

+26
-7
lines changed

3 files changed

+26
-7
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Introduction
22

33
This is the Youwe coding standard for Magento 2 projects. It is based on
4-
the default Youwe coding standard but some tests have been removed to create
4+
the default Magento2 coding standard but some tests have been removed to create
55
a workable and fast standard.
66

77
# Installation

composer.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,23 @@
1111
}
1212
],
1313
"require": {
14+
"magento/magento-coding-standard": "*",
1415
"youwe/coding-standard": ">=3.3.0"
1516
},
1617
"autoload": {
1718
"psr-0": {
1819
"YouweMagento2": "src/YouweMagento2"
1920
}
21+
},
22+
"scripts": {
23+
"post-install-cmd": [
24+
"@phpcs-set-paths"
25+
],
26+
"post-update-cmd": [
27+
"@phpcs-set-paths"
28+
],
29+
"phpcs-set-paths": [
30+
"vendor/bin/phpcs --config-set installed_paths src/,../../magento/magento-coding-standard/,../../phpcompatibility/php-compatibility/"
31+
]
2032
}
2133
}

src/YouweMagento2/ruleset.xml

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,22 +6,29 @@
66
*/
77
-->
88
<ruleset name="YouweMagento2">
9-
<description>Youwe coding standards for Magento2.</description>
9+
<description>Youwe coding standards for Magento2 websites and modules</description>
10+
1011
<arg name="colors" />
1112
<arg name="extensions" value="php/PHP,phtml/PHP,js/JS,css/CSS" />
1213

1314
<!-- Base rules on Youwe -->
14-
<rule ref="../../../coding-standard/src/GlobalCommon">
15-
<exclude name="Squiz.Classes.ValidClassName.NotCamelCaps" />
16-
<exclude name="Squiz.Commenting.FunctionComment.ScalarTypeHintMissing" />
15+
<rule ref="Youwe">
1716
<exclude name="GlobalCommon.Php7.ReturnType" />
18-
<exclude name="Squiz.Commenting.FunctionComment.TypeHintMissing" />
1917
<exclude name="PSR2.Methods.MethodDeclaration.Underscore" />
18+
<exclude name="Squiz.Classes.ValidClassName.NotCamelCaps" />
2019
<exclude name="Squiz.Commenting.FunctionComment.EmptyThrows" />
20+
<exclude name="Squiz.Commenting.FunctionComment.ScalarTypeHintMissing" />
21+
<exclude name="Squiz.Commenting.FunctionComment.TypeHintMissing" />
22+
</rule>
23+
24+
<!-- Import most rules from official Magento2 coding standard -->
25+
<rule ref="Magento2">
26+
<exclude name="Magento2.Annotation" />
27+
<exclude name="Magento2.Commenting.ClassPropertyPHPDocFormatting" />
2128
</rule>
2229

2330
<rule ref="Generic.Files.LineLength.TooLong">
24-
<exclude-pattern>*.phtml</exclude-pattern>
31+
<exclude-pattern>*.phtml,*.xml</exclude-pattern>
2532
</rule>
2633

2734
<rule ref="Squiz.ControlStructures.ControlSignature">

0 commit comments

Comments
 (0)