summaryrefslogtreecommitdiffstats
path: root/tools/install-phpcs.sh
blob: 63ae7b21243cca18bda83b8bd113462488b12179 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/bin/sh
#
# Fetch PHP_CodeSniffer and the WordPress standard into .phpcs/.
#
# Not a dependency of the plugin: nothing here ships, and a bare checkout lints
# with `php -l` alone. Run this once to get the full WordPress review that
# `make lint` will then include.

set -eu

root=$(cd "$(dirname "$0")/.." && pwd)
target="$root/.phpcs"

mkdir -p "$target"

docker run --rm -v "$target":/app -w /app composer:2 sh -c '
	composer config --no-plugins allow-plugins.dealerdirect/phpcodesniffer-composer-installer true &&
	composer require --dev --no-interaction --quiet \
		squizlabs/php_codesniffer \
		wp-coding-standards/wpcs \
		dealerdirect/phpcodesniffer-composer-installer
'

printf 'phpcs installed in .phpcs/ — `make lint` will use it\n'