|
10 | 10 | Running PHP_CodeSniffer with the `-h` or `--help` command line arguments will print a list of commands that PHP_CodeSniffer will respond to. The output of `phpcs -h` is shown below. |
11 | 11 |
|
12 | 12 | ```text |
13 | | -Usage: |
14 | | - phpcs [options] <file|directory> |
15 | | -
|
16 | | -Scan targets: |
17 | | - <file|directory> One or more files and/or directories to check, space separated. |
18 | | - - Check STDIN instead of local files and directories. |
19 | | - --stdin-path=<stdinPath> If processing STDIN, the file path that STDIN will be processed as. |
20 | | - --file-list=<fileList> Check the files and/or directories which are defined in the file to which the |
21 | | - path is provided (one per line). |
22 | | - --filter=<filter> Check based on a predefined file filter. Use either the "GitModified" or |
23 | | - "GitStaged" filter, or specify the path to a custom filter class. |
24 | | - --ignore=<patterns> Ignore files based on a comma-separated list of patterns matching files |
25 | | - and/or directories. |
26 | | - --extensions=<extensions> Check files with the specified file extensions (comma-separated list). |
27 | | - Defaults to php,inc/php,js,css. |
28 | | - The type of the file can be specified using: ext/type; e.g. module/php,es/js. |
29 | | - -l Check local directory only, no recursion. |
30 | | -
|
31 | | -Rule Selection Options: |
32 | | - --standard=<standard> The name of, or the path to, the coding standard to use. Can be a |
33 | | - comma-separated list specifying multiple standards. If no standard is |
34 | | - specified, PHP_CodeSniffer will look for a [.]phpcs.xml[.dist] custom ruleset |
35 | | - file in the current directory and those above it. |
36 | | - --sniffs=<sniffs> A comma-separated list of sniff codes to limit the scan to. All sniffs must |
37 | | - be part of the standard in use. |
38 | | - --exclude=<sniffs> A comma-separated list of sniff codes to exclude from the scan. All sniffs |
39 | | - must be part of the standard in use. |
40 | | -
|
41 | | - -i Show a list of installed coding standards. |
42 | | - -e Explain a standard by showing the names of all the sniffs it includes. |
43 | | - --generator=<generator> Show documentation for a standard. Use either the "HTML", "Markdown" or |
44 | | - "Text" generator. |
45 | | -
|
46 | | -Run Options: |
47 | | - -a Run in interactive mode, pausing after each file. |
48 | | - --bootstrap=<bootstrap> Run the specified file(s) before processing begins. A list of files can be |
49 | | - provided, separated by commas. |
50 | | - --cache[=<cacheFile>] Cache results between runs. Optionally, <cacheFile> can be provided to use a |
51 | | - specific file for caching. Otherwise, a temporary file is used. |
52 | | - --no-cache Do not cache results between runs (default). |
53 | | - --parallel=<processes> The number of files to be checked simultaneously. Defaults to 1 (no parallel |
54 | | - processing). |
55 | | - If enabled, this option only takes effect if the PHP PCNTL (Process Control) |
56 | | - extension is available. |
57 | | -
|
58 | | - -d <key[=value]> Set the [key] php.ini value to [value] or set to [true] if value is omitted. |
59 | | - Note: only php.ini settings which can be changed at runtime are supported. |
60 | | -
|
61 | | -Reporting Options: |
62 | | - --report=<report(s)> A comma-separated list of reports to print. Available reports: "full", "xml", |
63 | | - "checkstyle", "csv", "json", "junit", "emacs", "source", "summary", "diff", |
64 | | - "svnblame", "gitblame", "hgblame", "notifysend" or "performance". |
65 | | - Or specify the path to a custom report class. By default, the "full" report |
66 | | - is displayed. |
67 | | - --report-file=<reportFile> Write the report to the specified file path. |
68 | | - --report-<report>=<reportFile> Write the report specified in <report> to the specified file path. |
69 | | - --report-width=<reportWidth> How many columns wide screen reports should be. Set to "auto" to use current |
70 | | - screen width, where supported. |
71 | | - --basepath=<basepath> Strip a path from the front of file paths inside reports. |
72 | | -
|
73 | | - -w Include both warnings and errors (default). |
74 | | - -n Do not include warnings. Shortcut for "--warning-severity=0". |
75 | | - --severity=<severity> The minimum severity required to display an error or warning. Defaults to 5. |
76 | | - --error-severity=<severity> The minimum severity required to display an error. Defaults to 5. |
77 | | - --warning-severity=<severity> The minimum severity required to display a warning. Defaults to 5. |
78 | | -
|
79 | | - -s Show sniff error codes in all reports. |
80 | | - --ignore-annotations Ignore all "phpcs:..." annotations in code comments. |
81 | | - --colors Use colors in screen output. |
82 | | - --no-colors Do not use colors in screen output (default). |
83 | | - -p Show progress of the run. |
84 | | - -q Quiet mode; disables progress and verbose output. |
85 | | - -m Stop error messages from being recorded. This saves a lot of memory but stops |
86 | | - many reports from being used. |
87 | | -
|
88 | | -Configuration Options: |
89 | | - --encoding=<encoding> The encoding of the files being checked. Defaults to "utf-8". |
90 | | - --tab-width=<tabWidth> The number of spaces each tab represents. |
91 | | -
|
92 | | - Default values for a selection of options can be stored in a user-specific CodeSniffer.conf configuration |
93 | | - file. |
94 | | - This applies to the following options: "default_standard", "report_format", "tab_width", "encoding", |
95 | | - "severity", "error_severity", "warning_severity", "show_warnings", "report_width", "show_progress", "quiet", |
96 | | - "colors", "cache", "parallel", "installed_paths", "php_version", "ignore_errors_on_exit", |
97 | | - "ignore_warnings_on_exit". |
98 | | - --config-show Show the configuration options which are currently stored in the applicable |
99 | | - CodeSniffer.conf file. |
100 | | - --config-set <key> <value> Save a configuration option to the CodeSniffer.conf file. |
101 | | - --config-delete <key> Delete a configuration option from the CodeSniffer.conf file. |
102 | | - --runtime-set <key> <value> Set a configuration option to be applied to the current scan run only. |
103 | | -
|
104 | | -Miscellaneous Options: |
105 | | - -h, -?, --help Print this help message. |
106 | | - --version Print version information. |
107 | | - -v Verbose output: Print processed files. |
108 | | - -vv Verbose output: Print ruleset and token output. |
109 | | - -vvv Verbose output: Print sniff processing information. |
| 13 | +{{COMMAND-OUTPUT "phpcs --report-width=110 --no-colors -h"}} |
110 | 14 | ``` |
111 | 15 |
|
112 | 16 | > [!NOTE] |
|
0 commit comments