All Projects → magento → Magento Coding Standard

magento / Magento Coding Standard

Licence: other
Magento Coding Standard

Projects that are alternatives of or similar to Magento Coding Standard

M2cert
Adobe Magento2 Certification Study Guides - 2020/2021 Updates for M2 2.3/2.4
Stars: ✭ 147 (-33.48%)
Mutual labels:  magento
Algoliasearch Magento
Algolia Search integration for Magento 1 - compatible with versions from 1.6.x to 1.9.x
Stars: ✭ 163 (-26.24%)
Mutual labels:  magento
Ecommwar
A leaderboard of the top open-source e-commerce platforms. Promoting the bests for building reliable stores.
Stars: ✭ 203 (-8.14%)
Mutual labels:  magento
Magevulndb
List of Magento extensions with known security issues.
Stars: ✭ 152 (-31.22%)
Mutual labels:  magento
Bitnami Docker Magento
Bitnami Docker Image for Magento
Stars: ✭ 159 (-28.05%)
Mutual labels:  magento
Docker Compose Development
Clone and `bin/dev up`. Quickly start of developing locally with Nginx, PHP, Blackfire, Percona, Mailhog and Redis. Out of the box support for Magento2 Developer Box
Stars: ✭ 171 (-22.62%)
Mutual labels:  magento
Vip Coding Standards
PHP_CodeSniffer ruleset to enforce WordPress.com VIP and VIP Go coding standards
Stars: ✭ 133 (-39.82%)
Mutual labels:  php-codesniffer
Magento2 Google Tag Manager
Google Tag Manager is a user-friendly, yet powerful and cost-effective solution that is a must-have integration for every Magento store. It simplifies the process of adding and managing third-party JavaScript tags. With dozens of custom events and hundreds of data points our extensions the #1 GTM solution for Magento.
Stars: ✭ 208 (-5.88%)
Mutual labels:  magento
Importexportfree
Improve default Magento 2 Import / Export features - cron jobs, CSV , XML , JSON , Excel , mapping of any format, Google Sheet, data and price modification, improved speed and a lot more!
Stars: ✭ 160 (-27.6%)
Mutual labels:  magento
Primary Vagrant
An Apache based Vagrant configuration for helping you get the most out of WordPress Development
Stars: ✭ 192 (-13.12%)
Mutual labels:  php-codesniffer
Masquerade
Faker-driven, configuration-based, platform-agnostic, locale-compatible data faker tool
Stars: ✭ 152 (-31.22%)
Mutual labels:  magento
Magento2 Configurator
Magento 2 Configurator
Stars: ✭ 158 (-28.51%)
Mutual labels:  magento
Magento Mysql
Magento default mysql settings
Stars: ✭ 180 (-18.55%)
Mutual labels:  magento
Magento Chatbot
Magento Chatbot Integration with Telegram, Messenger, Whatsapp, WeChat, Skype and wit.ai.
Stars: ✭ 149 (-32.58%)
Mutual labels:  magento
Magento Composer Installer
Composer installer for Magento modules
Stars: ✭ 204 (-7.69%)
Mutual labels:  magento
Docker Magento
Docker image for Magento 1.6 to 1.9
Stars: ✭ 140 (-36.65%)
Mutual labels:  magento
Wordpress Coding Standards
PHP_CodeSniffer rules (sniffs) to enforce WordPress coding conventions
Stars: ✭ 2,070 (+836.65%)
Mutual labels:  php-codesniffer
Module Blog
Magento 2 Blog Extension
Stars: ✭ 213 (-3.62%)
Mutual labels:  magento
Warden
Warden is a CLI utility for orchestrating Docker based developer environments
Stars: ✭ 206 (-6.79%)
Mutual labels:  magento
Mage2vuestorefront
Magento to Vue-storefront datapump - synchronizes Products, Categories and Product-to-category links between your Magento2 API and NoSQL database of vue-storefront
Stars: ✭ 183 (-17.19%)
Mutual labels:  magento

Magento Coding Standard

A set of Magento rules for PHP_CodeSniffer tool.

Installation within a Magento 2 site

To use within your Magento 2 project you can use:

composer require --dev magento/magento-coding-standard

Due to security, when installed this way the Magento standard for phpcs cannot be added automatically. You can achieve this by adding the following to your project's composer.json:

"scripts": {
    "post-install-cmd": [
      "([ $COMPOSER_DEV_MODE -eq 0 ] || vendor/bin/phpcs --config-set installed_paths ../../magento/magento-coding-standard/)"
    ],
    "post-update-cmd": [
      "([ $COMPOSER_DEV_MODE -eq 0 ] || vendor/bin/phpcs --config-set installed_paths ../../magento/magento-coding-standard/)"
    ]
}

Installation for development

You can install Magento Coding Standard by cloning this GitHub repo:

git clone [email protected]:magento/magento-coding-standard.git
cd magento-coding-standard
composer install

It is possible also to install a standalone application via Composer

composer create-project magento/magento-coding-standard --stability=dev magento-coding-standard

Verify installation

Command should return the list of installed coding standards including Magento2.

vendor/bin/phpcs -i

Usage

Once installed, you can run phpcs from the command-line to analyze your code MyAwesomeExtension

vendor/bin/phpcs --standard=Magento2 app/code/MyAwesomeExtension

Fixing issues automatically

Also, you can run phpcbf from the command-line to fix your code MyAwesomeExtension for warnings like "PHPCBF CAN FIX THE [0-9]+ MARKED SNIFF VIOLATIONS AUTOMATICALLY"

vendor/bin/phpcbf --standard=Magento2 app/code/MyAwesomeExtension

Contribution

See the community contribution model.

Where to contribute

  • Documentation of existing rules. See ExtDN PHP CodeSniffer rules for Magento 2 as a good example.
  • Bug fixes and improvements of existing rules.
  • Creation of new PHP CodeSniffer rules.
  • Discussions on new rules (through periodic hangouts or discussions per GitHub issue).

How to contribute

  1. Start with looking into Community Dashboard. Any ticket in Up for grabs is a good candidate to start.
  2. Didn't satisfy your requirements? Create one of three types of issues:
    • Bug report - Found a bug in the code? Let us know!
    • Existing rule enhancement - Know how to improve existing rules? Open an issue describe how to enhance Magento Coding Standard.
    • New rule proposal - Know how to improve Magento ecosystem code quality? Do not hesitate to open a proposal.
  3. The issue will appear in the Backlog column of the Community Dashboard. Once it will be discussed and get accepted label the issue will appear in the Up for grabs column.

Testing

All rules should be covered by unit tests. Each Test.php class should be accompanied by a Test.inc file to allow for unit testing based upon the PHP_CodeSniffer parent class AbstractSniffUnitTest. You can verify your code by running

vendor/bin/phpunit

Also, verify that the sniffer code itself is written according to the Magento Coding Standard:

vendor/bin/phpcs --standard=Magento2 Magento2/ --extensions=php

License

Each Magento source file included in this distribution is licensed under the OSL-3.0 license.

Please see LICENSE.txt for the full text of the Open Software License v. 3.0 (OSL-3.0).

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].