Loading composer.json +8 −0 Original line number Diff line number Diff line Loading @@ -24,5 +24,13 @@ "platform": { "php": "7.4.0" } }, "scripts": { "phpcbf": "scripts/phpcbf.sh", "phpcs": "scripts/phpcs.sh" }, "scripts-descriptions": { "phpcbf": "Automatically fixes standards violations where possible.", "phpcs": "Checks code for standards compliance." } } scripts/phpcbf.sh 0 → 100755 +39 −0 Original line number Diff line number Diff line #!/usr/bin/env bash # NAME # phpcbf.sh - Automatically fixe standards violations where possible. # # SYNOPSIS # bash phpcbf.sh # # DESCRIPTION # Fix code compliance with Drupal core coding standards using PHP Code # Beautifier and Fixer (PHPCBF). # # It is assumed that this module is inside a Drupal core installation, in # modules or modules/contrib. See setup_local_dev.sh. cd "$(dirname "$0")" || exit 0; ## Find PHPCBF in Drupal core. Check up to three directories up. DIR=$(pwd) for i in {0..3}; do DIR=$(dirname "$DIR") PHPCBF_BIN="$DIR/vendor/bin/phpcbf" PHPCS_CONFIG="$DIR/core/phpcs.xml.dist" if test -f "$PHPCBF_BIN"; then break fi done # Exit if PHPCBF can't be found. if test ! -f "$PHPCBF_BIN"; then echo "Could not find PHPCBF. Are you inside a Drupal site's 'modules' directory?" exit 1 fi # Run PHPCBF on the module directory. php "$PHPCBF_BIN" \ --colors \ --standard="$PHPCS_CONFIG" \ "$(cd .. && pwd)" scripts/phpcs.sh 0 → 100755 +39 −0 Original line number Diff line number Diff line #!/usr/bin/env bash # NAME # phpcs.sh - Check code for standards compliance. # # SYNOPSIS # bash phpcs.sh # # DESCRIPTION # Check for compliance with Drupal core coding standards using # PHP_CodeSniffer (PHPCS). # # It is assumed that this module is inside a Drupal core installation, in # modules or modules/contrib. See setup_local_dev.sh. cd "$(dirname "$0")" || exit 0; ## Find PHPCS in Drupal core. Check up to three directories up. DIR=$(pwd) for i in {0..3}; do DIR=$(dirname "$DIR") PHPCS_BIN="$DIR/vendor/bin/phpcs" PHPCS_CONFIG="$DIR/core/phpcs.xml.dist" if test -f "$PHPCS_BIN"; then break fi done # Exit if PHPCS can't be found. if test ! -f "$PHPCS_BIN"; then echo "Could not find PHPCS. Are you inside a Drupal site's 'modules' directory?" exit 1 fi # Run PHPCS on the module directory. php "$PHPCS_BIN" \ --colors \ --standard="$PHPCS_CONFIG" \ "$(cd .. && pwd)" Loading
composer.json +8 −0 Original line number Diff line number Diff line Loading @@ -24,5 +24,13 @@ "platform": { "php": "7.4.0" } }, "scripts": { "phpcbf": "scripts/phpcbf.sh", "phpcs": "scripts/phpcs.sh" }, "scripts-descriptions": { "phpcbf": "Automatically fixes standards violations where possible.", "phpcs": "Checks code for standards compliance." } }
scripts/phpcbf.sh 0 → 100755 +39 −0 Original line number Diff line number Diff line #!/usr/bin/env bash # NAME # phpcbf.sh - Automatically fixe standards violations where possible. # # SYNOPSIS # bash phpcbf.sh # # DESCRIPTION # Fix code compliance with Drupal core coding standards using PHP Code # Beautifier and Fixer (PHPCBF). # # It is assumed that this module is inside a Drupal core installation, in # modules or modules/contrib. See setup_local_dev.sh. cd "$(dirname "$0")" || exit 0; ## Find PHPCBF in Drupal core. Check up to three directories up. DIR=$(pwd) for i in {0..3}; do DIR=$(dirname "$DIR") PHPCBF_BIN="$DIR/vendor/bin/phpcbf" PHPCS_CONFIG="$DIR/core/phpcs.xml.dist" if test -f "$PHPCBF_BIN"; then break fi done # Exit if PHPCBF can't be found. if test ! -f "$PHPCBF_BIN"; then echo "Could not find PHPCBF. Are you inside a Drupal site's 'modules' directory?" exit 1 fi # Run PHPCBF on the module directory. php "$PHPCBF_BIN" \ --colors \ --standard="$PHPCS_CONFIG" \ "$(cd .. && pwd)"
scripts/phpcs.sh 0 → 100755 +39 −0 Original line number Diff line number Diff line #!/usr/bin/env bash # NAME # phpcs.sh - Check code for standards compliance. # # SYNOPSIS # bash phpcs.sh # # DESCRIPTION # Check for compliance with Drupal core coding standards using # PHP_CodeSniffer (PHPCS). # # It is assumed that this module is inside a Drupal core installation, in # modules or modules/contrib. See setup_local_dev.sh. cd "$(dirname "$0")" || exit 0; ## Find PHPCS in Drupal core. Check up to three directories up. DIR=$(pwd) for i in {0..3}; do DIR=$(dirname "$DIR") PHPCS_BIN="$DIR/vendor/bin/phpcs" PHPCS_CONFIG="$DIR/core/phpcs.xml.dist" if test -f "$PHPCS_BIN"; then break fi done # Exit if PHPCS can't be found. if test ! -f "$PHPCS_BIN"; then echo "Could not find PHPCS. Are you inside a Drupal site's 'modules' directory?" exit 1 fi # Run PHPCS on the module directory. php "$PHPCS_BIN" \ --colors \ --standard="$PHPCS_CONFIG" \ "$(cd .. && pwd)"