For the Tiki code development it is very useful tool (which is also being run automatically on Gitlab CI for each push or merge request) to check if your code meets the Tiki PHP coding standards.
Installation
Note: This is normally handled for you by running php console.php dev:configure
In your Tiki root run the following command:
$ ./temp/composer.phar install --prefer-dist --working-dir="vendor_bundled"
This will install the development packages from Composer.
Usage
For example, to check a file in lib/
:
$ php vendor_bundled/vendor/squizlabs/php_codesniffer/bin/phpcs lib/ocrlib.php
To fix a file auto-magically:
$ php vendor_bundled/vendor/squizlabs/php_codesniffer/bin/phpcbf lib/ocrlib.php
Fixing other errors
Some of the tiki co
doc/devtools/codesniffer/standards/TikiIgnore/ignore_list.json, don't! Instead, regenerate that file with
php doc/devtools/codesniffer/standards/TikiIgnore/generate_ignore_list.php
Related
Also see:
- https://github.com/squizlabs/PHP_CodeSniffer
- Example of errors reported on Gitlab CI pipeline job: https://gitlab.com/tikiwiki/tiki/-/jobs/498451366