forked from OS2Forms/os2forms
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcode-analysis
More file actions
executable file
·52 lines (40 loc) · 1.75 KB
/
code-analysis
File metadata and controls
executable file
·52 lines (40 loc) · 1.75 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/usr/bin/env bash
script_dir=$(pwd)
module_name=$(basename "$script_dir")
drupal_dir=vendor/drupal-module-code-analysis
# Relative to $drupal_dir
module_path=web/modules/contrib/$module_name
cd "$script_dir" || exit
drupal_composer() {
composer --working-dir="$drupal_dir" --no-interaction "$@"
}
# Create new Drupal 10 project
if [ ! -f "$drupal_dir/composer.json" ]; then
composer --no-interaction create-project drupal/recommended-project:^10 "$drupal_dir"
fi
# Copy our code into the modules folder
# Clean up
rm -fr "${drupal_dir:?}/$module_path"
# https://stackoverflow.com/a/15373763
# rsync --archive --compress . --filter=':- .gitignore' --exclude "$drupal_dir" --exclude .git "$drupal_dir/$module_path"
# The rsync command in not available in itkdev/php8.1-fpm
git config --global --add safe.directory /app
# Copy module files into module path
for f in $(git ls-files); do
mkdir -p "$drupal_dir/$module_path/$(dirname "$f")"
cp "$f" "$drupal_dir/$module_path/$f"
done
drupal_composer config minimum-stability dev
# Allow ALL plugins
# https://getcomposer.org/doc/06-config.md#allow-plugins
drupal_composer config --no-plugins allow-plugins true
# Making Drupal 10 compatible
drupal_composer require psr/http-message:^1.0
drupal_composer require mglaman/composer-drupal-lenient:^1.0
drupal_composer config --merge --json extra.drupal-lenient.allowed-list '["drupal/coc_forms_auto_export", "drupal/webform_node_element"]'
drupal_composer require wikimedia/composer-merge-plugin
drupal_composer config extra.merge-plugin.include "$module_path/composer.json"
# https://www.drupal.org/project/drupal/issues/3220043#comment-14845434
drupal_composer require --dev symfony/phpunit-bridge
# Run PHPStan
(cd "$drupal_dir/$module_path" && ../../../../vendor/bin/phpstan)