Skip to content

Commit 474d8af

Browse files
committed
repo cleanup
1 parent f81c451 commit 474d8af

File tree

5 files changed

+28
-13
lines changed

5 files changed

+28
-13
lines changed

.eslintrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
"extends": "./vendor/space48/code-quality/rulesets/.eslintrc"
2+
"extends": "./vendor/space48/magento2-code-quality/rulesets/.eslintrc"
33
}

README.md

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -37,38 +37,51 @@ On Magento versions **earlier than 2.4** add following to 'require' section of p
3737
```
3838

3939
#### 1. Run following commands from project root:
40+
Add the module
41+
```shell
42+
warden env exec php-fpm composer require --dev space48/magento2-code-quality
4043
```
41-
warden env exec php-fpm composer config repositories.space48-code-quality vcs [email protected]:Space48/code-quality.git
42-
warden env exec php-fpm composer require --dev space48/code-quality:@dev
43-
warden env exec php-fpm chmod +x ./vendor/space48/code-quality/script/install.sh
44-
warden env exec ./vendor/space48/code-quality/script/install.sh
44+
45+
When it will ask for 'grumphp.yml' creation - answer `no`:
46+
```shell
47+
Do you want to create a grumphp.yml file? [Yes]: no
48+
```
49+
50+
Copy files and install npm packages:
51+
```shell
52+
warden env exec php-fpm chmod +x vendor/space48/magento2-code-quality/script/install.sh
53+
warden env exec ./vendor/space48/magento2-code-quality/script/install.sh
4554
vendor/bin/grumphp git:init
55+
```
56+
57+
Add configuration files to git:
58+
```shell
4659
git add ruleset.xml phpmd.xml .eslintrc grumphp.yml
4760
```
4861

4962
#### 2. Add following to project`s 'Makefile':
5063
```makefile
5164
linters-init: # init linters on local machine
52-
warden env exec php-fpm chmod +x ./vendor/space48/code-quality/script/install.sh
53-
warden env exec php-fpm ./vendor/space48/code-quality/script/install.sh
65+
warden env exec php-fpm chmod +x vendor/space48/magento2-code-quality/script/install.sh
66+
warden env exec php-fpm ./vendor/space48/magento2-code-quality/script/install.sh
5467
vendor/bin/grumphp git:init
5568

5669
analyse: # analyses all code from starting commit hash to HEAD
57-
git diff e111c999..HEAD | warden env run --rm php-fpm 'vendor/phpro/grumphp/bin/grumphp' run
70+
git diff a000z999..HEAD | warden env run --rm php-fpm 'vendor/phpro/grumphp/bin/grumphp' run
5871

5972
precommit: # analyses code staged for commit
6073
git diff --staged | warden env run --rm php-fpm 'vendor/phpro/grumphp/bin/grumphp' run
6174
```
6275

63-
Replace the sample `e111c999` commit hash with the hash from the project where you want to start linting from.
76+
Replace the sample `a000z999` commit hash with the hash from the project where you want to start linting from.
6477
Files modified after the starting commit hash will be linted during project build and will fail the build on linter violations.
6578

6679
#### 3. Commit to project`s repo.
6780
Commit updated composer files, vendor folder, code-quality config files from the root and 'makefile' changes
6881

6982
### Installation on any other Magento 2 project:
7083
1. add module `space48/code-quality` via Composer
71-
2. run `vendor/space48/code-quality/script/install.sh` script to copy necessary files
84+
2. run `vendor/space48/code-quality/script/install.sh` script to copy necessary files and install npm packages
7285
3. run `vendor/bin/grumphp git:init` to update precommit hooks
7386

7487
## Configuration
@@ -94,5 +107,7 @@ To turn off whole linter type (for example 'eslint') - remove or comment out cor
94107
Linter rules can be finetuned on a project level by editing `ruleset.xml, phpmd.xml, .eslintrc` files.
95108
See `Space48/code-quality/rulesets/` for examples.
96109

110+
Some rules can be overwritten on a class level. See `rulesets/PhpMd/extra.xml` for examples.
111+
97112
## More info
98113
For more info and for Configuration help refer to [grumphp repo](https://github.com/phpro/grumphp) docs.

phpmd.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0"?>
22

33
<ruleset name="Space48 Coding Standard Project Specific">
4-
<rule ref="vendor/space48/code-quality/rulesets/phpmd.xml" >
4+
<rule ref="vendor/space48/magento2-code-quality/rulesets/phpmd.xml" >
55
</rule>
66

77
</ruleset>

ruleset.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0"?>
22

33
<ruleset name="Space48 Coding Standard Project Specific">
4-
<rule ref="vendor/space48/code-quality/rulesets/ruleset.xml">
4+
<rule ref="vendor/space48/magento2-code-quality/rulesets/ruleset.xml">
55
</rule>
66

77
</ruleset>

rulesets/phpmd.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
</rule>
2525

2626
<!-- Extra features -->
27-
<rule ref="vendor/space48/code-quality/rulesets/PhpMd/extra.xml" >
27+
<rule ref="vendor/space48/magento2-code-quality/rulesets/PhpMd/extra.xml" >
2828
</rule>
2929

3030
</ruleset>

0 commit comments

Comments
 (0)