To start using PHP_CodeSniffer, enable it in Repository Settings. To configure the coding standard you want to follow, add
sider.yml in your repository and set the
linter: code_sniffer: dir: app/ options: standard: CakePHP
If you don't specify anything, Sider tries to detect the standard and target directory for your project automatically. If it cannot find an appropriate standard, it assumes PSR2 as its standard and analyzes all PHP files in your repository.
Standard and Analysis Target
Sider tries to detect the most suitable standard and target directory for your project, based on the framework your project is using.
The following standards are detected automatically:
Autodetection is based on file names and directory structure. If autodetection fails, you can specify a standard in
Example setting for PHP_CodeSniffer under
linter: code_sniffer: dir: app/ standard: phpcs.xml extensions: php,inc,lib encoding: utf-8 ignore: app/Vendor
You can use several options to fine-tune PHP_CodeSniffer to your project:
|Declare PHP_CodeSniffer version explicitly.|
|Set targets to analyze.|
|Set coding standard or your config file when analyzing.|
|Set extensions to analyze.|
|Set file encoding.|
|Excludes files or directories from analysis.|
This option controls which major version of PHP_CodeSniffer is used. The default value is
Sider has stopped supporting v2 of PHP_CodeSniffer. Therfore, if you set
2 in this option, Sider will execute v3.
This option controls directories Sider inspects. The default value is dependent on the frameworks PHP_CodeSniffer supports. If you are not using any frameworks or are using a framework PHP_CodeSniffer does not support,
./ is used.
If you would like to exclude specific directories, you can specify them in a custom ruleset file.
This option controls coding standard of your project. If you leave this value empty, Sider tries to detect the standard automatically.
PSR2 is used when auto detection fails.
You can use any standards the PHP_CodeSniffer supports:
$ phpcs3 -i The installed coding standards are MySource, PEAR, PSR1, PSR2, Squiz, Zend, Symfony, CakePHP, WordPress-Docs, WordPress-Core, WordPress, WordPress-Extra and WordPress-VIP
You can also define your own standard, and enter the path to the config file here.
This option controls extensions of files Sider inspects. The default value is
This option controls file encoding.
A comma-separated list of patterns to ignore files and directories by.