phptools-docs icon indicating copy to clipboard operation
phptools-docs copied to clipboard

VSC[REQ]: Have linting for WordPress/Any PHPCS coding standard

Open swashata opened this issue 6 years ago • 4 comments

As per #8 please consider following when implementing linting system.

  • WordPress coding standard as written here. This adds standards to already popular phpcs linting.
  • If WordPress is too specific, then you can actually implement general purpose phpcs based linting. We can then use composer to add the standard ourselves. One thing should be that the devsense linting should follow a configuration file

I think the 2nd approach would attract a broader userbase.

swashata avatar Nov 08 '18 14:11 swashata

Allready posted this on old marketplace side. U can use this https://marketplace.visualstudio.com/items?itemName=junstyle.php-cs-fixer It supports PSR-2. I hope soon PHP-Tools can replace that extension. Warnings allready disabled in PHP-Tools

Mordef avatar Nov 20 '18 13:11 Mordef

Update: phptools have its own "linting" (for performance reasons and also there is better code flow analysis). Anyways; there are a lot of rules missing and we are working on them.

It is a good idea to support phpcs configuration file tho 👍

I hope junstyle.php-cs-fixer works fine for now, similar feature is also planned to be provided as a simple in-code suggestion.

jakubmisek avatar Dec 03 '18 10:12 jakubmisek

Any news regarding support for phpcs config files?

Morgy93 avatar Nov 28 '23 09:11 Morgy93

As I'm looking into the phpcs documentation and source code - I don't think phpcs config would be 100% "compatible".

Our diagnostics are implemented in a very different way - in order to run continuously and efficiently - they're not implemented in PHP, and they're built on top of semantic trees ... (so we can't run custom phpcs rules)

We might adjust the naming convention of our rules to match the standard phpcs rules - so, at least, it would be possible to enable/disable those rules based on phpcs.*.xml configuration.

jakubmisek avatar Dec 10 '23 12:12 jakubmisek