Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added instructions on magneto-coding-standard execution and configuration for PHPStorm #48

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)