
.defaults: &defaults
  tags: [ docker ]
  image: isdevtools.irstea.fr/poleis/php-analysis:7.1

phploc:
  <<: *defaults
  script: phploc src

lint:
  <<: *defaults
  script:
    - parallel-lint -j $(nproc) src
    - twig-lint lint src
    - yaml-lint src

php-cs-fixer:
  <<: *defaults
  script: php-cs-fixer fix --dry-run --verbose

phpcpd:
  <<: *defaults
  script: phpcpd --fuzzy src

.with-vendors: &with-vendors
  <<: *defaults
  before_script:
    - composer install --prefer-dist --no-progress --no-suggest
  cache:
    key: "$CI_COMMIT_REF_NAME"
    paths:
      - /composer/cache

composer-require-checker:
  <<: *with-vendors
  script: composer-require-checker

phpmd:
  <<: *with-vendors
  script: phpmd src text ./phpmd-ruleset.xml --suffixes=php
