Skip to content

Commit 9c13547

Browse files
committed
Fix various configs and compatibility issues.
1 parent 9c9041d commit 9c13547

28 files changed

+881
-148
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
/vendor/
22
/composer.lock
3+
/configs/behat.merged.yml

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,15 @@ For a website:
2222

2323
```json
2424
"grumphp": {
25-
"config-default-path": "/vendor/gent/qa-drupal/configs/grumphp-site.yml"
25+
"config-default-path": "vendor/gent/qa-drupal/configs/grumphp-site.yml"
2626
}
2727
```
2828

2929
For an extension:
3030

3131
```json
3232
"grumphp": {
33-
"config-default-path": "/vendor/gent/qa-drupal/configs/grumphp-extension.yml"
33+
"config-default-path": "vendor/gent/qa-drupal/configs/grumphp-extension.yml"
3434
}
3535
```
3636

composer.json

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
{
22
"name": "gent/qa-drupal",
33
"description": "Quality Assurance tools and configuration for Drupal websites and extensions.",
4-
"type": "composer-plugin",
4+
"type": "library",
55
"autoload": {
66
"psr-4": {
77
"Gent\\QA\\Drupal\\": "src/"
88
}
99
},
1010
"require": {
11-
"composer-plugin-api": "^1.0",
1211
"drupal/coder": "^8.3",
1312
"drupal/core": "^8.9",
1413
"drupal/drupal-extension": "^4.1",
@@ -18,14 +17,9 @@
1817
"phpro/grumphp": "^0.18.1",
1918
"phpspec/prophecy": "^1.10",
2019
"phpstan/phpstan-deprecation-rules": "^0.12.5",
21-
"phpunit/phpunit": "^8.4",
22-
"sebastian/phpcpd": "^4.0"
23-
},
24-
"require-dev": {
25-
"composer/composer": "^1.10"
26-
},
27-
"extra": {
28-
"class": "Gent\\QA\\Drupal\\ComposerPlugin"
20+
"phpunit/phpunit": "^7.5",
21+
"sebastian/phpcpd": "^4.0",
22+
"symfony/dotenv": "^3.4"
2923
},
3024
"minimum-stability": "dev",
3125
"prefer-stable": true,

configs/behat.yml

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,19 @@ default:
44
tags: ~@javascript
55
suites:
66
default:
7-
paths: [ %paths.base%/tests/features ]
7+
paths:
8+
- %paths.base%/tests/features
89
contexts:
910
- Drupal\DrupalExtension\Context\ConfigContext
1011
- Drupal\DrupalExtension\Context\DrupalContext
1112
- Drupal\DrupalExtension\Context\MarkupContext
1213
- Drupal\DrupalExtension\Context\MessageContext
1314
- Drupal\DrupalExtension\Context\MinkContext
15+
- Gent\QA\Drupal\Behat\Context\AccessContext
16+
- Gent\QA\Drupal\Behat\Context\DebugContext:
17+
path: %paths.base%/tests/features/dumps
18+
- Gent\QA\Drupal\Behat\Context\UriContext
19+
- Gent\QA\Drupal\Behat\Context\SelectorContext
1420
extensions:
1521
Behat\MinkExtension:
1622
goutte: ~
@@ -20,22 +26,18 @@ default:
2026
goutte: ~
2127
javascript:
2228
selenium2:
23-
wd_host: 'http://localhost:4444/wd/hub'
29+
wd_host: "http://localhost:4444/wd/hub"
2430
Drupal\DrupalExtension:
2531
blackbox: ~
26-
api_driver: 'drupal'
32+
api_driver: "drupal"
2733
drush:
28-
root: %paths.base%/../../../../web
34+
root: %paths.base%/web
2935
drupal:
30-
drupal_root: %paths.base%/../../../../web
36+
drupal_root: %paths.base%/web
3137
region_map:
3238
header: ".header"
3339
content: ".region-content"
3440
selectors:
35-
message_selector: '.messages'
36-
error_message_selector: '.messages.messages--error'
37-
success_message_selector: '.messages.messages--status'
38-
39-
imports:
40-
- behat.yml
41-
- behat.local.yml
41+
message_selector: ".messages"
42+
error_message_selector: ".messages.messages--error"
43+
success_message_selector: ".messages.messages--status"

configs/grumphp-extension.yml

Lines changed: 28 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,24 +6,31 @@ parameters:
66
ascii: ~
77
fixer:
88
enabled: true
9-
fix_by_default: false
9+
fix_by_default: true
10+
extensions:
11+
- Gent\QA\Drupal\GrumPHPExtension
1012
testsuites:
1113
git_commit_msg:
1214
tasks:
1315
- git_commit_message
1416
git_pre_commit:
1517
tasks:
18+
- composer
1619
- git_blacklist
1720
- git_branch_name
21+
- phpcpd
1822
- phpcs
1923
- phpmd
24+
- phpstan
25+
- yamllint
26+
tests:
27+
tasks:
28+
- behat
29+
- phpunit
2030
tasks:
2131
behat:
22-
config: vendor/gent/qa-drupal/configs/behat.yml
32+
config: .behat-merged.yml
2333
composer: ~
24-
composer_normalize:
25-
indent_size: ~
26-
indent_style: ~
2734
git_blacklist:
2835
keywords:
2936
- " die\\("
@@ -39,18 +46,28 @@ parameters:
3946
- profile
4047
git_branch_name:
4148
whitelist:
42-
- "#^feature/[A-Z]+-\\d+$#"
43-
- "#^feature/[a-z\\-]+$#"
44-
- "#^\\d+\\.\\d+\\.x$#"
49+
- "#^\\d+\\.\\d+\\.x|feature/([A-Z]+-\\d+|[a-z]+(-[a-z]+)*)$#"
4550
git_commit_message:
4651
enforce_no_subject_trailing_period: false
4752
max_body_width: 80
4853
max_subject_width: 80
4954
matchers:
50-
- "/^[A-Z]+-\\d+(, [A-Z]+-\\d+): (Add|Change|Fix|Update|Remove) /"
51-
- "/^(Add|Change|Fix|Update|Remove) /"
55+
- "/^([A-Z]+-\\d+(, [A-Z]+-\\d+): )?(Add|Change|Fix|Update|Remove) /"
5256
case_insensitive: false
53-
phpcpd: ~
57+
phpcpd:
58+
names_exclude:
59+
- "*.api.php"
60+
- "*Test.php"
61+
- "*TestBase.php"
62+
- "*TestCase.php"
63+
min_lines: 10
64+
triggered_by:
65+
- php
66+
- inc
67+
- install
68+
- module
69+
- theme
70+
- profile
5471
phpcs:
5572
standard:
5673
- vendor/gent/qa-drupal/configs/phpcs.xml
@@ -66,7 +83,6 @@ parameters:
6683
- profile
6784
- yml
6885
phpmd:
69-
report_format: ansi
7086
ruleset:
7187
- vendor/gent/qa-drupal/configs/phpmd.xml
7288
triggered_by:

configs/grumphp-site.yml

Lines changed: 47 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,45 @@
11
parameters:
22
hooks_dir: ~
33
hooks_preset: local
4-
stop_on_failure: true
4+
stop_on_failure: false
55
hide_circumvention_tip: true
66
ascii: ~
77
fixer:
88
enabled: true
9-
fix_by_default: false
10-
environment:
11-
file:
12-
- .env
13-
- .env.local
9+
fix_by_default: true
10+
extensions:
11+
- Gent\QA\Drupal\GrumPHPExtension
1412
testsuites:
1513
git_commit_msg:
1614
tasks:
1715
- git_commit_message
1816
git_pre_commit:
1917
tasks:
18+
- composer
2019
- git_blacklist
2120
- git_branch_name
21+
- phpcpd
2222
- phpcs
2323
- phpmd
24+
- phpstan
25+
- yamllint
26+
tests:
27+
tasks:
28+
- behat
29+
- phpunit
2430
tasks:
2531
behat:
26-
config: vendor/gent/qa-drupal/configs/behat.yml
27-
composer: ~
28-
composer_normalize:
29-
indent_size: ~
30-
indent_style: ~
32+
config: .behat-merged.yml
33+
composer:
34+
no_check_publish: true
3135
git_blacklist:
3236
keywords:
3337
- " die\\("
3438
- " exit;"
3539
- " exit\\("
3640
- "\\$_[A-Z_]+\\["
3741
whitelist_patterns:
38-
- "#^web/modules/custom/#"
39-
- "#^web/profiles/custom/#"
40-
- "#^web/themes/custom/#"
42+
- "#^web/(modules|themes|profiles)/custom/#"
4143
triggered_by:
4244
- php
4345
- inc
@@ -47,28 +49,43 @@ parameters:
4749
- profile
4850
git_branch_name:
4951
whitelist:
50-
- "#^feature/[A-Z]+-\\d+$#"
51-
- "#^feature/[a-z\\-]+$#"
52-
- "#^release/\\d+\\.\\d+\\.\\d+$#"
53-
- "#^hotfix/\\d+\\.\\d+\\.\\d+$#"
54-
- develop
52+
- "#^develop|feature/([A-Z]+-\\d+|[a-z]+(-[a-z]+)*)|(release|hotfix)/\\d+(\\.\\d+){2}$#"
5553
git_commit_message:
5654
enforce_no_subject_trailing_period: false
5755
max_body_width: 80
5856
max_subject_width: 80
5957
matchers:
60-
- "/^[A-Z]+-\\d+(, [A-Z]+-\\d+)*: (Add|Change|Fix|Update|Remove) /"
61-
- "/^(Add|Change|Fix|Update|Remove) /"
58+
- "/^([A-Z]+-\\d+(, [A-Z]+-\\d+)*: )?(Add|Change|Fix|Update|Remove) /"
6259
case_insensitive: false
63-
phpcpd: ~
60+
phpcpd:
61+
directory:
62+
- web
63+
exclude:
64+
- core
65+
- libraries
66+
- modules/contrib
67+
- themes/contrib
68+
- profiles/contrib
69+
- sites
70+
names_exclude:
71+
- "*.api.php"
72+
- "*Test.php"
73+
- "*TestBase.php"
74+
- "*TestCase.php"
75+
min_lines: 10
76+
triggered_by:
77+
- php
78+
- inc
79+
- install
80+
- module
81+
- theme
82+
- profile
6483
phpcs:
6584
standard:
6685
- vendor/gent/qa-drupal/configs/phpcs.xml
6786
report_width: 120
6887
whitelist_patterns:
69-
- "#^web/modules/custom/#"
70-
- "#^web/profiles/custom/#"
71-
- "#^web/themes/custom/#"
88+
- "#^web/(modules|themes|profiles)/custom/#"
7289
ignore_patterns:
7390
- node_modules/
7491
triggered_by:
@@ -80,13 +97,10 @@ parameters:
8097
- profile
8198
- yml
8299
phpmd:
83-
whitelist_patterns:
84-
- "#^web/modules/custom/#"
85-
- "#^web/profiles/custom/#"
86-
- "#^web/themes/custom/#"
87-
report_format: ansi
88100
ruleset:
89101
- vendor/gent/qa-drupal/configs/phpmd.xml
102+
whitelist_patterns:
103+
- "#^web/(modules|themes|profiles)/custom/#"
90104
triggered_by:
91105
- php
92106
- inc
@@ -98,9 +112,7 @@ parameters:
98112
configuration: vendor/gent/qa-drupal/configs/phpstan-site.neon
99113
level: 8
100114
force_patterns:
101-
- "#^web/modules/custom/#"
102-
- "#^web/profiles/custom/#"
103-
- "#^web/themes/custom/#"
115+
- "#^web/(modules|themes|profiles)/custom/#"
104116
ignore_patterns:
105117
- "#.*#"
106118
triggered_by:
@@ -114,11 +126,8 @@ parameters:
114126
config_file: vendor/gent/qa-drupal/configs/phpunit-site.xml
115127
yamllint:
116128
whitelist_patterns:
117-
- "#^[^/]+\\.yml$#"
118-
- "#^\\.[^/]+/[^/]+\\.yml$#"
129+
- "#^(\\.[^/]+/)?[^/]+\\.yml$#"
119130
- "#^config/#"
120-
- "#^web/modules/custom/#"
121-
- "#^web/profiles/custom/#"
122-
- "#^web/themes/custom/#"
131+
- "#^web/(modules|themes|profiles)/custom/#"
123132
ignore_patterns:
124133
- node_modules/

configs/phpcs.xml

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,23 @@
22
<ruleset>
33
<description>PHP CodeSniffer ruleset for Drupal.</description>
44

5-
<rule ref="vendor/drupal/coder/coder_sniffer/Drupal">
6-
<rule ref="Drupal.Files.LineLength">
7-
<properties>
8-
<property name="lineLimit" value="120"/>
9-
<property name="absoluteLineLimit" value="150"/>
10-
</properties>
11-
</rule>
5+
<rule ref="vendor/drupal/coder/coder_sniffer/Drupal" />
6+
7+
<rule ref="vendor/drupal/coder/coder_sniffer/DrupalPractice">
8+
<exclude name="DrupalPractice.Yaml.RoutingAccess.OpenCallback" />
9+
<exclude name="DrupalPractice.FunctionDefinitions.AccessHookMenu" />
10+
</rule>
11+
12+
<rule ref="Drupal.Files.LineLength">
13+
<properties>
14+
<property name="lineLimit" value="120" />
15+
<property name="absoluteLineLimit" value="150" />
16+
</properties>
1217
</rule>
1318

14-
<rule ref="vendor/drupal/coder/coder_sniffer/DrupalPractice" />
19+
<rule ref="Drupal.Arrays.Array">
20+
<properties>
21+
<property name="lineLimit" value="120" />
22+
</properties>
23+
</rule>
1524
</ruleset>

0 commit comments

Comments
 (0)