Skip to content

Added trailing slash to excluded directories#204

Open
petoc wants to merge 3 commits into
tighten:3.xfrom
petoc:default-exclude
Open

Added trailing slash to excluded directories#204
petoc wants to merge 3 commits into
tighten:3.xfrom
petoc:default-exclude

Conversation

@petoc

@petoc petoc commented Apr 29, 2026

Copy link
Copy Markdown

PHPCodeSniffer is treating paths in ignore option as patterns, when passing path build, paths like /build/, /builds/, /building/ and so on, are all ignored, same for other default paths.
As pointed out in #201, GitLab CI is by default using /builds/ directory for running jobs, so whole contents is excluded.
Adding trailing slash should fix this behavior, but PHPCodeSniffer still matches paths like /notbuild/ and ignores them.
So there probably should be leading slash, but this could affect other tools. This seems like reasonable hotfix.
Hopefully it will not cause any side effects.
Should fix issues #200, #201 .

@petoc

petoc commented Jun 8, 2026

Copy link
Copy Markdown
Author

Would you prefer different approach and ignore default excludes for PHPCS, when custom config is provided?

--- a/app/Support/PhpCodeSniffer.php
+++ b/app/Support/PhpCodeSniffer.php
@@ -57,7 +57,7 @@ class PhpCodeSniffer extends Tool
             define('PHP_CODESNIFFER_CBF', $tool === 'runPHPCBF');
         }
 
-        $ignore = $this->dusterConfig->get('exclude')
+        $ignore = ! $this->hasCustomConfig() && $this->dusterConfig->get('exclude')
             ? ['--ignore=' . implode(',', $this->dusterConfig->get('exclude'))]
             : [];

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant