Closed thelovekesh closed 1 year ago
@thelovekesh Why are you running phpcs --standard=PHPCSUtils
? I mean, I'd like to understand your use-case here as in my mind, there is none.
PHPCSUtils is not a standard to be run by end-users. It is a set of helper functions for external PHPCS standards.
If this is caused by PHPCSUtils being listed as a "standard" via phpcs -i
, there is already an issue open about that in the PHPCS repo: https://github.com/squizlabs/PHP_CodeSniffer/issues/2760
A possible solution might be to include an empty sniff to avoid this.
Note: I will not include an empty sniff.
The error/exception thrown by PHPCS is there for a reason and is pointing out something helpful, i.e. the scan being done is useless as-is as no sniffs are registered. This should be solved by whomever is running the scan, not in PHPCSUtils.
Why are you running phpcs --standard=PHPCSUtils ? I mean, I'd like to understand your use-case here as in my mind, there is none.
@jrfnl You can find one here. According to this, all sniffs are get listed and then revalidated if there are any duplicate or obsolete sniffs.
I will try to handle it on upstream but removing the PHPCSUtils
from phpcs -i
per https://github.com/squizlabs/PHP_CodeSniffer/issues/2760 doesn't seems a great solution either as the user will not be able to learn if PHPCSUtils
is loaded.
Why are you running phpcs --standard=PHPCSUtils ? I mean, I'd like to understand your use-case here as in my mind, there is none.
@jrfnl You can find one here. According to this, all sniffs are get listed and then revalidated if there are any duplicate or obsolete sniffs.
Que ? I still don't understand why that is done or even why that would ever be useful ? - I mean, rulesets will often include the same sniff twice, once from within a standard and once to add custom properties, so it just doesn't sound right to begin with, but then I may not understand correctly what that custom program really does (and I am resisting the temptation to look into it more deeply as I'm officially on holiday).
I will try to handle it on upstream
And that's how it should be. If you need help getting that sorted, let me know and I can possibly help you with that once I'm back from my break.
but removing the
PHPCSUtils
fromphpcs -i
per squizlabs/PHP_CodeSniffer#2760 doesn't seems a great solution either as the user will not be able to learn ifPHPCSUtils
is loaded.
Agreed, see my latest comment in that thread.
Thanks for catching up. Will add you to the upstream conversation once I start one.
I'm officially on holiday
I know from Twitter 😄 ; Enjoy the break 🎉 !
Sorry for the trouble. I found a flag to ignore standards without sniffs on the tools which I am using.
I am closing this and will continue the discussion on https://github.com/squizlabs/PHP_CodeSniffer/issues/2760
@thelovekesh Glad to hear you found a good solution.
As of https://github.com/squizlabs/PHP_CodeSniffer/commit/7df3c330929644bc494d2b2e8485ba300756fa87 PHPCS throws an expectation
No sniffs were registered
if there are no sniffs registered.Since
PHPCSUtils
is included as standard without sniffs, it throws an exception on execphpcs --standard=PHPCSUtils -es
.A possible solution might be to include an empty sniff to avoid this.
DummySniff
```phpping @jrfnl @gsherwood