-
jurgenhaas authored
#19 Rename ahoy test stylelintprepare into preparecorefordev
jurgenhaas authored#19 Rename ahoy test stylelintprepare into preparecorefordev
ahoy.test.yml 6.10 KiB
ahoyapi: v2
commands:
phpcpd:
cmd: ahoy d4d exec vendor/bin/phpcpd "$@"
usage: PHP Copy and Paste Detector
phpcs:
cmd: |
ahoy d4d exec mkdir -p /tmp/logs
ahoy d4d exec vendor/bin/phpcs --report-full=/tmp/logs/codesniffer_results.txt --report-checkstyle=/tmp/logs/checkstyle.xml --report-diff=/tmp/logs/codesniffer_fixes.patch --standard=Drupal --file-list=/var/www/html/tests/phpcs.files --extensions=php,module,inc,install,test,profile,theme,info,txt,md --ignore=node_modules,*.min.css,*.min.js,$(paste -s -d, .phpcsignore 2>/dev/null) "$@"
ahoy d4d exec cat /tmp/logs/codesniffer_results.txt
usage: PHP coding standards
phpcsmodule:
cmd: |
module=$1
shift
ahoy d4d exec mkdir -p /tmp/logs
ahoy d4d exec vendor/bin/phpcs --report-full=/tmp/logs/codesniffer_results.txt --report-checkstyle=/tmp/logs/checkstyle.xml --report-diff=/tmp/logs/codesniffer_fixes.patch --standard=Drupal --extensions=php,module,inc,install,test,profile,theme,info,txt,md --ignore=node_modules,*.min.css,*.min.js,$(paste -s -d, .phpcsignore 2>/dev/null) web/modules/contrib/$module "$@"
ahoy d4d exec cat /tmp/logs/codesniffer_results.txt
usage: PHP coding standards
phpcs-fix:
cmd: ahoy d4d exec patch -p0 -ui /tmp/logs/codesniffer_fixes.patch
usage: Apply fixes from previous PHP coding standards run
phploc:
cmd: ahoy d4d exec vendor/bin/phploc "$@"
usage: PHP LOC analysis
phpmd:
cmd: ahoy d4d exec vendor/bin/phpmd "$@"
usage: PHP Mess Detector
phpunit:
cmd: ahoy d4d exec vendor/bin/phpunit --configuration /var/www/html/tests/phpunit.xml.dist "$@"
usage: PHP unit tests
phpunitgroup:
cmd: |
group=$1
shift
ahoy d4d exec vendor/bin/phpunit --configuration /var/www/html/tests/phpunit.xml.dist --group="$group" $@
usage: PHP unit tests by group
phpunitmodule:
cmd: |
module=$1
shift
mkdir -p tests/junit
ahoy d4d exec vendor/bin/phpunit --log-junit tests/junit/${module}.xml --configuration /var/www/html/tests/phpunit.xml.dist web/modules/contrib/$module $@
usage: PHP unit tests by module
phpunit:list:suites:
cmd: ahoy d4d exec vendor/bin/phpunit --configuration /var/www/html/tests/phpunit.xml.dist --list-suites "$@"
usage: List available test suites of PHP unit tests
phpunit:list:groups:
cmd: ahoy d4d exec vendor/bin/phpunit --configuration /var/www/html/tests/phpunit.xml.dist --list-groups "$@"
usage: List available test groups of PHP unit tests
phpstan:
cmd: |
module=$1
shift
config=/var/www/html/vendor/lakedrops/drupal-development-environment/defaults/phpstan.neon
if [[ -f /var/www/html/$module/phpstan.neon ]]; then config=/var/www/html/$module/phpstan.neon; fi
ahoy d4d exec vendor/bin/phpstan analyze --configuration=$config $module $@
usage: PHPStan tests
phpstanmodule:
cmd: |
module=$1
shift
config=/var/www/html/vendor/lakedrops/drupal-development-environment/defaults/phpstan.neon
if [[ -f web/modules/contrib/$module/phpstan.neon ]]; then config=/var/www/html/web/modules/contrib/$module/phpstan.neon; fi
ahoy d4d exec vendor/bin/phpstan analyze --configuration=$config web/modules/contrib/$module $@
usage: PHPStan tests by module
phplintmodule:
cmd: |
module=$1
shift
ahoy d4d exec vendor/bin/parallel-lint web/modules/contrib/$module $@
usage: PHP lint tests by module
phpmetricsmodule:
cmd: |
module=$1
shift
mkdir -p tests/metrics/$module
JUNIT=
if [[ -f tests/junit/${module}.xml ]]; then JUNIT=--junit=tests/junit/${module}.xml; fi
ahoy d4d exec vendor/bin/phpmetrics --report-html=tests/metrics/$module $JUNIT web/modules/contrib/$module $@
usage: PHP Metrics by module
preparecorefordev:
cmd: |
/usr/local/bin/node_cmd yarn --cwd web/core add stylelint-junit-formatter $@
usage: Prepare environment for other tests like style linter and cspell
stylelintmodule:
cmd: |
module=$1
shift
/usr/local/bin/node_cmd yarn --silent --cwd web/core stylelint --formatter verbose --config ./.stylelintrc.json "../modules/contrib/${module}/**/*.css" --color $@
usage: Stylelint tests by module
eslintmodule:
cmd: |
module=$1
shift
cd web/modules/contrib/$module
test -e .prettierrc.json || ln -s /drupal/web/core/.prettierrc.json .
test -e .prettierignore || echo '*.yml' > .prettierignore
/drupal/web/core/node_modules/.bin/eslint --no-error-on-unmatched-pattern --ignore-pattern="*.es6.js" --resolve-plugins-relative-to=/drupal/web/core --ext=.js,.yml . $@
usage: Eslint tests by module
outdated:
cmd: |
echo "Testing for outdated patch versions ..."
composer outdated --patch-only --strict --no-interaction
echo "Testing for outdated minor versions ..."
composer outdated --minor-only --strict --no-interaction
usage: Verifies that a dependencies are using the latest minor and patch versions
cspellmodule:
cmd: |
export CI_PROJECT_NAME=$1
shift
while read assign; do
export "$assign";
done < <(sed -nr '/variables:/,$ s/ ([A-Z_]+): (.*)/\1=\2/ p' /drupal/web/modules/contrib/$CI_PROJECT_NAME/.gitlab-ci.yml)
export _WEB_ROOT=/drupal/web
export _CURL_TEMPLATES_REPO=project/gitlab_templates
export _CURL_TEMPLATES_REF=default-ref
cd /drupal/web/modules/contrib/$CI_PROJECT_NAME
curl -sOL https://git.drupalcode.org/$_CURL_TEMPLATES_REPO/-/raw/$_CURL_TEMPLATES_REF/scripts/prepare-cspell.php
if [ ! -f .cspell.json ]; then
curl -sOL https://git.drupalcode.org/$_CURL_TEMPLATES_REPO/-/raw/$_CURL_TEMPLATES_REF/assets/.cspell.json
fi
php prepare-cspell.php
rm prepare-cspell.php
touch .cspell-project-words.txt
/drupal/web/core/node_modules/.bin/cspell -c .cspell.json --show-suggestions --show-context --no-progress $_CSPELL_EXTRA ** || EXIT_CODE=$?
if [ "$EXIT_CODE" != "" ]; then
/drupal/web/core/node_modules/.bin/cspell -c .cspell.json --words-only --unique --no-progress $_CSPELL_EXTRA ** | sort -f
fi
rm .cspell.json