In the spirit of finally doing something useful for ClassicPress and contribute to the repository I figured I finally learn what CPCS is and how it works.
I’m not a terminal wizard, don’t care for it either. Nor do I understand the manual very well as it expects me to know how any of this works… I don’t - I know how basic terminal works, how to run commands and the basics. But if it doesn’t work as explained I have no idea what’s going on or how to fix it.
After 30 frustrating minutes (of my own making for not being a terminal nerd while doing new stuff) I’ve managed to install codesniffer and wpcs - Both work.
I can scan files, folders and I understand the output. Good (ish).
But then - Happy with that result the fun stops.
Why is running cpcs different than wpcs? Why doesn’t it work as the manual says?
Expected usage (even though thats not in the manual):
% php bin/phpcs --standard=ClassicPress ~/Sites/localhost/classicpress/wp-content/plugins/adrotate
But no - That’s too easy:
ERROR: the "ClassicPress" coding standard is not installed. The installed coding standards are MySource, PEAR, PSR1, PSR2, PSR12, Squiz, Zend, WordPress, WordPress-Core, WordPress-Docs and WordPress-Extra
Adding the installed path (or whatever) in a similar fashion as you’d do for wpcs doesn’t work.
I then went back to what your manual says and tried to run:
% CPCS_TEXTDOMAIN=adrotate cpcs/bin/cpcs ~/Sites/localhost/classicpress/wp-content/plugins/adrotate %
(also the reverse, from the plugin directory and a variant with php in front)
It does nothing, no error, no log. It just shows a new prompt as if something happened, except it didn’t.
What is CPCS_TEXTDOMAIN? Why is that not explained anywhere? Is it the plugin slug? WHy not call it ‘slug’ then?
Why doesn’t cpcs give me any response other than a stupid usage indicator that teaches me the above command which doesn’t work?
All I get if I try variants is something like this:
% cpcs/bin/cpcs ~/Sites/localhost/classicpress/wp-content/plugins/adrotate Usage: CPCS_TEXTDOMAIN=plugin-textdomain cpcs/bin/cpcs plugin-directory-name [other-wpcs-args] (to check the current directory, use . for plugin-directory-name)
But that doesn’t work as mentioned above…
How do I run CPCS? WHat command should I run? Or better yet, where is the UI with a input-selection-field, a GO button and a text-log-window-thingy for the result. You know, something modern and not user unfriendly.