Child pages
  • Coding Standards

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  1. Source code lines are limited to 120 150 characters wide.
  2. Functions and methods lines are limited to 80 characters. Functions must have a good reason to have an overly long name: keep it to the essential!

...

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

...

Command line (Linux)

You do not have to use Eclipse PhpStorm to use PHP CodeSniffer, you can also install it so that it can be called from the command line.

  1. Install PEAR: http://pear.php.net/
    $> apt-get install php-pear
  2. Install PHP CodeSniffer in PEAR: http://pear.php.net/package/PHP_CodeSniffer
    $> pear install PHP_CodeSniffer
  3. Add the PrestaShop standard that you downloaded from SVN earlier, and place it in PHP CodeSniffer's "Standards" folder.
    $> svn cohttpgit clone https://svngithub.prestashop.com/branchesPrestaShop/PrestaShop-norm-validator //usr/share/php/PHP/CodeSniffer/Standards/Prestashop
  4. Set the Prestashop standard as the default one
    $> phpcs --config-set default_standard Prestashop

...