/docker-phpcs-drupal

Docker image of phpcs for Drupal

Primary LanguageDockerfileGNU General Public License v2.0GPL-2.0

Docker image of PHP_CodeSniffer (PHPCS) for Drupal

The Docker image includes:

Example usage on Gitlab CI pipeline

phpcs:
  stage: code-quality
  only:
    - merge_requests
  allow_failure: true
  image:
    name: "quintux/phpcs-drupal"
    entrypoint: [""]
  before_script:
    - git fetch
    - php --version
    - composer global update --with-dependencies drupal/coder
  script:
    - echo -n "" > /output/filelist.txt
    # Only check changed files in merge requests
    - git diff --name-only origin/$CI_MERGE_REQUEST_TARGET_BRANCH_NAME | while read F; do test -f "$F" && echo "$F" >> /output/filelist.txt ; done
    - phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml --basepath=. --file-list=/output/filelist.txt --report=full --report-\\Micheh\\PhpCodeSniffer\\Report\\Gitlab=.ci/phpcs-quality-report.json
  artifacts:
    paths:
      - ".ci/phpcs-quality-report.json"
    expire_in: 14 days
    when: always
    reports:
      codequality: .ci/phpcs-quality-report.json