From 7abb1db30b049bc0b4fbb75fc9e3de24bb1897b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Filip=20=C5=A0?= Date: Sun, 26 Jul 2020 21:30:45 +0200 Subject: [PATCH] Support for PHPCS and Psalm config files --- TEMPLATES/phpcs.xml | 6 ++++++ TEMPLATES/psalm.xml | 4 ++++ lib/linter.sh | 10 ++++++++-- 3 files changed, 18 insertions(+), 2 deletions(-) create mode 100755 TEMPLATES/phpcs.xml create mode 100755 TEMPLATES/psalm.xml diff --git a/TEMPLATES/phpcs.xml b/TEMPLATES/phpcs.xml new file mode 100755 index 00000000..db39fed5 --- /dev/null +++ b/TEMPLATES/phpcs.xml @@ -0,0 +1,6 @@ + + + + The default coding standard for usage with GitHub Super-Linter. It just includes PSR12. + + diff --git a/TEMPLATES/psalm.xml b/TEMPLATES/psalm.xml new file mode 100755 index 00000000..0eb2e126 --- /dev/null +++ b/TEMPLATES/psalm.xml @@ -0,0 +1,4 @@ + + + + diff --git a/lib/linter.sh b/lib/linter.sh index 17aa4e98..c5a829fa 100755 --- a/lib/linter.sh +++ b/lib/linter.sh @@ -68,6 +68,12 @@ MARKDOWN_LINTER_RULES="${DEFAULT_RULES_LOCATION}/${MARKDOWN_FILE_NAME}" # OpenAPI Vars OPENAPI_FILE_NAME='.openapirc.yml' # Name of the file OPENAPI_LINTER_RULES="${DEFAULT_RULES_LOCATION}/${OPENAPI_FILE_NAME}" # Path to the OpenAPI lint rules +# PHPCS Vars +PHP_PHPCS_FILE_NAME='phpcs.xml' # Name of the file +PHP_PHPCS_LINTER_RULES="${DEFAULT_RULES_LOCATION}/${PHP_PHPCS_FILE_NAME}" # Path to the PHP CodeSniffer lint rules +# Psalm Vars +PHP_PSALM_FILE_NAME='psalm.xml' # Name of the file +PHP_PSALM_LINTER_RULES="${DEFAULT_RULES_LOCATION}/${PHP_PSALM_FILE_NAME}" # Path to the Psalm lint rules # Powershell Vars POWERSHELL_FILE_NAME='.powershell-psscriptanalyzer.psd1' # Name of the file POWERSHELL_LINTER_RULES="${DEFAULT_RULES_LOCATION}/${POWERSHELL_FILE_NAME}" # Path to the Powershell lint rules @@ -1474,7 +1480,7 @@ if [ "${VALIDATE_PHP_PHPCS}" == "true" ]; then # Lint the PHP files using PHP CodeSniffer # ############################################ # LintCodebase "FILE_TYPE" "LINTER_NAME" "LINTER_CMD" "FILE_TYPES_REGEX" "FILE_ARRAY" - LintCodebase "PHP_PHPCS" "phpcs" "phpcs" ".*\.\(php\)\$" "${FILE_ARRAY_PHP_PHPCS[@]}" + LintCodebase "PHP_PHPCS" "phpcs" "phpcs --standard=${PHP_PHPCS_LINTER_RULES}" ".*\.\(php\)\$" "${FILE_ARRAY_PHP_PHPCS[@]}" fi if [ "${VALIDATE_PHP_PSALM}" == "true" ]; then @@ -1482,7 +1488,7 @@ if [ "${VALIDATE_PHP_PSALM}" == "true" ]; then # Lint the PHP files using Psalm # ################################## # LintCodebase "FILE_TYPE" "LINTER_NAME" "LINTER_CMD" "FILE_TYPES_REGEX" "FILE_ARRAY" - LintCodebase "PHP_PSALM" "psalm" "psalm" ".*\.\(php\)\$" "${FILE_ARRAY_PHP_PSALM[@]}" + LintCodebase "PHP_PSALM" "psalm" "psalm --config=${PHP_PSALM_LINTER_RULES}" ".*\.\(php\)\$" "${FILE_ARRAY_PHP_PSALM[@]}" fi ######################