From d5d0e6d1bb46f8904690ba1b4c4e0af51fd415fc Mon Sep 17 00:00:00 2001 From: Suchi Garg Date: Mon, 1 Apr 2019 15:18:15 +1100 Subject: [PATCH] [GOVCMSD8-282] Exclude node_modules from "ahoy lint" --- .docker/Dockerfile.test | 5 ++ .docker/scripts/lint-theme | 14 +++++ tests/phpcs.xml | 104 +++++++++++++++++++++++++++++++++++++ 3 files changed, 123 insertions(+) create mode 100644 .docker/scripts/lint-theme create mode 100755 tests/phpcs.xml diff --git a/.docker/Dockerfile.test b/.docker/Dockerfile.test index 39a4dcd..a35ec31 100644 --- a/.docker/Dockerfile.test +++ b/.docker/Dockerfile.test @@ -2,6 +2,11 @@ FROM govcms8lagoon/test COPY themes/ /app/web/themes/custom +COPY tests /app/tests + +COPY .docker/scripts/lint-theme /usr/bin/ +RUN chmod +x /usr/bin/lint-theme + RUN rm -Rf /app/tests/behat/features/* COPY tests/behat/features/ /app/tests/behat/features diff --git a/.docker/scripts/lint-theme b/.docker/scripts/lint-theme new file mode 100644 index 0000000..a45527f --- /dev/null +++ b/.docker/scripts/lint-theme @@ -0,0 +1,14 @@ +#!/usr/bin/env bash +# Code linting for SaaS project. + +APP_DIR=${APP_DIR:-/app} +PROFILE_DIR=${PROFILE_DIR:-${APP_DIR}/web} + +# Lint code. +${APP_DIR}/tests/vendor/bin/parallel-lint --exclude /app/tests/vendor --exclude ${PROFILE_DIR}/themes/custom/*/node_modules -e php,inc,module,theme,install,profile,test ${PROFILE_DIR}/themes/custom + +# Check code standards. +${APP_DIR}/tests/vendor/bin/phpcs --standard=${APP_DIR}/tests/phpcs.xml ${PROFILE_DIR}/themes/custom + +# Check code mess. +${APP_DIR}/tests/vendor/bin/phpmd ${PROFILE_DIR}/themes/custom text codesize,unusedcode,cleancode diff --git a/tests/phpcs.xml b/tests/phpcs.xml new file mode 100755 index 0000000..ae4b178 --- /dev/null +++ b/tests/phpcs.xml @@ -0,0 +1,104 @@ + + + PHPCS Standard for a GoVCMS8 website, based on Drupal standards. + + + + + + + + + tests + web/themes/custom + web/sites/default/settings.php + + + web/profiles/custom*\.info\.yml + + + *\.min\.js + *\.css + + + *library*\.js + *libraries*\.js + + + web/themes/custom/*/node_modules/* + + + *\.bean\.* + *\.context\.* + *\.current_search\.* + *\.custom_formatters\.* + *\.ds\.* + *\.facetapi_defaults\.* + *\.feeds_*\.* + *\.features\.* + *\.field_group\.* + *\.file_default_displays\.* + *\.file_type\.* + *\.heartbeat\.* + *\.layouts\.* + *\.linkit_profiles\.* + *\.pages_default\.* + *\.panels_default\.* + *\.rules_defaults\.* + *\.strongarm\.* + *\.views_default\.* + *\.quicktabs\.* + + + + warning + + + + + settings\.php + + + + + settings\.php + + + settings\.php + + + settings\.php + + + settings\.php + + + + + *\.install + + + *\.install + + + + + custom/*.info + + + + + tests/behat/bootstrap/*\.php + tests/unit/*.Test\.php + tests/unit/*.TestCase\.php + + + tests/unit/*.Test\.php + tests/unit/*.TestCase\.php + + + + * + +