squizlabs / PHP_CodeSniffer

PHP_CodeSniffer tokenizes PHP files and detects violations of a defined set of coding standards.
BSD 3-Clause "New" or "Revised" License
10.66k stars 1.48k forks source link

How to ignore subpath of scanned code? #3859

Closed jeritiana closed 3 months ago

jeritiana commented 1 year ago

I get the --ignore flag and I've read Advanced-Usage#ignoring-files-and-folders, but I don't see how to ignore a subdirectory of the scanned code.

Example:

$ phpcs --ignore=/path/to/code/libraries/* /path/to/code

This still scans /path/to/code/libraries/db_errors.php (there are bunch of files, not only a single one, so // phpcs:ignoreFile would not be a viable option).

Thanks!

fredden commented 1 year ago

Perhaps you want the -l flag ("Local directory only, no recursion")?

Looking at the example in the linked documentation, you may want phpcs --ignore=/libraries/* /path/to/code, but I've not tested this myself. Can you report back if this behaves any differently for you?

jrfnl commented 1 year ago

@jeritiana Did the above solve your issue ? If not, please report back. If it did, please close this issue.

jeritiana commented 3 months ago

I believe there was some kind of issue on my setup, it is working now. No specific resolution or something. Thanks for your help