Patterns to include in execution and reports.
Patterns to exclude from execution and reports.
Note: If no coding standard is specified, PHP_CodeSniffer will default to checking against the PEAR coding standard which has the
Generic.Files.LineEndingsrule to use LF as EOL characters. https://github.com/squizlabs/PHP_CodeSniffer/wiki/Usage#getting-help-from-the-command-line
This means PHP_CodeSniffer does not keep CRLF line endings and all EOL characters are converted to LF in files where the auto-fix is applied in such cases. So if this behavior does not suit your project, what you can do is one of the followings:
--excludeoption, for example:
inspecode: phpcs: options: --exclude: Generic.Files.LineEndings
Prepare a custom coding standard and specify it to the
--standardoption, for example:
inspecode: phpcs: options: --standard: myruleset.xml
"1.0" xml version=<ruleset name="Custom Standard"> <rule ref="Generic.Files.LineEndings"> <properties> <property name="eolChar" value="\r\n"/> </properties> </rule> </ruleset>
Amount of CPU. The default machine has
0.75 CPU with
2880 MiB RAM.
Inspecode automatically specifies
-d memory_limit=<limit> to PHP_CodeSniffer in order to configure the maximum amount of memory that PHP_CodeSniffer is allowed to allocate according to this value.
240 MiB RAM for system, and makes the rest of RAM available to PHP_CodeSniffer for memory allocation.
-d memory_limit=2640M is specified by default (for
-d memory_limit=5520M is specified for
Below is the list of options that are supported:
-n Do not print warnings (shortcut for --warning-severity=0) -w Print both warnings and errors (this is the default) -m Stop error messages from being recorded (saves a lot of memory, but stops many reports from being used) --ignore-annotations Ignore all @codingStandard annotations in code comments --encoding=<encoding> <encoding> The encoding of the files being checked (default is utf-8) --extensions=<extensions> <extensions> A comma separated list of file extensions to check (extension filtering only valid when checking a directory) The type of the file can be specified using: ext/type e.g., module/php,es/js --ignore=<patterns> <patterns> A comma separated list of patterns to ignore files and directories --sniffs=<sniffs> --exclude=<sniffs> <sniffs> A comma separated list of sniff codes to include or exclude from checking (all sniffs must be part of the specified standard) --severity=<severity> --error-severity=<severity> --warning-severity=<severity> <severity> The minimum severity required to display an error or warning --standard=<standard> <standard> The name or path of the coding standard to use --runtime-set key value
Note: As of now,
--runtime-setcan be used only for the following configuration options:
No tool specific severity levels are available.
Note: The incremental analysis is disabled if any kinds of configuration files are changed. The files recognized as configuration files are as follows:
- Installed paths:
- Any files under directories specified to
- Coding standard files:
- Files specified to
Note: The incremental analysis is disabled if external dependencies are required. See Resolving Dependencies about how the dependencies are resolved.
With default options:
inspecode: phpcs: default
With enabling auto-fixing and default options:
inspecode: phpcs: auto-fix
With custom machine:
inspecode: phpcs: machine: cpu: 1.5 # 1.5 CPU, 5760 MiB RAM
With custom options:
inspecode: phpcs: options: --error-severity: 1 --warning-severity: 8
Inspecode automatically detects the following dependencies in your repository and tries to resolve them before running PHP_CodeSniffer:
git submodule update --init --recursive at the root of your repository if
.gitmodules is there.
Inspecode recursively searches your repository for
composer.json and runs
composer install --no-interaction --quiet at each directory containing the file.
As of now, Inspecode can download:
Note: If resolving dependencies fails due to some reasons, you can see the error log, however, Inspecode continues the process unless running PHP_CodeSniffer itself fails.