Every now and then I make a change in my development environment and.. I am back at re-configuring the whole setup.
Let’s get that over with once and for all.
The setup that works
This is my environment:
- Visual Studio Code with
- PHP Sniffer by wongjn
- Composer with
- squizlabs/php_codesniffer
- wp-coding-standards/wpcs
The root of my workspace contains a phpcs.xml
that looks as follows:
<?xml version="1.0"?>
<ruleset name="mklasen-project">
<description>PHPCS</description>
<config name="installed_paths" value="app/www/vendor/wp-coding-standards/wpcs" />
<config name="ignore_warnings_on_exit" value="1" />
<rule ref="WordPress"/>
<file>.</file>
<exclude-pattern>*/app/www/vendor/*</exclude-pattern>
<exclude-pattern>*/app/frontend/node_modules/*</exclude-pattern>
</ruleset>
And a composer.json
file that sets the vendor dir to app/www/vendor
, as follows:
"config": {
"vendor-dir": "app/www/vendor"
}
Make sure you’re Workspace and General settings are empty!
- Check
.vscode/settings.json
in your workspace and clear it - Hit CMD (cntrl) + shift + P and enter ‘settings.json’ and check your custom settings to see if any PHPSniffer settings are active, clear them out if necessary
That’s it! That should do the job!
Leave a Reply