Php-language-server: Add linting

Created on 5 Sep 2016  路  7Comments  路  Source: felixfbecker/php-language-server

I don't know what is the best linter for PHP and how to configure it?
Needs to be integrated in CI

Most helpful comment

I've been using https://github.com/squizlabs/PHP_CodeSniffer at work.
It's extendable with custom validation rules and already contains rules for PSR-2.
It's available as a composer package and actively maintained.

Overall very nice, haven't integrated it with a CI solution, however.

And since #35 already depends on it this would be a good fit.

All 7 comments

I've been using https://github.com/squizlabs/PHP_CodeSniffer at work.
It's extendable with custom validation rules and already contains rules for PSR-2.
It's available as a composer package and actively maintained.

Overall very nice, haven't integrated it with a CI solution, however.

And since #35 already depends on it this would be a good fit.

How about using the PHP Mess Detector for additional static code analysis?

What I desire is a linter, that can be configured through a config file and defaults to some coding best practices, that can be installed with Composer, run in CI and has an editor plugin for VS Code

If anyone has experience with one I would welcome a PR

As far as I am familiar there is no one tool to rule them all. http://phpqatools.org/ is a nice collection of popular tools that are used in CI. Some of them like Code Sniffer and Mess Detector are also often integrated in the editor/IDE.

I can imagine that the language server look for the specific configuration files in the project and if found, activate the corresponding linting tool. For example, if there is a phpcs.xml file then the language server will activate use Code Sniffer to report additional diagnostics. Of course, the client should be able to override this default behavior.

@kaloyan-raev This issue is not for adding linting to the LS, it is for linting this repository (for PRs etc) 馃槃

OK :)

..and has an editor plugin for VS Code

This phpcs plugin works just fine https://marketplace.visualstudio.com/items?itemName=ikappas.phpcs

Was this page helpful?
0 / 5 - 0 ratings