diff --git a/README.md b/README.md index f879030..642a059 100644 --- a/README.md +++ b/README.md @@ -144,6 +144,12 @@ The template points PHP tooling at `.ddev/drupal-code-quality/tooling/bin` and J by `.cspell.json` `ignorePaths`. Narrow the scan by passing explicit paths. - `.cspell-project-words.txt` is created by the installer (empty) and updated by `ddev cspell-suggest` when you accept suggested words. +- PHPCS / PHPCBF default scope: + - When a project `.phpcs.xml` is installed by the add-on, `ddev phpcs` and + `ddev phpcbf` with no path default to scanning the configured docroot. + - The generated ruleset excludes `__DOCROOT__/core/**`, `**/contrib/**`, + `**/node_modules/**`, and `__DOCROOT__/sites/*/files/**`. + - You can still pass explicit paths to narrow runs. - PHPStan baseline: - Generate a baseline with `ddev phpstan --generate-baseline`. - This writes `phpstan-baseline.neon` at the project root; the wrapper will diff --git a/drupal-code-quality/config-amendments/.phpcs.dcq.xml b/drupal-code-quality/config-amendments/.phpcs.dcq.xml index da933ce..6338f45 100644 --- a/drupal-code-quality/config-amendments/.phpcs.dcq.xml +++ b/drupal-code-quality/config-amendments/.phpcs.dcq.xml @@ -4,5 +4,10 @@ + + __DOCROOT__ + + __DOCROOT__/core/** + **/contrib/** **/node_modules/** __DOCROOT__/sites/*/files/** diff --git a/tests/test.bats b/tests/test.bats index 052b9e9..3ede975 100644 --- a/tests/test.bats +++ b/tests/test.bats @@ -934,8 +934,16 @@ PY assert_success run grep -n "web/core" ".cspell.json" assert_failure + run grep -n '' ".phpcs.xml" + assert_success + run grep -n "docroot" ".phpcs.xml" + assert_success + run grep -n "docroot/core/\\*\\*" ".phpcs.xml" + assert_success run grep -n "docroot/sites" ".phpcs.xml" assert_success + run grep -n "__DOCROOT__" ".phpcs.xml" + assert_failure # Verify PHPStan config uses custom docroot run grep -q "docroot/modules/custom" phpstan.neon