Skip to content
Snippets Groups Projects
Select Git revision
  • ca2415a05a1918fb177b5dc0c4ee5c1d1555d971
  • master default protected
  • feat/npm-publish
  • feat/demo-deploy
  • change-demo-deploy
  • remove-smoke
  • feat/acceptance-tests
  • feature/deploy-composer.json
  • feature/mysql-bin-logs
  • skip-codecept-for-libs
  • include-composer-json
  • exclude-wp-assets
  • update_codecept_image
  • fix/silenced-copy
  • remove-free-translations
  • codeception-with-optional-step
  • improve-parallelization
  • linter-exit
  • change-images
  • fix/linter
  • globally-raise-mem-limit
  • no-symlink2
22 results

static-analysis.yml

Blame
  • static-analysis.yml 1.70 KiB
    .static-analysis:
      image: gitlab.wpdesk.dev:5050/wpdesk/docker-tests/php-box:8.4.1
      needs:
        - prepare prefixed vendor
      stage: tests
    
    phpstan:
      extends: .static-analysis
      script:
        - |
          if [ -f "vendor/bin/phpstan" ]; then
            vendor/bin/phpstan analyse --error-format=gitlab --memory-limit=2G > phpstan-codequality.json || true
            vendor/bin/phpstan analyse --error-format=junit --memory-limit=2G > phpstan-junit.xml
          elif [ -f "vendor/wpdesk/wp-wpdesk-composer/director/vendor/bin/phpstan" ]; then
            # PHPStan installed by director
            vendor/wpdesk/wp-wpdesk-composer/director/vendor/bin/phpstan analyse --error-format=gitlab --memory-limit=2G > phpstan-codequality.json || true
            vendor/wpdesk/wp-wpdesk-composer/director/vendor/bin/phpstan analyse --error-format=junit --memory-limit=2G > phpstan-junit.xml
          else
            echo "PHPStan not found! Install it with 'composer require --dev wpdesk/phpstan-rules'."
            exit 125
          fi
      artifacts:
        paths:
          - phpstan-codequality.json
          - phpstan-junit.json
        expire_in: 1 week
        reports:
          codequality: phpstan-codequality.json
          junit: phpstan-junit.xml
      rules:
        - !reference [.skip-mr, rules]
        - if: $CI_PROJECT_NAMESPACE =~ /predators/
          allow_failure: true
        - exists:
          - phpstan.neon.dist
    
    phpcs:
      extends: .static-analysis
      script:
        - vendor/bin/phpcs --warning-severity=0 --report-junit=phpcs-junit.xml --report-full
      rules:
        - !reference [.skip-mr, rules]
        - if: $CI_PROJECT_NAMESPACE =~ /predators/
          allow_failure: true
        - exists:
          - phpcs.xml.dist
      artifacts:
        paths:
          - phpcs-junit.xml
        expire_in: 1 week
        reports:
          junit: phpcs-junit.xml