district09/php_package_qa-drupal

View on GitHub
configs/grumphp-site.yml

Summary

Maintainability
Test Coverage
grumphp:
  process_timeout: 3600
  hide_circumvention_tip: true
  ascii:
    failed: ~
    succeeded: ~
  fixer:
    enabled: true
    fix_by_default: true
  environment:
    paths:
      - .env
      - .env.local
  testsuites:
    git_commit_msg:
      tasks:
        - git_commit_message
    git_pre_commit:
      tasks:
        - composer
        - git_blacklist
        - git_branch_name
        - phpcpd
        - phpcs
        - phpmd
        - phpstan
        - securitychecker_enlightn
        - twigcs
        - yamllint
    tests:
      tasks:
        - behat
        - phpunit
  tasks:
    behat:
      config: behat.qa-drupal.yml
    composer:
      no_check_publish: true
    composer_normalize: ~
    git_blacklist:
      keywords:
        - " die\\("
        - " exit;"
        - " exit\\("
        - "\\$_[A-Z_]+\\["
      regexp_type: E
      whitelist_patterns:
        - "#^web/(modules|themes|profiles)/custom/#"
      triggered_by:
        - inc
        - install
        - module
        - php
        - profile
        - theme
    git_branch_name:
      whitelist:
        - "#^main|^master|^develop|^\\d+(\\.\\d+)?\\.x|^(release|hotfix)/\\d+\\.\\d+\\.\\d+|^feature/([A-Z][A-Z\\d]+-\\d+|[a-z][a-z\\d]*(-[a-z\\d]+)*)$#"
    git_commit_message:
      matchers:
        - "/^([A-Z][A-Z\\d]+-\\d+(, [A-Z][A-Z\\d]+-\\d+)*: )?(Add|Change|Fix|Update|Remove|Refactor|Merge|RELEASE) /"
      case_insensitive: false
    phpcpd:
      directory:
        - web
      exclude:
        - web/config
        - web/core
        - web/libraries
        - web/*/contrib
        - web/modules/custom/*/tests
        - web/sites
        - web/themes/custom/*/source
        - "*.api.php"
        - "*Test.php"
        - "*TestBase.php"
        - "*TestCase.php"
        - "*.install"
      min_lines: 10
      triggered_by:
        - inc
        - module
        - php
        - profile
        - theme
    phpcs:
      standard:
        - phpcs.qa-drupal.xml
      report_width: 120
      whitelist_patterns:
        - "#^web/(modules|themes|profiles)/custom/#"
      ignore_patterns:
        - build/
        - node_modules/
        - sassdocs/
      triggered_by:
        - css
        - inc
        - install
        - js
        - module
        - php
        - profile
        - theme
        - twig
        - yml
    phpmd:
      ruleset:
        - phpmd.qa-drupal.xml
      whitelist_patterns:
        - "#^web/(modules|themes|profiles)/custom/#"
      exclude:
        - "*.api.php"
        - "*Test.php"
        - "*TestBase.php"
        - "*TestCase.php"
      triggered_by:
        - inc
        - install
        - module
        - php
        - profile
        - theme
    phpstan:
      configuration: phpstan.qa-drupal.neon
      force_patterns:
        - "#^web/(modules|themes|profiles)/custom/((?:(?!tests)[^/])+/)+[^/]+\\.(inc|install|module|php|profile|theme)$#"
      ignore_patterns:
        - "#.*#"
      triggered_by:
        - inc
        - install
        - module
        - php
        - profile
        - theme
    phpunit:
      config_file: phpunit.qa-drupal.xml
    securitychecker_enlightn:
      lockfile: ./composer.lock
      run_always: false
    twigcs:
      path: './web'
      severity: 'warning'
      ruleset: 'Digipolisgent\QA\Drupal\Twigcs\Ruleset\Twig'
      triggered_by:
        - twig
      exclude:
        - config
        - core
        - libraries
        - modules/contrib
        - profiles/contrib
        - themes/contrib
        - sites
        - vendor
    yamllint:
      whitelist_patterns:
        - "#^(\\.[^/]+/)?[^/]+\\.yml$#"
        - "#^config/#"
        - "#^web/(modules|themes|profiles)/custom/#"
      ignore_patterns:
        - node_modules/

services:
  listener.qa_drupal.console:
    class: Digipolisgent\QA\Drupal\GrumPHP\EventListener\ConsoleEventListener
    tags:
      - { name: grumphp.event_listener, event: console.terminate, method: onTerminate }
      - { name: grumphp.event_listener, event: console.exception, method: onException }
  listener.qa_drupal.task:
    class: Digipolisgent\QA\Drupal\GrumPHP\EventListener\TaskEventListener
    tags:
      - { name: grumphp.event_listener, event: grumphp.task.run, method: onRun, priority: 100 }