- Lint your PHP code with PHP_CodeSniffer in Nova.
- 2829 Installs
This extension is allowed to:
- Read Files
- Launch Subprocesses
PHP_CodeSniffer automatically lints all open PHP files using
phpcs, then reports errors and warnings in Nova's Issues sidebar and the editor gutter.
PHP_CodeSniffer can fix issues discovered by
phpcs automatically using
PHP_CodeSniffer requires the following tools to be installed on your Mac:
The extension will do its best to find an installation of PHP_CodeSniffer on your system in the following order:
- Using the path you define in the extension's configuration
- Path to the default Composer installation;
- Path to the default Phive installation;
- Global installation;
If the extension doesn't find an installation it will fall back to the version of PHP_CodeSniffer bundled with the extension. The bundled
phpcbf are currently at version 3.6.1.
The bundled PHP_CodeSniffer will not know how to locate any rulesets installed via Composer or Phive, so if you need to use
phpcsrulesets installed via Composer or Phive make sure you use the same method to install PHP_CodeSniffer.
If you have a custom ruleset for
phpcssomewhere that you'd like to use, you can choose to use that "standard" by setting the path in Project → Project Settings → PHP_CodeSniffer.
Since macOS Monterey PHP is no longer included in macOS. The easiest way I've found to install PHP is by using Homebrew.
To configure global preferences, open Extensions → Extension Library → PHP_CodeSniffer then select PHP_CodeSniffer's Preferences tab.
You can also configure preferences on a per-project basis in Project → Project Settings → PHP_CodeSniffer.
Version 1.3.1 - November 24, 2021
- Add - Donation link for Liberapay account.
Version 1.3.0 - November 23, 2021
- Add - The extension will now underline the word where an issue is reported.
- Add - The option to turn on debug logging. Very excessive, significantly slows down the extension.
- Tweak - Updated the screenshot.
Version 1.2.4 - November 17, 2021
- Fix - Handle an unhandled exception when an empty path is passed to the
- Tweak - Update extension README.
- Add - An example screenshot to README.
Version 1.2.3 - November 9, 2021
- Tweak - Update bundled phpcs version to v3.6.1.
- Tweak - Update bundled phpcbf version to v3.6.1.
- Tweak - Update extension description.
- Tweak - Update readme.
Version 1.2.2 - April 26, 2021
- Fix - Fallback path to
phpcsnow correctly falls back to
Version 1.2.1 - March 17, 2021
- Tweak - Update readme to reflect the changes introduced in v1.2.0.
- Tweak - Update the description of some extension settings.
- Tweak - Use the same default standard PHP_CodeSniffer uses, instead of defaulting to the WordPress standard.
Version 1.2.0 - March 17, 2021
- Add - Bundle
phpcbfphar files with extension.
- Tweak - Fall back to bundled phar files when no global/composer/phive installation detected.
Version 1.1.1 - March 12, 2021
- Add - Link to mailing list for bug reports instead of my personal email.
Version 1.1.0 - March 11, 2021
- Tweak - Provide free-form input for custom ruleset.
- Fix - Issues are now indicated at the right column when indenting with tabs.
- Add - Command for fixing issues with
Version 1.0.5 - February 24, 2021
- Add - Support for a
phpcs.xml.distfile for defining code sniffing rules.
- Add - An error notification if
phpcsfails to run.
- Add - Support for the Advanced PHP syntax extension.
- Fix - Progress and verbose output from
phpcsis now suppressed correctly to prevent JSON parsing issues.
- Fix - List of available PHPCS styles not showing up in project preferences.
- Add option to choose whether to run phpcs on save or on change.
Copyright (c) 2020 Kristófer Reykjalín Þorláksson
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.