benmatselby / sublime-phpcs

🔍 PHP CodeSniffer, PHP Coding Standard Fixer, Linter, and Mess Detector Support for Sublime Text
Other
812 stars 126 forks source link

Per Project Settings #32

Closed fstrube closed 11 years ago

fstrube commented 12 years ago

Is there a way to specify per-project settings? For instance I would like my Magento projects to use a different standard than my CakePHP projects. I would like to do:

magento.sublime-project

{
    "folders": ["/path/to/project"],
    "settings":
    {
        "phpcs_additional_args": {
            "--standard": "Zend"
        }
    }
}
benmatselby commented 12 years ago

Hi Franklin

You cannot do that as it stands but that is a rather nice enhancement. I will have a look to see what can be done.

Drarok commented 12 years ago

I've just discovered this limitation, too. I was reading hte Sublime docs, and they state that this should work. I expect there's some extra work required by the plugin to read the right config though?

benmatselby commented 12 years ago

@Drarok Which docs specifically? Was it http://www.sublimetext.com/docs/2/projects.html and http://www.sublimetext.com/docs/2/settings.html? I've just tried to do this and it didn't seem to work.

Drarok commented 12 years ago

Yep, those look familiar. I'll take a look at some other plugins, see if I can find one where this behaviour works. :)

HogeBlekker commented 11 years ago

This would be a very good enhancement indeed! However, isn't this something for the developers of Sublime Text 2?

benmatselby commented 11 years ago

I've not had chance to look into this yet but I believe plugins can achieve this but I'd need to change the way I read the settings file.

philipobenito commented 11 years ago

Just to add my support for this feature :+1:

benmatselby commented 11 years ago

This is currently on the reload-settings branch so I can do some more testing this week.

benmatselby commented 11 years ago

This has just been pushed to master and released in 6.2

philipobenito commented 11 years ago

Does this work in the same way as @fstrube suggested?

benmatselby commented 11 years ago

Slightly different: http://www.soulbroken.co.uk/2013/04/sublime-phpcs-now-supports-project-based-settings/ It is essentially named spaced within phpcs.

philipobenito commented 11 years ago

Brilliant stuff, just testing, great feature

travisfisher commented 9 years ago

Slightly different: http://www.soulbroken.co.uk/2013/04/sublime-phpcs-now-supports-project-based-settings/ It is essentially named spaced within phpcs.

This link is broken. Can you add the documentation to the wiki or readme?

handrus commented 9 years ago

Leaving a example here for anyone that might find this and the broken link. Your .project file should look something like this:

{
    "folders":
    [
        {
            "folder_exclude_patterns":
            [
                "node_modules/*",
                "gulp/*",
                "builds/*",
                "src/themes/natura/assets/sass/.sass-cache"
            ],
            "path": "/home/handrus/Projects/Taller/xpto"
        }
    ],
    "settings":
    {
        "phpcs":
        {
            "phpcs_additional_args":
            {
                "--standard": "/path/to/.composer/vendor/drupal/coder/coder_sniffer/Drupal"
            }
        }
    }
}

Of course this is a example to apply Drupal code sniffer. This could be anything. Whatever you can have on this package settings it can be overwritten under the settings -> phpcs

benmatselby commented 9 years ago

Thanks @handrus for writing this up - appreciate it.

I've updated the github page with it: http://benmatselby.github.io/sublime-phpcs/#project-based-settings