Skip to content

Commit

Permalink
Merge pull request #48 from sivaschenko/magento-coding-standard-inspe…
Browse files Browse the repository at this point in the history
…ctions

Added instructions on magneto-coding-standard execution and configuration for PHPStorm
  • Loading branch information
jeff-matthews authored Aug 24, 2022
2 parents 8cbfc69 + 7b1c70d commit 64eb3b1
Showing 1 changed file with 28 additions and 1 deletion.
29 changes: 28 additions & 1 deletion src/pages/coding-standards/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,33 @@ description: Review Adobe Commerce and Magento Open Source coding standards for
<!-- This topic is referred to from Magento 2 code! Don't change the [URL](https://glossary.magento.com/url) without informing engineering! -->
<!-- Referring file: contributing.md owned by core -->

Like many large projects, Adobe Commerce and Magento Open Source coding standards. Use the coding standards when you contribute to the codebase or create extensions.
Like many large projects, Adobe Commerce and Magento Open Source have coding standards. Use the coding standards when you contribute to the codebase or create extensions.

## Ensuring the code is compliant

You can perform Magento Coding Standard inspection with the Magento2 PHP_CodeSniffer standard.

To execute the inspection from the command line, run the following command from the project root:

```bash
vendor/bin/phpcs --standard=Magento2 <path to inspect>
```

To include the Magento Coding Standard as part of PHPStorm inspections:

- Open PHPStorm preferences
- Navigate to "Editor" | "Inspections"
- Select "PHP" | "Quality Tools" | "PHP_CodeSniffer validation"
- Set "Coding standard" to "Custom" and select the path to `<project_root>/vendor/magento/magento-coding-standard/Magento2/ruleset.xml`
- Check "Installed standards path" and select the path to `<project_root>/vendor/php-compatibility/PHPCompatibility`

## Contributing

The Magento Coding Standard is created and maintained by the Magento community! See the [Contribution guide](contributing.md) if you'd like to participate.

## Review the standards

Standard details and guides:

- [Code demarcation standard](code-demarcation.md)
- [PHP coding standard](php.md)
Expand All @@ -18,3 +44,4 @@ Like many large projects, Adobe Commerce and Magento Open Source coding standard
- [JavaScript DocBlock standard](js-docblock.md)
- [LESS coding standard](less.md)
- [HTML style guide](html-style-guide.md)
- [Technical guidelines](technical-guidelines.md)

0 comments on commit 64eb3b1

Please sign in to comment.