Jump to content

CodeSniffer and prestashop standards


vlskrbek

Recommended Posts

Hello,

I am trying to get run the php code sniffer to work with prestashop standard. I have on xampp. I have to install the phpcs and now I can run this command:

c:\xampp\php>phpcs -i
The installed coding standards are MySource, PEAR, PSR1, PSR12, PSR2, Squiz and Zend

 

But it show only the already created standard definitions. I have downloaded standard as described here:

http://doc.prestashop.com/display/PS15/Coding+Standards

https://github.com/PrestaShop/PrestaShop-norm-validator

and copied all folder "PrestaShop-norm-validator-master" to the xampp folder for code standard:

c:\xampp\php\pear\PHP\CodeSniffer\Standards\

and renamed it to "Prestashop".

Restarted the server but the phpcs -i does not show it. How can I register the prestashop standard to the phpcs program?

 

Thank you for help.

Best Regards

 

Link to comment
Share on other sites

Kindly confirm why you want to use OLD Standards (Applicable to PS1.5 Standards). After PS1.6, PS coding standards is PSR2 which is already available by default with CodeSniffer.

 

Regarding OLD Standards,  Kindly confirm the folder Structure which you have pasted under Standards folder.

It should like 

PSStandards

    rules.xml

    Sniff

 

Basically, you need to copy the content of the folder i.e.  old_norm in parallel to rules.xml file

 

 

Link to comment
Share on other sites

  • 2 weeks later...
On 9. 9. 2018 at 11:15 AM, Knowband Plugins said:

Kindly confirm why you want to use OLD Standards (Applicable to PS1.5 Standards). After PS1.6, PS coding standards is PSR2 which is already available by default with CodeSniffer.

Regarding OLD Standards,  Kindly confirm the folder Structure which you have pasted under Standards folder.

It should like 

PSStandards

    rules.xml

    Sniff

Basically, you need to copy the content of the folder i.e.  old_norm in parallel to rules.xml file

 

Thank you very much for answer. Sorry for may late. I did not get the notification.

So if I understand correctly i for new standard (v 1.6 and higher) I do not need anything more. I just use PSR2, which is already available.

For the problem of the old standard I see this folder structure:

The PrestashopStandardV1.5 containt this:

old_norm

README.md

ruleset.xml

 

And the folder old_norm contain:

Sniffs

PrestashopCodingStandard.php

 

and the folder Sniffs contain folders:

Arrays, Classes, CodeAnalysis, Commenting, ControlStructures, Functions, PHP, Strings, Variables, WhiteSpace

 

So Maybe because the folder structure is not right therefore I do not see it in the codding standards?

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...