Skip to content

Code style validation

zenmiu edited this page Aug 12, 2011 · 1 revision

The automatic validation is carried out with the .dev/phpcs-report.sh script (or .dev/phpcs-report.bat for Windows) from the litecommerce/core repository. The script checks PHP, Javascript and CSS files for compliance with the stanrard described in the above document.

Format of running:

.dev/phpcs-report.sh file1 file2 ...

where file1, file2 are the files to be checked. Specifying a directory instead of the files checks all the files in that directory.

Examples of running:

Running code validation for src/classes/XLite.php

.dev/phpcs-report.sh src/classes/XLite.php

Running code validation for all scripts in category src/classes/XLite/Core

.dev/phpcs-report.sh src/classes/XLite/Core

The automatic validation of the coding style of LiteCommerce is carried out by the PHP_CodeSniffer library. Before it is run, the library is to be installed from PEAR or by hand. Currently, the coding standard is described in a format, compatible with version PHP_CodeSniffer 1.2; therefore, you should install the latest version from that branch (1.2.2). The path to the library is to be specified in the option include_path в php.ini.

Clone this wiki locally