Skip to content

Commit 116f8b2

Browse files
authored
Merge pull request #2 from digipolisgent/feature/full-check
Add extra packages and configuration files.
2 parents 838b3fd + 9c13547 commit 116f8b2

25 files changed

+1260
-31
lines changed

.gitignore

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

README.md

Lines changed: 32 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,38 @@
1-
# Digipolis QA package for Drupal
1+
This package provides a set of Quality Assurance tools and configuration files for
2+
Drupal websites and extensions (modules, themes or profiles).
23

3-
This package provides tools to assist in assuring quality for Drupal projects.
44

5-
## Installation
5+
# Requirements
66

7-
Install with dependencies:
7+
* [Composer](https://getcomposer.org)
88

9+
10+
# Versions
11+
12+
| Package | Drupal |
13+
| ------- | ------ |
14+
| 1 | 8 |
15+
16+
17+
# Installation
18+
19+
First add one of following `grumphp` entries to the `extra` section of your `composer.json`.
20+
21+
For a website:
22+
23+
```json
24+
"grumphp": {
25+
"config-default-path": "vendor/gent/qa-drupal/configs/grumphp-site.yml"
26+
}
927
```
10-
composer require --dev gent/qa
28+
29+
For an extension:
30+
31+
```json
32+
"grumphp": {
33+
"config-default-path": "vendor/gent/qa-drupal/configs/grumphp-extension.yml"
34+
}
1135
```
36+
37+
Now install this package and its requirements by executing execute following command:
38+
<pre><code>composer require --dev gent/qa-drupal:^1.0</code></pre>

composer.json

Lines changed: 22 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,29 @@
11
{
2-
"name": "gent/qa",
3-
"description": "Provide tools to assure quality.",
4-
"keywords": ["gent", "qa"],
5-
"homepage": "https://github.com/digipolisgent/php_package_qa-drupal",
2+
"name": "gent/qa-drupal",
3+
"description": "Quality Assurance tools and configuration for Drupal websites and extensions.",
64
"type": "library",
7-
"license": "MIT",
8-
"authors": [
9-
{
10-
"name": "Maarten Segers",
11-
"email": "maarten.segers@digipolis.gent"
5+
"autoload": {
6+
"psr-4": {
7+
"Gent\\QA\\Drupal\\": "src/"
128
}
13-
],
14-
"minimum-stability": "dev",
15-
"prefer-stable": true,
9+
},
1610
"require": {
17-
"digipolisgent/grumphp-drupal-check": "^0.2.1",
18-
"phpro/grumphp": "^0.19",
19-
"phpunit/phpunit": "^8",
20-
"phpmd/phpmd": "^2.7",
21-
"sebastian/phpcpd": "^4.1",
22-
"sensiolabs/security-checker": "^6.0",
23-
"squizlabs/php_codesniffer": "^3.5"
11+
"drupal/coder": "^8.3",
12+
"drupal/core": "^8.9",
13+
"drupal/drupal-extension": "^4.1",
14+
"ergebnis/composer-normalize": "^2.8",
15+
"mglaman/phpstan-drupal": "^0.12.5",
16+
"phpmd/phpmd": "^2.9",
17+
"phpro/grumphp": "^0.18.1",
18+
"phpspec/prophecy": "^1.10",
19+
"phpstan/phpstan-deprecation-rules": "^0.12.5",
20+
"phpunit/phpunit": "^7.5",
21+
"sebastian/phpcpd": "^4.0",
22+
"symfony/dotenv": "^3.4"
2423
},
25-
"scripts": {
26-
"grumphp": "vendor/bin/grumphp run --ansi",
27-
"phpcs": "vendor/bin/phpcs",
28-
"test": "vendor/bin/phpunit",
29-
"coverage": "vendor/bin/phpunit --coverage-html ./build/coverage",
30-
"phpstan": "vendor/bin/phpstan analyse --level=7 ./src",
31-
"post-install-cmd": "vendor/bin/grumphp git:init"
24+
"minimum-stability": "dev",
25+
"prefer-stable": true,
26+
"config": {
27+
"sort-packages": true
3228
}
3329
}

configs/behat.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
default:
2+
gherkin:
3+
filters:
4+
tags: ~@javascript
5+
suites:
6+
default:
7+
paths:
8+
- %paths.base%/tests/features
9+
contexts:
10+
- Drupal\DrupalExtension\Context\ConfigContext
11+
- Drupal\DrupalExtension\Context\DrupalContext
12+
- Drupal\DrupalExtension\Context\MarkupContext
13+
- Drupal\DrupalExtension\Context\MessageContext
14+
- 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
20+
extensions:
21+
Behat\MinkExtension:
22+
goutte: ~
23+
selenium2: ~
24+
sessions:
25+
default:
26+
goutte: ~
27+
javascript:
28+
selenium2:
29+
wd_host: "http://localhost:4444/wd/hub"
30+
Drupal\DrupalExtension:
31+
blackbox: ~
32+
api_driver: "drupal"
33+
drush:
34+
root: %paths.base%/web
35+
drupal:
36+
drupal_root: %paths.base%/web
37+
region_map:
38+
header: ".header"
39+
content: ".region-content"
40+
selectors:
41+
message_selector: ".messages"
42+
error_message_selector: ".messages.messages--error"
43+
success_message_selector: ".messages.messages--status"

configs/grumphp-extension.yml

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
parameters:
2+
hooks_dir: ~
3+
hooks_preset: local
4+
stop_on_failure: true
5+
hide_circumvention_tip: true
6+
ascii: ~
7+
fixer:
8+
enabled: true
9+
fix_by_default: true
10+
extensions:
11+
- Gent\QA\Drupal\GrumPHPExtension
12+
testsuites:
13+
git_commit_msg:
14+
tasks:
15+
- git_commit_message
16+
git_pre_commit:
17+
tasks:
18+
- composer
19+
- git_blacklist
20+
- git_branch_name
21+
- phpcpd
22+
- phpcs
23+
- phpmd
24+
- phpstan
25+
- yamllint
26+
tests:
27+
tasks:
28+
- behat
29+
- phpunit
30+
tasks:
31+
behat:
32+
config: .behat-merged.yml
33+
composer: ~
34+
git_blacklist:
35+
keywords:
36+
- " die\\("
37+
- " exit;"
38+
- " exit\\("
39+
- "\\$_[A-Z_]+\\["
40+
triggered_by:
41+
- php
42+
- inc
43+
- install
44+
- module
45+
- theme
46+
- profile
47+
git_branch_name:
48+
whitelist:
49+
- "#^\\d+\\.\\d+\\.x|feature/([A-Z]+-\\d+|[a-z]+(-[a-z]+)*)$#"
50+
git_commit_message:
51+
enforce_no_subject_trailing_period: false
52+
max_body_width: 80
53+
max_subject_width: 80
54+
matchers:
55+
- "/^([A-Z]+-\\d+(, [A-Z]+-\\d+): )?(Add|Change|Fix|Update|Remove) /"
56+
case_insensitive: false
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
71+
phpcs:
72+
standard:
73+
- vendor/gent/qa-drupal/configs/phpcs.xml
74+
report_width: 120
75+
ignore_patterns:
76+
- node_modules/
77+
triggered_by:
78+
- php
79+
- inc
80+
- install
81+
- module
82+
- theme
83+
- profile
84+
- yml
85+
phpmd:
86+
ruleset:
87+
- vendor/gent/qa-drupal/configs/phpmd.xml
88+
triggered_by:
89+
- php
90+
- inc
91+
- install
92+
- module
93+
- theme
94+
- profile
95+
phpstan:
96+
configuration: vendor/gent/qa-drupal/configs/phpstan-extension.neon
97+
level: 8
98+
triggered_by:
99+
- php
100+
- inc
101+
- install
102+
- module
103+
- theme
104+
- profile
105+
phpunit:
106+
config_file: vendor/gent/qa-drupal/configs/phpunit-extension.xml
107+
yamllint:
108+
ignore_patterns:
109+
- node_modules/

configs/grumphp-site.yml

Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
parameters:
2+
hooks_dir: ~
3+
hooks_preset: local
4+
stop_on_failure: false
5+
hide_circumvention_tip: true
6+
ascii: ~
7+
fixer:
8+
enabled: true
9+
fix_by_default: true
10+
extensions:
11+
- Gent\QA\Drupal\GrumPHPExtension
12+
testsuites:
13+
git_commit_msg:
14+
tasks:
15+
- git_commit_message
16+
git_pre_commit:
17+
tasks:
18+
- composer
19+
- git_blacklist
20+
- git_branch_name
21+
- phpcpd
22+
- phpcs
23+
- phpmd
24+
- phpstan
25+
- yamllint
26+
tests:
27+
tasks:
28+
- behat
29+
- phpunit
30+
tasks:
31+
behat:
32+
config: .behat-merged.yml
33+
composer:
34+
no_check_publish: true
35+
git_blacklist:
36+
keywords:
37+
- " die\\("
38+
- " exit;"
39+
- " exit\\("
40+
- "\\$_[A-Z_]+\\["
41+
whitelist_patterns:
42+
- "#^web/(modules|themes|profiles)/custom/#"
43+
triggered_by:
44+
- php
45+
- inc
46+
- install
47+
- module
48+
- theme
49+
- profile
50+
git_branch_name:
51+
whitelist:
52+
- "#^develop|feature/([A-Z]+-\\d+|[a-z]+(-[a-z]+)*)|(release|hotfix)/\\d+(\\.\\d+){2}$#"
53+
git_commit_message:
54+
enforce_no_subject_trailing_period: false
55+
max_body_width: 80
56+
max_subject_width: 80
57+
matchers:
58+
- "/^([A-Z]+-\\d+(, [A-Z]+-\\d+)*: )?(Add|Change|Fix|Update|Remove) /"
59+
case_insensitive: false
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
83+
phpcs:
84+
standard:
85+
- vendor/gent/qa-drupal/configs/phpcs.xml
86+
report_width: 120
87+
whitelist_patterns:
88+
- "#^web/(modules|themes|profiles)/custom/#"
89+
ignore_patterns:
90+
- node_modules/
91+
triggered_by:
92+
- php
93+
- inc
94+
- install
95+
- module
96+
- theme
97+
- profile
98+
- yml
99+
phpmd:
100+
ruleset:
101+
- vendor/gent/qa-drupal/configs/phpmd.xml
102+
whitelist_patterns:
103+
- "#^web/(modules|themes|profiles)/custom/#"
104+
triggered_by:
105+
- php
106+
- inc
107+
- install
108+
- module
109+
- theme
110+
- profile
111+
phpstan:
112+
configuration: vendor/gent/qa-drupal/configs/phpstan-site.neon
113+
level: 8
114+
force_patterns:
115+
- "#^web/(modules|themes|profiles)/custom/#"
116+
ignore_patterns:
117+
- "#.*#"
118+
triggered_by:
119+
- php
120+
- inc
121+
- install
122+
- module
123+
- theme
124+
- profile
125+
phpunit:
126+
config_file: vendor/gent/qa-drupal/configs/phpunit-site.xml
127+
yamllint:
128+
whitelist_patterns:
129+
- "#^(\\.[^/]+/)?[^/]+\\.yml$#"
130+
- "#^config/#"
131+
- "#^web/(modules|themes|profiles)/custom/#"
132+
ignore_patterns:
133+
- node_modules/

0 commit comments

Comments
 (0)