Jump to content

Code PHP Sniffer et PHPStorm


Recommended Posts

Re-Bonjour,

 

Je voudrai utiliser Code PHP Sniffer pour utiliser les normes Prestashop...

 

Très bête mais je galère pour installer ce qu'il faut. Je suis sous PHPStorm 8 et Windows. Quand je regarde le guide du développeur, il est dit :

 

This is a brief tutorial on how to install a code validator on your PC and use it to validate your files. The code validator uses PHP CodeSniffer, which is a PEAR package (http://pear.php.net/package/PHP_CodeSniffer/). The PrestaShop code standard was created specifically for CodeSniffer, using many rules taken from existing standards, with added customized rules in order to better fit our project.

 

You can download the PrestaShop code standard using Git: https://github.com/PrestaShop/PrestaShop-norm-validator (you must perform this step before going any further with this tutorial).

In order for it to be recognized as a basic standard, it must be placed in the CodeSniffer's  /Standards folder
PhpStorm integration

If you use PhpStorm (http://www.jetbrains.com/phpstorm/), follow these steps:

  1. Go to Settings -> Inspection -> PHP -> PHP Code Sniffer.
  2. Set the path to the phpcs executable.
  3. Set the coding standard as "PrestaShop" (which is only available if you did put in CodeSniffer's /Standards folder).

 

J'ai donc téléchargé PHP_CodeSniffer-2.3.0 que j'ai décompressé. Ensuite j'ai téléchargé PrestaShop-norm-validator.

Ils disent qu'il faut la mettre dans le dossier /Standards... Okay mais je mes quoi dans ce dossier ? Et on parle bien du dossier Standard qui lui se situe dans le dossier aupréalablement décompressé de PHP_CodeSniffer ?

 

Pour la suite je ne trouve peut-être pas car je ne fais pas cette étape donc on va y aller doucement :)

 

Merci à vous !

Link to comment
Share on other sites

  • 2 months later...

Bonjour,

 

Alors si tu as bien installé PHP_CodeSniffer tu devrais avoir le dossier 'Standard' à l'intérieur. Par exemple j'utilise Wamp et le chemin de mon dossier Standard est :

C:\wamp\bin\php\php5.5.12\pear\PHP\CodeSniffer\Standards.

 

Si PHP_CodeSniffer n'est pas bien installé tu peux aller voir https://www.jetbrains.com/phpstorm/help/using-php-code-sniffer-tool.html, tu auras des informations sur l'installation.

Ensuite une fois que 'PrestaShop-norm-validator' est bien placé dans ton dossier 'Standard' tu as juste à sélectionner 'PrestaShop-norm-validator' dans la partie CodeSniffer de PHPStorm. Encore une fois c'est assez bien expliqué si tu utilises le lien précédent et la documentation que tu as cité.

 

Cordialement,

 

Édouard

Edited by Édouard WILLISSECK (see edit history)
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...