1
0
mirror of https://github.com/danog/psalm.git synced 2024-11-30 04:39:00 +01:00

Add configuration attribute to find unused @psalm-suppress (#4041)

This commit is contained in:
Michel Hunziker 2020-08-22 16:01:26 +02:00 committed by Daniil Gentili
parent 8e42ba4357
commit 4e20258efa
Signed by: danog
GPG Key ID: 8C1BE3B34B230CA7
4 changed files with 16 additions and 1 deletions

View File

@ -41,6 +41,7 @@
<xs:attribute name="ensureArrayStringOffsetsExist" type="xs:boolean" default="false" />
<xs:attribute name="findUnusedCode" type="xs:boolean" default="false" />
<xs:attribute name="findUnusedVariablesAndParams" type="xs:boolean" default="false" />
<xs:attribute name="findUnusedPsalmSuppress" type="xs:boolean" default="false" />
<xs:attribute name="forbidEcho" type="xs:boolean" default="false" />
<xs:attribute name="hideExternalErrors" type="xs:boolean" default="false" />
<xs:attribute name="hoistConstants" type="xs:boolean" default="false" />

View File

@ -247,6 +247,14 @@ When `true`, Psalm will attempt to find all unused variables, the equivalent of
```
When `true`, Psalm will attempt to find all unused code (including unused variables), the equivalent of running with `--find-unused-code`. Defaults to `false`.
#### findUnusedPsalmSuppress
```xml
<psalm
findUnusedPsalmSuppress="[bool]"
>
```
When `true`, Psalm will report all `@psalm-suppress` annotations that aren't used, the equivalent of running with `--find-unused-psalm-suppress`. Defaults to `false`.
#### loadXdebugStub
```xml
<psalm

View File

@ -402,6 +402,11 @@ class Config
*/
public $find_unused_variables = false;
/**
* @var bool
*/
public $find_unused_psalm_suppress = false;
/**
* @var bool
*/
@ -836,6 +841,7 @@ class Config
'usePhpStormMetaPath' => 'use_phpstorm_meta_path',
'allowInternalNamedArgumentsCalls' => 'allow_internal_named_arg_calls',
'allowNamedArgumentCalls' => 'allow_named_arg_calls',
'findUnusedPsalmSuppress' => 'find_unused_psalm_suppress',
];
foreach ($booleanAttributes as $xmlName => $internalName) {

View File

@ -667,7 +667,7 @@ if ($config->run_taint_analysis || (isset($options['track-tainted-input'])
$project_analyzer->trackTaintedInputs();
}
if (isset($options['find-unused-psalm-suppress'])) {
if ($config->find_unused_psalm_suppress || isset($options['find-unused-psalm-suppress'])) {
$project_analyzer->trackUnusedSuppressions();
}