You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: wiki/Advanced-Usage.md
+9Lines changed: 9 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -165,6 +165,15 @@ bar($foo,false);
165
165
## Limiting Results to Specific Sniffs
166
166
By default, PHP_CodeSniffer will check your code using all sniffs in the specified standard. Sometimes you may want to find all occurrences of a single error to eliminate it more quickly, or to exclude sniffs to see if they are causing conflicts in your standard. PHP_CodeSniffer allows you to specify a list of sniffs to limit results to using the `--sniffs` command line argument, or a list of sniffs to exclude using the `--exclude` command line argument. Sniff codes are separated by commas.
167
167
168
+
> [!NOTE]
169
+
> To find out the sniff code of an error message, use the `-s` command line argument.
170
+
>
171
+
> The source codes shown when using the `-s` flag are build up like this:
172
+
> `StandardName.Category.SniffName.ErrorCode`
173
+
>
174
+
> This four-part name is the identifier of a particular error or warning, commonly referred to as the _error code_.
175
+
> The first three parts of the name `StandardName.Category.SniffName` is the _sniff code_.
176
+
168
177
> [!NOTE]
169
178
> All sniffs specified on the command line must be used in the coding standard you are using to check your files.
Copy file name to clipboardExpand all lines: wiki/Home.md
+3-1Lines changed: 3 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,8 @@
1
1
PHP_CodeSniffer is a set of two PHP scripts; the main phpcs script that tokenizes PHP, JavaScript and CSS files to detect violations of a defined coding standard, and a second phpcbf script to automatically correct coding standard violations. PHP_CodeSniffer is an essential development tool that ensures your code remains clean and consistent.
2
2
3
-
A coding standard in PHP_CodeSniffer is a collection of sniff files. Each sniff file checks one part of the coding standard only. Multiple coding standards can be used within PHP_CodeSniffer so that the one installation can be used across multiple projects. The default coding standard used by PHP_CodeSniffer is the PEAR coding standard.
3
+
A coding standard in PHP_CodeSniffer is a collection of sniff files. Each sniff file checks one part of the coding standard only. Each sniff can yield multiple error codes, a different one for each aspect of the code which was checked and found non-compliant
4
+
5
+
Multiple coding standards can be used within PHP_CodeSniffer so that the one installation can be used across multiple projects. The default coding standard used by PHP_CodeSniffer is the PEAR coding standard.
4
6
5
7
## Example
6
8
To check a file against the PEAR coding standard, simply specify the file's location.
Copy file name to clipboardExpand all lines: wiki/Reporting.md
+36-10Lines changed: 36 additions & 10 deletions
Original file line number
Diff line number
Diff line change
@@ -24,30 +24,29 @@
24
24
***
25
25
26
26
## Printing Full and Summary Reports
27
-
Both the full and summary reports can additionally show information about the source of errors and warnings. Source codes can be used with the `--sniffs` command line argument to only show messages from a specified list of sources. To include source codes in the report, use the `-s` command line argument.
27
+
When running a scan, by default, the full report is displayed.
0 commit comments