From e1fe7e83fbe5c0d5bc5765f7bb0a2a70e13bf580 Mon Sep 17 00:00:00 2001 From: jjroelofs <904576+jjroelofs@users.noreply.github.com> Date: Wed, 4 Nov 2026 13:05:53 +0100 Subject: [PATCH 1/5] Pin PHPCompatibility to 10.0.0-alpha2 to fix drupal-lint drupal/coder 9.x requires PHP_CodeSniffer 4, but the latest stable PHPCompatibility (9.3.5) only accepts PHP_CodeSniffer 2 or 3. Composer therefore failed before phpcs ran. PHPCompatibility 10.0.0-alpha2 is the first release that accepts PHP_CodeSniffer 4. --- scripts/prepare-drupal-lint.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/prepare-drupal-lint.sh b/scripts/prepare-drupal-lint.sh index 7f2592a..ead8706 100755 --- a/scripts/prepare-drupal-lint.sh +++ b/scripts/prepare-drupal-lint.sh @@ -18,7 +18,8 @@ echo "TARGET_DRUPAL_CORE_VERSION: $TARGET_DRUPAL_CORE_VERSION" composer config --global allow-plugins.dealerdirect/phpcodesniffer-composer-installer true composer global require drupal/coder --dev -composer global require phpcompatibility/php-compatibility --dev +# 10.x is the first PHPCompatibility release that accepts PHP_CodeSniffer 4 (used by drupal/coder 9) +composer global require phpcompatibility/php-compatibility:10.0.0-alpha2 --dev export PATH="$PATH:$COMPOSER_HOME/vendor/bin" From 51f36c9726fb71717b9c1b91f1a63f9fb2d61fca Mon Sep 17 00:00:00 2001 From: jjroelofs <904576+jjroelofs@users.noreply.github.com> Date: Wed, 4 Nov 2026 13:09:08 +0100 Subject: [PATCH 2/5] Wrap README intro to 80 columns for phpcs The Drupal coding standard flags line 3 of README.md at 83 characters. The warning made phpcs exit non-zero, which stopped the drupal-lint script before the DrupalPractice check ran. --- README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 0945aa9..0f46457 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,7 @@ > **RL Sorting** is a Drupal module by [DXPR](https://dxpr.com) that applies -> Thompson Sampling reinforcement learning to Views sort orders, automatically -> surfacing high-performing content variants without manual A/B test configuration. +> Thompson Sampling reinforcement learning to Views sort orders, +> automatically surfacing high-performing content variants without manual A/B +> test configuration. > > [Getting Started](https://dxpr.com/c/marketing-cms) | > [Pricing](https://dxpr.com/pricing) | From a608d69658a64bf03c0d4797dcff0db43afcd0cb Mon Sep 17 00:00:00 2001 From: jjroelofs <904576+jjroelofs@users.noreply.github.com> Date: Wed, 4 Nov 2026 13:11:19 +0100 Subject: [PATCH 3/5] Drop unused display key in rl_sorting_update loop DrupalPractice reports $display_id as an unused variable at line 76 of rl_sorting.install. The loop only needs the display value by reference. --- rl_sorting.install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rl_sorting.install b/rl_sorting.install index fefa1ab..3144e0c 100644 --- a/rl_sorting.install +++ b/rl_sorting.install @@ -73,7 +73,7 @@ function rl_sorting_install() { continue; } $modified = FALSE; - foreach ($displays as $display_id => &$display) { + foreach ($displays as &$display) { if (!isset($display['display_options']['sorts']['ai_sorting'])) { continue; } From 8660cab911c36188ed08dd0182ce400090b29900 Mon Sep 17 00:00:00 2001 From: jjroelofs <904576+jjroelofs@users.noreply.github.com> Date: Wed, 4 Nov 2026 13:42:38 +0100 Subject: [PATCH 4/5] Set drupal_core_version to literal 11 The value was 11 plus TARGET_DRUPAL_CORE_VERSION (11), giving 1111. --- scripts/prepare-drupal-lint.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/prepare-drupal-lint.sh b/scripts/prepare-drupal-lint.sh index ead8706..941c9f7 100755 --- a/scripts/prepare-drupal-lint.sh +++ b/scripts/prepare-drupal-lint.sh @@ -29,6 +29,6 @@ composer global show -P phpcs -i phpcs --config-set colors 1 -phpcs --config-set drupal_core_version 11$TARGET_DRUPAL_CORE_VERSION +phpcs --config-set drupal_core_version 11 phpcs --config-show \ No newline at end of file From 5c21d225ab9b63c56154c107b58c4721944e3091 Mon Sep 17 00:00:00 2001 From: jjroelofs <904576+jjroelofs@users.noreply.github.com> Date: Wed, 4 Nov 2026 15:23:13 +0100 Subject: [PATCH 5/5] Use the stable lint toolchain and TARGET_DRUPAL_CORE_VERSION Install drupal/coder ^8.3, PHPCompatibility ^9.3 and PHP_CodeSniffer ^3.13 in one composer solve, replacing the 10.0.0-alpha2 pin. Pass TARGET_DRUPAL_CORE_VERSION to drupal_core_version instead of the literal 11. Drop set -e and end the composer installs with || exit 1. --- scripts/prepare-drupal-lint.sh | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/scripts/prepare-drupal-lint.sh b/scripts/prepare-drupal-lint.sh index 941c9f7..654e12a 100755 --- a/scripts/prepare-drupal-lint.sh +++ b/scripts/prepare-drupal-lint.sh @@ -1,5 +1,4 @@ #!/bin/bash -set -e if [ -z "$TARGET_DRUPAL_CORE_VERSION" ]; then # default to target Drupal 11, you can override this by setting the secrets value on your github repo @@ -17,18 +16,17 @@ echo "TARGET_DRUPAL_CORE_VERSION: $TARGET_DRUPAL_CORE_VERSION" # Add this line to avoid the plugin prompt composer config --global allow-plugins.dealerdirect/phpcodesniffer-composer-installer true -composer global require drupal/coder --dev -# 10.x is the first PHPCompatibility release that accepts PHP_CodeSniffer 4 (used by drupal/coder 9) -composer global require phpcompatibility/php-compatibility:10.0.0-alpha2 --dev +# Solve phpcs 3 with coder 8.3 and PHPCompatibility 9 together; coder 9 needs phpcs 4. +composer global require drupal/coder:^8.3 phpcompatibility/php-compatibility:^9.3 squizlabs/php_codesniffer:^3.13 --dev || exit 1 export PATH="$PATH:$COMPOSER_HOME/vendor/bin" -composer global require dealerdirect/phpcodesniffer-composer-installer --dev +composer global require dealerdirect/phpcodesniffer-composer-installer --dev || exit 1 composer global show -P phpcs -i phpcs --config-set colors 1 -phpcs --config-set drupal_core_version 11 +phpcs --config-set drupal_core_version "$TARGET_DRUPAL_CORE_VERSION" phpcs --config-show \ No newline at end of file