Closed kloon closed 6 years ago
This would be cool. Just a suggestion which might help: you can list multiple standards and sniffs in the phpcs.xml file in each project folder and vscode should respect them (leaving phpcs.standard
as null
).
If you have custom standards, I highly recommend installing phpcodesniffer-composer-installer to make installing standards in a project more easily.
I just tried removing my phpcs.standard
setting and adding 2 phpcs.xml files... one in the root of the project, and one in a submodule that uses a seperate standard.
VSCode isn't respecting the submodule standard, probably b/c PHPCS is getting executed starting in a different directory. I've found when running PHPCS on the command line, you must be in the directory containing phpcs.xml (or further up the tree). PHPCS only searches from the execution location down towards the root of the filesystem (regardless where the file being linted is located).
@jrfoell I' m also very much interested in this feature... I 've even opened a ticket early 2017:
https://github.com/squizlabs/PHP_CodeSniffer/issues/1328
As it is stands right now (and correct me if I missed something) there is no support for submodule standard build-in in phpcs but I am looking into implementing either:
A recursive ruleset iterator that will search for ruleset.xml next to the file and up the dtree to workspace root. This will work only for Open Folders/Workspaces
A configuration variable that will hold an array of path mappings to coding standards. This would work better across all cases but will require manual setup.
Any other suggestions are welcome!
This has been implemented in 1.0.0-beta.6 and is enabled by default with phpcs.autoConfigSearch
setting
Thanks @ikappas! Looking forward to 1.0! Seems like it's getting really close.
Thank you @ikappas!
It would be great if you would have the option to specify multiple ruleset files in phpcs.standard config.
It is useful for when you are working on multiple projects where the ruleset filenames differ for each project.
Perhaps a comma-separated list?