Skip to content

Commit 30829a1

Browse files
committed
Update code analysis script to use D10
1 parent 3ee27b2 commit 30829a1

File tree

3 files changed

+18
-17
lines changed

3 files changed

+18
-17
lines changed

.github/workflows/pr.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ jobs:
139139
path: ${{ steps.composer-cache.outputs.dir }}
140140
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
141141
restore-keys: ${{ runner.os }}-composer-
142-
- name: Code analysis
142+
- name: Unit tests
143143
run: |
144144
./scripts/unit-tests
145145

composer.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,13 @@
4646
"sort-packages": true
4747
},
4848
"scripts": {
49+
"code-analysis": [
50+
"@code-analysis/drupal-check"
51+
],
52+
"code-analysis/drupal-check": [
53+
"# @see https://github.com/mglaman/drupal-check/issues/261#issuecomment-1030141772 for details on exclude-dir value",
54+
"drupal-check --deprecations --analysis --exclude-dir='vendor' *.* src"
55+
],
4956
"coding-standards-apply": [
5057
"@coding-standards-apply/phpcs"
5158
],

scripts/code-analysis

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -11,37 +11,31 @@ drupal_composer() {
1111
composer --working-dir="$drupal_dir" --no-interaction "$@"
1212
}
1313

14-
# Create new Drupal 9 project
14+
# Create new Drupal 10 project
1515
if [ ! -f "$drupal_dir/composer.json" ]; then
16-
composer --no-interaction create-project drupal/recommended-project:^9 "$drupal_dir"
16+
composer --no-interaction create-project drupal/recommended-project:^10 "$drupal_dir"
1717
fi
1818
# Copy our code into the modules folder
19-
20-
# Clean up
21-
rm -fr "${drupal_dir:?}/$module_path"
22-
19+
mkdir -p "$drupal_dir/$module_path"
2320
# https://stackoverflow.com/a/15373763
24-
# rsync --archive --compress . --filter=':- .gitignore' --exclude "$drupal_dir" --exclude .git "$drupal_dir/$module_path"
25-
26-
# The rsync command in not available in itkdev/php8.1-fpm
27-
28-
git config --global --add safe.directory /app
29-
# Copy module files into module path
30-
for f in $(git ls-files); do
31-
mkdir -p "$drupal_dir/$module_path/$(dirname "$f")"
32-
cp "$f" "$drupal_dir/$module_path/$f"
33-
done
21+
rsync --archive --compress . --filter=':- .gitignore' --exclude "$drupal_dir" --exclude .git "$drupal_dir/$module_path"
3422

3523
drupal_composer config minimum-stability dev
3624

3725
# Allow ALL plugins
3826
# https://getcomposer.org/doc/06-config.md#allow-plugins
3927
drupal_composer config --no-plugins allow-plugins true
4028

29+
# Making Drupal 10 compatible
30+
drupal_composer require psr/http-message:^1.0
31+
drupal_composer require mglaman/composer-drupal-lenient
32+
drupal_composer config --merge --json extra.drupal-lenient.allowed-list '["drupal/coc_forms_auto_export", "drupal/webform_node_element"]'
33+
4134
drupal_composer require wikimedia/composer-merge-plugin
4235
drupal_composer config extra.merge-plugin.include "$module_path/composer.json"
4336
# https://www.drupal.org/project/drupal/issues/3220043#comment-14845434
4437
drupal_composer require --dev symfony/phpunit-bridge
4538

39+
4640
# Run PHPStan
4741
(cd "$drupal_dir/$module_path" && ../../../../vendor/bin/phpstan)

0 commit comments

Comments
 (0)