Name : WordPress Coding Standards Linter for Cloud9
Current Version: 0.0.2a
Author : EP4
Contributors : Dave Lavoie
License : GPLv3 or later
Provides a linter in Cloud9 IDE for WordPress development using PHP CodeSniffer (PHPCS) based on WordPress Coding Standards (WPCS) and PHPCompatibility rules.
-
From the Cloud9 menu, select Preferences, then Experimental -> SDK and enable Load Custom Plugins, Load Plugins From Workspace and Plugin Manager toggles. For more details about Cloud9 Experimental Features, visit https://docs.c9.io/docs/experimental-features .
-
Open a Terminal from the menu Window -> New Terminal.
-
Run these commands in the terminal:
git clone [email protected]:EP4-Corporation/c9.ide.language.php.wordpress.git
cd c9.ide.language.php.wordpress
c9 install .
cd ..
rm -fR c9.ide.language.php.wordpress
- Restart Cloud9 in Debug Mode by appending the debug=2 parameter to the URL. For example, if your workspace is accessible at https://ide.c9.io/username/workspace_name, you can enable the debug mode from https://ide.c9.io/username/workspace_name?debug=2 . You can also enable the debug mode simply from the menu Tools -> Developer -> Start in Debug Mode.
- Please note the following -
There is currently no way to install custom plugins to Cloud9 other than using the debug mode, since the Cloud9 API doesn't allow publishing new packages at the moment. See https://community.c9.io/t/unable-to-publish-c9-package/6235.
- Use Cloud9 as usual, and warnings will be displayed in the IDE when working on PHP files if PHP CodeSniffer detects any error based on PHPCompatibility & WordPress Coding Standards rules.
This plugin will display errors found by PHPCS directly in the IDE, as you can see on the following screenshot:
This plugin will do the following:
- Run PHPCS on the current PHP file using WordPress Coding Standards and PHPCompatibility rules.
- If errors are found, a warning icon will be displayed next to the line number.
- When hovering that icon, a tooltip explaining the error will be displayed.
- In the message, icons will be displayed for helping you distinguish if this is a warning or an error, and if it can be fixed automatically by PHPCBF.
- In the message, the line and column where the error can be found in the code will be displayed inside parenthesis.
- In the code, errors will be underlined with a red dotted line, and highlighted in red so you can rapidly identify them. Please note that the highlighted characters might not actually be accurate.
- Since the plugin can only run in debug mode and since a green debug bar is always displayed at the top of the screen when in debug mode, the plugin is also loading a CSS stylesheet in order to hide that annoying debug bar.
Since there is no simple way to allow HTML in these tooltips, we use some custom unicode characters for displaying more meaningful messages:
Displayed Characters | Meaning |
---|---|
🔴 Red Circle | The identified issue is considered to be an error by PHPCS. |
🔶 Yellow Diamond | The identified issue is considered to be a warning by PHPCS. |
✔ Checkmark | The issue can be resolved automatically by running PHPCBF. Please note that the plugin doesn't run PHPCBF (and doesn't actually fix any issue). |
𝗪𝗣𝗖𝗦 | The issue was identified using WordPress Coding Standards Rules. |
𝗣𝗛𝗣𝗖𝗼𝗺𝗽𝗮𝘁𝗶𝗯𝗶𝗹𝗶𝘁𝘆 | The issue was identified using PHPCompatibility Rules. |
➀ to ➈ | Any number displayed in a circle represent the severity level of the issue. ➄ is the default severity and is never displayed. |
(𝟏𝟐𝟑:𝟕𝟖𝟗) | Numbers displayed inside parenthesis refer to the line and column where the issue can be found. In this example, look at line 123 and column 789. |
- PHP CodeSniffer : GitHub repo & Wiki
- WordPress Coding Standards : GitHub Repo, Wiki & Whitelisting code which flags errors
- PHPCompatibility : GitHub Repo
- Cloud9 : SDK & API
- Updating WP Coding Standards with the latest release as of 2017-02-10.
- Updading PHPCompabitity with the latest release as of 2017-02-06
Initial release.