Commit a1777cf
committed
NoSilencedErrors: improve consistency metrics
The metrics for this sniff would be different depending on whether or not a (custom/default) whitelist was used.
If `use_default_whitelist` was set to `false` and no custom whitelist was passed, the metrics would look something like this:
```
Error silencing:
@Header( 'Content-Type: ' ... => 1 ( 12.50%)
@Header( 'Content-type: application/json' ... => 1 ( 12.50%)
@Header( 'X-Robots-Tag: noindex' ... => 1 ( 12.50%)
@ignore_user_abort( true ... => 1 ( 12.50%)
@include_once $converter_file... => 1 ( 12.50%)
@ini_get( 'disable_functions' ... => 1 ( 12.50%)
@ini_set( $key,... => 1 ( 12.50%)
@is_file( $this->... => 1 ( 12.50%)
-------------------------------------------------------------
total => 8 (100.00%)
```
... while if `use_default_whitelist` was set to `true` òr a custom whitelist was passed, those same metrics would look something like this:
```
PHP CODE SNIFFER INFORMATION REPORT
----------------------------------------------------------------------
Error silencing:
header => 3 ( 37.50%)
@include_once $converter_file... => 1 ( 12.50%)
ignore_user_abort => 1 ( 12.50%)
ini_get => 1 ( 12.50%)
ini_set => 1 ( 12.50%)
whitelisted function call: is_file => 1 ( 12.50%)
--------------------------------------------------
total => 8 (100.00%)
----------------------------------------------------------------------
```
The change now made will make it so:
* the grouping by function will always happen;
* function calls will consistently be prefixed with a `@`, unless whitelisted, in which case they are prefixed with `whitelisted function call: ` (like before).
The improved metrics will look something like this:
```
PHP CODE SNIFFER INFORMATION REPORT
----------------------------------------------------------------------
Error silencing:
@Header => 3 ( 37.50%)
@ignore_user_abort => 1 ( 12.50%)
@include_once $converter_file... => 1 ( 12.50%)
@ini_get => 1 ( 12.50%)
@ini_set => 1 ( 12.50%)
whitelisted function call: is_file => 1 ( 12.50%)
--------------------------------------------------
total => 8 (100.00%)
----------------------------------------------------------------------
```1 parent 38b6211 commit a1777cf
1 file changed
+19
-17
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
179 | 179 | | |
180 | 180 | | |
181 | 181 | | |
182 | | - | |
183 | | - | |
184 | | - | |
185 | | - | |
186 | | - | |
187 | | - | |
188 | | - | |
189 | | - | |
190 | | - | |
191 | | - | |
192 | | - | |
193 | | - | |
194 | | - | |
195 | | - | |
196 | | - | |
197 | | - | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
198 | 200 | | |
199 | 201 | | |
200 | 202 | | |
| |||
228 | 230 | | |
229 | 231 | | |
230 | 232 | | |
231 | | - | |
| 233 | + | |
232 | 234 | | |
233 | 235 | | |
234 | 236 | | |
| |||
0 commit comments