Currently either you can have PHPCS enabled or not depending on your settings.
In certain cases, such as working on add-on/plugin/module/theme projects which are part of a larger framework, it is not intuitive to have phpcs sniffing files of other plugins/add-ons/modules/themes. I would not care much about their code and I don't have control over their development.
For example, if I am working on a WordPress plugin I would have entire WordPress install as a root because I often find myself going through core or other plugins/themes files to find the function I need or to dig into how they work. On such cases, phpcs would sniff any file I have open on my workspace.
This behavior can not be mitigated by using ignorePatterns. I have tried to set inverse-ignore using */htdocs/*,!*/my-plugin-dir/* but that doesn't work. It will just not sniff any files under htdocs.
So a good feature to have is an includePatterns option. This would work as inverse of what ignorePatterns is for. It will only include files/folders matching the glob. Or an option to have phpcs enabled only on folders (and their sub-foders) where composer/ruleset file is available while ignoring others which don't.
Since no one has so much as commented on this, I am curious if we could get a response on this from maintainers as to whether this is in scope or what the status is.
Currently either you can have PHPCS enabled or not depending on your settings.
In certain cases, such as working on add-on/plugin/module/theme projects which are part of a larger framework, it is not intuitive to have phpcs sniffing files of other plugins/add-ons/modules/themes. I would not care much about their code and I don't have control over their development.
For example, if I am working on a WordPress plugin I would have entire WordPress install as a root because I often find myself going through core or other plugins/themes files to find the function I need or to dig into how they work. On such cases, phpcs would sniff any file I have open on my workspace.
This behavior can not be mitigated by using
ignorePatterns
. I have tried to set inverse-ignore using*/htdocs/*,!*/my-plugin-dir/*
but that doesn't work. It will just not sniff any files underhtdocs
.So a good feature to have is an
includePatterns
option. This would work as inverse of whatignorePatterns
is for. It will only include files/folders matching the glob. Or an option to have phpcs enabled only on folders (and their sub-foders) where composer/ruleset file is available while ignoring others which don't.