-
-
Notifications
You must be signed in to change notification settings - Fork 490
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update Guideline for SublimeText and WPCS #2001
Comments
I am adding here a note that MacOS users of Monterey might run into an error This would be the error you see in the terminal after running If that is the case for you too, and you use Monterey - then be aware that they removed PHP. You will need to install it. |
Updating this 2 years later, if you still get the Sublime text doing "nothing" when saving, open the 7.4 because WPCS lives in 2020, and somehow forgot that we only have one maintained PHP version nowadays. I do hope this helps anyone. It certainly helped me now the 5th time, and this doc is still not working... |
Well. The original page seems to be deleted meanwhile. |
@smileBeda It has not been deleted, though might have been renamed: https://github.com/WordPress/WordPress-Coding-Standards/wiki/Setting-up-WordPressCS-to-work-in-Sublime-Text |
According to Slack Conversation, opening issue to update this guideline.
Instead of a ready to copy paste text I will simply share here each and every step I needed to take and the findings I had, please pick what you think is useful to update the guide.
This setup assumes global usage, not project limited, and uses the first suggested package of the DOC (https://github.com/WordPress/WordPress-Coding-Standards/wiki/Setting-up-WPCS-to-work-in-Sublime-Text#sublime-phpcs-package)
nano ~/.zshrc
, addexport PATH="$HOME/.composer/vendor/bin:$PATH"
to the file and write it out, close the file, thensource ~/.zshrc
and confirm it worked withwhere phpcs
(you should see something like/Users/your_user_name/.composer/vendor/bin/phpcs
)phpcs --config-set installed_paths /Users/your_user_name/.composer/vendor/wp-coding-standards/wpcs
Phpcs
package (https://benmatselby.dev/sublime-phpcs/)phpcs_executable_path
should be (full line statement):"phpcs_executable_path": "/Users/your_user_name/.composer/vendor/bin/phpcs",
phpcs_additional_args
should be (full line statement):phpcbf_executable_path
should be (full line statement):"phpcbf_executable_path": "/Users/your_user_name/.composer/vendor/bin/phpcbf",
phpcbf_additional_args
should be (full line statement):That should be it, you have now a context menu item "PHP Code Sniffer" in Sublime text where you can sniff, change default, and Beautify.
Note, Sublime package additionally adds "php cs fixer" as well, which will not work with WPCS. Ignore and do not use it.
Note 2, The
SublimeLinter-phpcs
(second method described on above doc) did not work for me at all. While it is available in the package control for install, it will fail withImportError: No module named 'SublimeLinter'
on install.Why, not sure, and did not dig, and removed it again.
The text was updated successfully, but these errors were encountered: