You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Thanks for making this. I got the basic linting working really fast after failing with SublimeLinter-phpcs.
I'm confused by something. I've read about per project rulesets using a phpcs.xml, and I work in a team, on a few different kinds of PHP projects, so that sounds great.
To test I made the following minimal ruleset:
<?xml version="1.0"?>
<ruleset name="PHP_CodeSniffer">
<description>Ruleset for this project.</description>
<rule ref="Generic.ControlStructures.InlineControlStructure.NotAllowed"/>
</ruleset>
When I go to the command line, cd to /webdev/project1/, and run phpcs app.php, I see the xml ruleset in action. The only errors I get are Inline control structures are not allowed.
But when I open the project in Sublime and run Sniff this file, I get all kinds of PSR2 errors. The default ruleset.
From other peoples issues and Googling I found that people add..
..to their project1.sublime-project files. So I tried it, and sure enough, now it works.
But *.sublime-project files are not really meant to be committed to repos. And if it's not committed, then every developer has to edit that file manually. Doesn't that defeat the purpose of distributing a per project settings file?
Why can't Sublime check for a phpcs.xml in the current directory, and then its parent, and then its parent, and then its parent, and use it, without me explicitly stating its location? I thought it would.
And lastly, from the command line it does work automatically. Is the command line smarter than Sublime?
I'm confused. I am I doing it wrong? I am missing something?
Thanks for your time.
The text was updated successfully, but these errors were encountered:
I did some reading in the SublimeLinter-phpcs issues, played around with debug mode, and I found a setup that's a little better, but not perfect.
The Sublime plugin runs phpcs from the command line behind the scenes. Obviously. Should've thought of that before. The phpcs.xml gets detected by phpcs when the argument --standard=* is not present.
We can override that in our User settings. But no matter if you set "false", false, "", "null" or null... the plugin passes it onto the command line with --standard in front of it.
Comment the arg out in your User settings, or delete it.
(Con) If you want to sniff without a phpcs.xml you have to re-enable this line temporarily,.. or write a phpcs.xml.
(Con) Teach the Sublime users on your dev team this, once. The default is not good enough.
(Pro) Teach the Sublime users on your dev team this, once. Once is better than editing *.sublime-project every project.
(Pro) Your phpcs.xml gets detected.
I still welcome feedback. This may just be an unnecessary hack.
Thanks for making this. I got the basic linting working really fast after failing with SublimeLinter-phpcs.
I'm confused by something. I've read about per project rulesets using a
phpcs.xml
, and I work in a team, on a few different kinds of PHP projects, so that sounds great.To test I made the following minimal ruleset:
Now I have the following files:
When I go to the command line, cd to
/webdev/project1/
, and runphpcs app.php
, I see the xml ruleset in action. The only errors I get areInline control structures are not allowed
.But when I open the project in Sublime and run
Sniff this file
, I get all kinds of PSR2 errors. The default ruleset.From other peoples issues and Googling I found that people add..
..to their
project1.sublime-project
files. So I tried it, and sure enough, now it works.But
*.sublime-project
files are not really meant to be committed to repos. And if it's not committed, then every developer has to edit that file manually. Doesn't that defeat the purpose of distributing a per project settings file?Why can't Sublime check for a
phpcs.xml
in the current directory, and then its parent, and then its parent, and then its parent, and use it, without me explicitly stating its location? I thought it would.And lastly, from the command line it does work automatically. Is the command line smarter than Sublime?
I'm confused. I am I doing it wrong? I am missing something?
Thanks for your time.
The text was updated successfully, but these errors were encountered: