ObliviousHarmony / vscode-php-codesniffer

A VS Code extension for integrating PHP_CodeSniffer.
https://marketplace.visualstudio.com/items?itemName=obliviousharmony.vscode-php-codesniffer
Other
40 stars 2 forks source link

Change `phpCodeSniffer.ignorePatterns` To Use Glob Patterns #48

Closed danielpost closed 2 years ago

danielpost commented 2 years ago

This is more of a help request than a GitHub issue (apologies!), but I'm wondering if it would be possible to provide a more detailed example of how to use phpCodeSniffer.ignorePatterns. In my case, I currently have the following list, but it seems to ignore everything:

"phpCodeSniffer.ignorePatterns": [
    ".*/vendor/.*",
    ".*/vendor/**/{Tests,tests}/.*",
    ".*/.history/.*",
    ".*/projects/packages/**/vendor/.*",
    ".*/projects/plugins/**/vendor/.*",
    ".*/projects/packages/**/wordpress/.*",
    ".*/projects/plugins/**/wordpress/.*",
],

The intention here is to ignore anything within certain other folders (for example, the last line aims to ignore anything within the wordpress folder when it is a subfolder of /projects/plugins/ at any level.

I think this might also be helpful as an extra example in the README. Thank you in advance!

ObliviousHarmony commented 2 years ago

Thanks @danielpost, I think the confusion here is caused by the fact that the extension uses regular expressions while everything else in VS Code uses glob patterns. Looking through the settings, I don't see any other instances of regular expressions being used. I think I'll update this to use glob patterns instead.

I'll also have it inherit from files.exclude like other settings of this kind.

danielpost commented 2 years ago

@ObliviousHarmony That sounds like a great idea, thanks! 🙏

ObliviousHarmony commented 2 years ago

Hello @danielpost,

I've created a new phpCodeSniffer.exclude option that supports glob matching. This new option is available in the latest 1.7.0 release.