Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 5 additions & 0 deletions drupal-code-quality/config-amendments/.phpcs.dcq.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,10 @@

<rule ref="DrupalPractice"/>

<!-- Default to scanning the Drupal docroot when no path is provided. -->
<file>__DOCROOT__</file>

<exclude-pattern>__DOCROOT__/core/**</exclude-pattern>
<exclude-pattern>**/contrib/**</exclude-pattern>
<exclude-pattern>**/node_modules/**</exclude-pattern>
<exclude-pattern>__DOCROOT__/sites/*/files/**</exclude-pattern>
8 changes: 8 additions & 0 deletions tests/test.bats
Original file line number Diff line number Diff line change
Expand Up @@ -934,8 +934,16 @@ PY
assert_success
run grep -n "web/core" ".cspell.json"
assert_failure
run grep -n '<rule ref="DrupalPractice"/>' ".phpcs.xml"
assert_success
run grep -n "<file>docroot</file>" ".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
Expand Down