Skip to content

Commit 029fada

Browse files
committed
Merge branch 'develop' of github.com:magento/magento-coding-standard into ticket-162
2 parents 3e79a8a + 283c9bb commit 029fada

File tree

1 file changed

+58
-34
lines changed

1 file changed

+58
-34
lines changed

README.md

Lines changed: 58 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,18 @@
22

33
A set of Magento rules for [PHP_CodeSniffer](https://github.com/squizlabs/PHP_CodeSniffer) tool.
44

5-
#### Installation within a Magento 2 site
5+
## Installation within a Magento 2 site
6+
67
To use within your Magento 2 project you can use:
7-
````
8+
9+
```bash
810
composer require --dev magento/magento-coding-standard
9-
````
11+
```
12+
1013
Due to security, when installed this way the Magento standard for phpcs cannot be added automatically.
1114
You can achieve this by adding the following to your project's `composer.json`:
12-
````
15+
16+
```json
1317
"scripts": {
1418
"post-install-cmd": [
1519
"([ $COMPOSER_DEV_MODE -eq 0 ] || vendor/bin/phpcs --config-set installed_paths ../../magento/magento-coding-standard/)"
@@ -18,65 +22,85 @@ You can achieve this by adding the following to your project's `composer.json`:
1822
"([ $COMPOSER_DEV_MODE -eq 0 ] || vendor/bin/phpcs --config-set installed_paths ../../magento/magento-coding-standard/)"
1923
]
2024
}
21-
````
25+
```
2226

2327
### Installation for development
24-
You can install Magento Coding Standard by cloning this GitHub repo
25-
```
26-
$ git clone [email protected]:magento/magento-coding-standard.git
27-
$ cd magento-coding-standard
28-
$ composer install
28+
29+
You can install Magento Coding Standard by cloning this GitHub repo:
30+
31+
```bash
32+
git clone [email protected]:magento/magento-coding-standard.git
33+
cd magento-coding-standard
34+
composer install
2935
```
36+
3037
It is possible also to install a standalone application via [Composer](https://getcomposer.org)
31-
```
32-
$ composer create-project magento/magento-coding-standard --stability=dev magento-coding-standard
38+
39+
```bash
40+
composer create-project magento/magento-coding-standard --stability=dev magento-coding-standard
3341
```
3442

35-
#### Verify installation
43+
### Verify installation
44+
3645
Command should return the list of installed coding standards including Magento2.
46+
47+
```bash
48+
vendor/bin/phpcs -i
3749
```
38-
$ vendor/bin/phpcs -i
39-
```
40-
### Usage
41-
Once installed, you can run `phpcs` from the command-line to analyse your code `MyAwesomeExtension`
42-
```
43-
$ vendor/bin/phpcs --standard=Magento2 app/code/MyAwesomeExtension
50+
51+
## Usage
52+
53+
Once installed, you can run `phpcs` from the command-line to analyze your code `MyAwesomeExtension`
54+
55+
```bash
56+
vendor/bin/phpcs --standard=Magento2 app/code/MyAwesomeExtension
4457
```
4558

4659
### Fixing issues automatically
47-
Also you can run `phpcbf` from the command-line to fix your code `MyAwesomeExtension` for warnings like
48-
"PHPCBF CAN FIX THE [0-9]+ MARKED SNIFF VIOLATIONS AUTOMATICALLY"
60+
61+
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"
62+
63+
```bash
64+
vendor/bin/phpcbf --standard=Magento2 app/code/MyAwesomeExtension
4965
```
50-
$ vendor/bin/phpcbf --standard=Magento2 app/code/MyAwesomeExtension
51-
```
52-
53-
## Where to contribute
66+
67+
## Contribution
68+
69+
See the community [contribution model](https://github.com/magento/magento-coding-standard/blob/develop/.github/CONTRIBUTING.md).
70+
71+
### Where to contribute
72+
5473
- Documentation of existing rules. See [ExtDN PHP CodeSniffer rules for Magento 2](https://github.com/extdn/extdn-phpcs) as a good example.
5574
- Bug fixes and improvements of existing rules.
5675
- Creation of new PHP CodeSniffer rules.
5776
- Discussions on new rules (through periodic hangouts or discussions per GitHub issue).
5877

59-
## How to contribute
78+
### How to contribute
79+
6080
1) Start with looking into [Community Dashboard](https://github.com/magento/magento-coding-standard/projects/1). Any ticket in `Up for grabs` is a good candidate to start.
6181
2) Didn't satisfy your requirements? [Create one of three types of issues](https://github.com/magento/magento-coding-standard/issues/new/choose):
6282
- **Bug report** - Found a bug in the code? Let us know!
6383
- **Existing rule enhancement** - Know how to improve existing rules? Open an issue describe how to enhance Magento Coding Standard.
6484
- **New rule proposal** - Know how to improve Magento ecosystem code quality? Do not hesitate to open a proposal.
65-
3) The issue will appear in the `Backlog` column of the [Community Dashboard](https://github.com/magento/magento-coding-standard/projects/1). Once it will be discussed and get `Accepted` label the issue will appear in the `Up for grabs` column.
85+
3) The issue will appear in the `Backlog` column of the [Community Dashboard](https://github.com/magento/magento-coding-standard/projects/1). Once it will be discussed and get `accepted` label the issue will appear in the `Up for grabs` column.
6686

6787
## Testing
68-
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`.
88+
89+
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`.
6990
You can verify your code by running
70-
```
71-
$ vendor/bin/phpunit
91+
92+
```bash
93+
vendor/bin/phpunit
7294
```
7395

7496
Also, verify that the sniffer code itself is written according to the Magento Coding Standard:
75-
```
76-
$ vendor/bin/phpcs --standard=Magento2 Magento2/ --extensions=php
97+
98+
```bash
99+
vendor/bin/phpcs --standard=Magento2 Magento2/ --extensions=php
77100
```
78101

79102
## License
80-
Each Magento source file included in this distribution is licensed under OSL-3.0 license.
81103

82-
Please see [LICENSE.txt](https://github.com/magento/magento-coding-standard/blob/master/LICENSE.txt) for the full text of the [Open Software License v. 3.0 (OSL-3.0)](http://opensource.org/licenses/osl-3.0.php).
104+
Each Magento source file included in this distribution is licensed under the OSL-3.0 license.
105+
106+
Please see [LICENSE.txt](https://github.com/magento/magento-coding-standard/blob/master/LICENSE.txt) for the full text of the [Open Software License v. 3.0 (OSL-3.0)](https://opensource.org/licenses/osl-3.0.php).

0 commit comments

Comments
 (0)