Skip to content

Commit

Permalink
Merge pull request #2 from fredden/youwe-magento2
Browse files Browse the repository at this point in the history
Use official Magento2 coding standard as base for YouweMagento2
  • Loading branch information
leonhelmus authored Sep 21, 2022
2 parents 2913e79 + f243571 commit 4af2e56
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 47 deletions.
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
# Introduction

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

# Installation

Use composer to require the standard in a project.

```shell
composer require --dev mediact/coding-standard-magento2
composer require --dev youwe/coding-standard-magento2
```

To let PHPCS know that this standard should be used add a phpcs.xml file in the
Expand All @@ -18,20 +18,20 @@ root of the project.
```xml
<?xml version="1.0"?>
<ruleset>
<rule ref="./vendor/mediact/coding-standard-magento2/src/MediactMagento2"/>
<rule ref="./vendor/youwe/coding-standard-magento2/src/YouweMagento2"/>
</ruleset>
```

# Integration with PHPStorm and automatic testing

The recommended way to enable the coding standard in PHPStorm and automatic
testing is by requiring the MediaCT testing suite in a project.
testing is by requiring the Youwe testing suite in a project.

```shell
composer require --dev mediact/testing-suite
composer require --dev youwe/testing-suite
```

For more information go to [MediaCT Testing Suite](https://github.com/mediact/testing-suite).
For more information go to [Youwe Testing Suite](https://github.com/YouweGit/testing-suite).

# Contribution guidelines

Expand Down
21 changes: 16 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,22 +1,33 @@
{
"name": "youwe/coding-standard-magento2",
"description": "Youwe PHP Coding Standard for Magento2",
"type": "phpcs-sniffs",
"homepage": "https://github.com/YouweGit/coding-standard-magento2",
"license": "proprietary",
"type": "phpcs-sniffs",
"authors": [
{
"name": "Youwe B.V.",
"email": "[email protected]"
}
],
"homepage": "https://github.com/YouweGit/coding-standard-magento2",
"require": {
"youwe/coding-standard": ">=3.3.0"
"magento/magento-coding-standard": "*",
"youwe/coding-standard": "^3.5.0"
},
"autoload": {
"psr-0": {
"MediactMagento2": "src/MediactMagento2",
"Magento2": "src/Magento2"
"YouweMagento2": "src/YouweMagento2"
}
},
"scripts": {
"post-install-cmd": [
"@phpcs-set-paths"
],
"post-update-cmd": [
"@phpcs-set-paths"
],
"phpcs-set-paths": [
"vendor/bin/phpcs --config-set installed_paths src/,../../magento/magento-coding-standard/,../../phpcompatibility/php-compatibility/"
]
}
}
17 changes: 0 additions & 17 deletions src/MediactMagento2/phpmd.xml

This file was deleted.

11 changes: 0 additions & 11 deletions src/MediactMagento2/ruleset.xml

This file was deleted.

File renamed without changes.
21 changes: 14 additions & 7 deletions src/Magento2/ruleset.xml → src/YouweMagento2/ruleset.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,30 @@
* https://www.youweagency.com
*/
-->
<ruleset name="Magento2">
<description>Youwe coding standards for Magento2.</description>
<ruleset name="YouweMagento2">
<description>Youwe coding standards for Magento2 websites and modules</description>

<arg name="colors" />
<arg name="extensions" value="php/PHP,phtml/PHP,js/JS,css/CSS" />

<!-- Base rules on Youwe -->
<rule ref="../../../coding-standard/src/GlobalCommon">
<exclude name="Squiz.Classes.ValidClassName.NotCamelCaps" />
<exclude name="Squiz.Commenting.FunctionComment.ScalarTypeHintMissing" />
<rule ref="Youwe">
<exclude name="GlobalCommon.Php7.ReturnType" />
<exclude name="Squiz.Commenting.FunctionComment.TypeHintMissing" />
<exclude name="PSR2.Methods.MethodDeclaration.Underscore" />
<exclude name="Squiz.Classes.ValidClassName.NotCamelCaps" />
<exclude name="Squiz.Commenting.FunctionComment.EmptyThrows" />
<exclude name="Squiz.Commenting.FunctionComment.ScalarTypeHintMissing" />
<exclude name="Squiz.Commenting.FunctionComment.TypeHintMissing" />
</rule>

<!-- Import most rules from official Magento2 coding standard -->
<rule ref="Magento2">
<exclude name="Magento2.Annotation" />
<exclude name="Magento2.Commenting.ClassPropertyPHPDocFormatting" />
</rule>

<rule ref="Generic.Files.LineLength.TooLong">
<exclude-pattern>*.phtml</exclude-pattern>
<exclude-pattern>*.phtml,*.xml</exclude-pattern>
</rule>

<rule ref="Squiz.ControlStructures.ControlSignature">
Expand Down

0 comments on commit 4af2e56

Please sign in to comment.