Skip to content

Added trailing slash to excluded directories#204

Merged
mattstauffer merged 3 commits into
tighten:3.xfrom
petoc:default-exclude
Jun 28, 2026
Merged

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

Conversation

@petoc

@petoc petoc commented Apr 29, 2026

Copy link
Copy Markdown
Contributor

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
Contributor 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'))]
             : [];

@mattstauffer mattstauffer merged commit 08a31d9 into tighten:3.x Jun 28, 2026
8 checks passed
@mattstauffer

Copy link
Copy Markdown
Member

@petoc thanks so much for this! I have been looking --SLOWLY--thinking there's more than just this that we need to fix. But it's taking me too long so let's just get this tagged for the people!

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.

2 participants