Skip to content

Commit

Permalink
Merge pull request #6 from digipolisgent/feature/BW-143
Browse files Browse the repository at this point in the history
BW-143: Add QA package and prepare for Drupal 9
  • Loading branch information
MPParsley authored Dec 30, 2020
2 parents ebdd09f + c528383 commit cd96acd
Show file tree
Hide file tree
Showing 13 changed files with 81 additions and 251 deletions.
9 changes: 6 additions & 3 deletions .codeclimate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,16 @@ version: "2"

prepare:
fetch:
- url: "https://raw.githubusercontent.com/digipolisgent/ci_config-files-and-scripts/master/php/drupal8/.phpmd.xml"
path: ".phpmd.xml"
- url: "https://raw.githubusercontent.com/digipolisgent/ci_config-files-and-scripts/master/php/drupal8/.csslintrc"
path: ".csslintrc"
- url: "https://raw.githubusercontent.com/digipolisgent/ci_config-files-and-scripts/master/php/drupal8/.eslintrc.json"
path: ".eslintrc.json"
- url: "https://raw.githubusercontent.com/digipolisgent/ci_config-files-and-scripts/master/php/drupal8/.eslintignore"
path: ".eslintignore"
- url: "https://raw.githubusercontent.com/digipolisgent/php_package_qa-drupal/1.x/configs/phpcs.xml"
path: ".phpcs.xml"
- url: "https://raw.githubusercontent.com/digipolisgent/php_package_qa-drupal/1.x/configs/phpmd.xml"
path: ".phpmd.xml"

checks:
argument-count:
Expand Down Expand Up @@ -46,7 +48,7 @@ plugins:
phpcodesniffer:
enabled: true
config:
standard: "phpcs.xml"
standard: ".phpcs.xml"
phpmd:
enabled: true
config:
Expand Down Expand Up @@ -78,3 +80,4 @@ exclude_patterns:
- "**/.idea/**/*"
- "**/tests/**/*"
- "**/*.settings.php"
- "RoboFile.php"
15 changes: 3 additions & 12 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,13 +1,4 @@
# Ignore the module lock file.
/composer.lock

# Ignore vendor directories.
/vendor
/node_modules

# Ignore build artifacts.
/build
/build/
/vendor/
/.phpunit.result.cache

# Ignore binary translation files.
*.mo
/composer.lock
52 changes: 44 additions & 8 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,29 +1,65 @@
dist: bionic
language: php
sudo: false

php:
- 7.2
- 7.3
- 7.4

cache:
directories:
- $HOME/.composer/cache

env:
global:
- COMPOSER_MEMORY_LIMIT=-1
matrix:
- DRUPAL=8.9 PHPUNIT=7.5
- DRUPAL=9.0 PHPUNIT=8.5
- DRUPAL=9.1 PHPUNIT=8.5
- DRUPAL=9.2 PHPUNIT=8.5

jobs:
fast_finish: true

before_install:
# Tweak composer.
- composer config github-oauth.github.com ${GITHUB_TOKEN}
- composer global require "hirak/prestissimo:^0.3"
# Update composer.
- composer self-update --2
- composer --version

# Configure the authentication mechanisms.
- composer config -ga github-oauth.github.com $GITHUB_TOKEN
- composer config -ga http-basic.digipolis.repo.repman.io token $REPMAN_TOKEN

# Get the CodeClimate test reporter.
# Require Drupal core.
- composer require -n --no-update --sort-packages --dev drupal/core:~$DRUPAL.0 phpunit/phpunit:^$PHPUNIT

# Get and run the Code Climate test reporter.
- curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
- chmod +x ./cc-test-reporter
- ./cc-test-reporter before-build

install:
- COMPOSER_MEMORY_LIMIT=-1 composer install
- composer install -n

script:
- vendor/bin/grumphp run
- vendor/bin/grumphp run -n

after_script:
- ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT
# Run the Code Climate test reporter.
- ./cc-test-reporter after-build --coverage-input-type clover --exit-code $TRAVIS_TEST_RESULT

# Get and run the SonarQube scanner.
- SONAR_PROJECT_NAME="Drupal $(composer config name | cut -d / -f 2)"
- SONAR_PROJECT_KEY=web:$(echo "$TRAVIS_REPO_SLUG" | cut -d / -f 2)
- curl -L https://repo1.maven.org/maven2/org/sonarsource/scanner/cli/sonar-scanner-cli/4.3.0.2102/sonar-scanner-cli-4.3.0.2102.jar > sonar-scanner.jar
- "[ -d tests ] || mkdir tests"
- >
java -jar sonar-scanner.jar
-Dsonar.host.url=https://sonarqube.stad.gent
-Dsonar.login=$SONAR_LOGIN
-Dsonar.projectKey=$SONAR_PROJECT_KEY
-Dsonar.projectName="$SONAR_PROJECT_NAME"
-Dsonar.tests=tests
-Dsonar.exclusions=**/tests/**/*
-Dsonar.php.coverage.reportPaths=build/logs/clover.xml
46 changes: 24 additions & 22 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,46 +9,48 @@
"Gent",
"GDPR"
],
"license": "GPL-2.0+",
"homepage": "https://github.com/digipolisgent/drupal_module_dg-cookiebot",
"minimum-stability": "dev",
"prefer-stable": true,
"license": "GPL-2.0+",
"authors": [
{
"name": "Peter Decuyper",
"email": "peter.decuyper@digipolis.gent"
}
],
"support": {
"source": "https://github.com/digipolisgent/drupal_module_dg-cookiebot"
"require": {
"php": "^7.3",
"drupal/cookiebot": "^1.0@alpha",
"drupal/core": "^8.5"
},
"require-dev": {
"digipolisgent/qa-drupal": "~1.3.7",
"sensiolabs/security-checker": "^6.0"
},
"config": {
"sort-packages": true
},
"extra": {
"grumphp": {
"config-default-path": "vendor/digipolisgent/qa-drupal/configs/grumphp-extension.yml"
}
},
"repositories": {
"drupal": {
"type": "composer",
"url": "https://packages.drupal.org/8"
}
},
"require": {
"php": "^7.2",
"drupal/core": "^8.5",
"drupal/cookiebot": "^1.0@alpha"
},
"require-dev": {
"phpunit/phpunit": "^7",
"cweagans/composer-patches": "^1.6",
"squizlabs/php_codesniffer": "^3.5",
"sebastian/phpcpd": "^4.1",
"phpmd/phpmd": "^2.7",
"sensiolabs/security-checker": "^6.0",
"drupal/coder": "^8.3",
"phpro/grumphp": "^0.16.2"
},
"minimum-stability": "dev",
"prefer-stable": true,
"scripts": {
"post-install-cmd": "vendor/bin/grumphp git:init",
"coverage": "vendor/bin/phpunit --configuration=phpunit-coverage.xml",
"grumphp": "vendor/bin/grumphp run --ansi",
"phpcs": "vendor/bin/phpcs",
"phpstan": "vendor/bin/phpstan analyse --level=7 ./src",
"test": "vendor/bin/phpunit",
"post-install-cmd": "vendor/bin/grumphp git:init"
"test": "vendor/bin/phpunit"
},
"support": {
"source": "https://github.com/digipolisgent/drupal_module_dg-cookiebot"
}
}
21 changes: 0 additions & 21 deletions dg_cookiebot.module
Original file line number Diff line number Diff line change
Expand Up @@ -34,24 +34,3 @@ function dg_cookiebot_preprocess_video_embed_iframe(&$variables): void {
$attributes = &$variables['attributes'];
$attributes->setAttribute('data-cookieconsent', 'necessary');
}

/**
* Implements hook_library_info_alter().
*
* Replaces the cookiebot.js file by our own.
*/
function dg_cookiebot_library_info_alter(&$libraries, $extension) {
return;

if ($extension !== 'cookiebot') {
return;
}

if (!isset($libraries['cookiebot']['js']['js/cookiebot.js'])) {
return;
}

$newPath = '/' . drupal_get_path('module', 'dg_cookiebot') . '/js/dg-cookiebot.js';
$libraries['cookiebot']['js'][$newPath] = $libraries['cookiebot']['js']['js/cookiebot.js'];
unset($libraries['cookiebot']['js']['js/cookiebot.js']);
}
30 changes: 0 additions & 30 deletions grumphp.yml.dist

This file was deleted.

20 changes: 0 additions & 20 deletions phpcs-ruleset.xml.dist

This file was deleted.

12 changes: 0 additions & 12 deletions phpcs.xml

This file was deleted.

25 changes: 0 additions & 25 deletions phpmd.xml

This file was deleted.

3 changes: 3 additions & 0 deletions phpstan.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
parameters:
ignoreErrors:
- '#^(?:(?!deprecated).)*$#'
51 changes: 0 additions & 51 deletions phpunit-coverage.xml

This file was deleted.

Loading

0 comments on commit cd96acd

Please sign in to comment.