Skip to content

Commit 2160396

Browse files
orklahmuglug
authored andcommitted
Config reportInfo to speed up analysis for big projects (#4095)
1 parent 66bbfea commit 2160396

File tree

3 files changed

+18
-1
lines changed

3 files changed

+18
-1
lines changed

config.xsd

+1
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@
7777
<xs:attribute name="usePhpStormMetaPath" type="xs:boolean" default="true" />
7878
<xs:attribute name="allowInternalNamedArgumentCalls" type="xs:boolean" default="true" />
7979
<xs:attribute name="allowNamedArgumentCalls" type="xs:boolean" default="true" />
80+
<xs:attribute name="reportInfo" type="xs:boolean" default="true" />
8081
</xs:complexType>
8182

8283
<xs:complexType name="ProjectFilesType">

docs/running_psalm/configuration.md

+10
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,16 @@ When `true`, Psalm will treat all classes as if they had sealed methods, meaning
314314

315315
When `true`, Psalm will run [Taint Analysis](../security_analysis/index.md) on your codebase. This config is the same as if you were running Psalm with `--taint-analysis`.
316316

317+
#### reportInfo
318+
319+
```xml
320+
<psalm
321+
reportInfo="[bool]"
322+
>
323+
```
324+
325+
When `false`, Psalm will not consider issue at lower level than `errorLevel` as `info` (they will be suppressed instead). This can be a big improvement in analysis time for big projects. However, this config will prevent Psalm to count or suggest fixes for suppressed issue
326+
317327
### Running Psalm
318328

319329
#### autoloader

src/Psalm/Config.php

+7-1
Original file line numberDiff line numberDiff line change
@@ -610,6 +610,11 @@ class Config
610610
*/
611611
public $debug_emitted_issues = false;
612612

613+
/**
614+
* @var bool
615+
*/
616+
private $report_info = true;
617+
613618
protected function __construct()
614619
{
615620
self::$instance = $this;
@@ -844,6 +849,7 @@ private static function fromXmlAndPaths(string $base_dir, string $file_contents,
844849
'allowInternalNamedArgumentsCalls' => 'allow_internal_named_arg_calls',
845850
'allowNamedArgumentCalls' => 'allow_named_arg_calls',
846851
'findUnusedPsalmSuppress' => 'find_unused_psalm_suppress',
852+
'reportInfo' => 'report_info',
847853
];
848854

849855
foreach ($booleanAttributes as $xmlName => $internalName) {
@@ -1604,7 +1610,7 @@ public function getReportingLevelForFile($issue_type, $file_path)
16041610
$issue_level = $issue_class::ERROR_LEVEL;
16051611

16061612
if ($issue_level > 0 && $issue_level < $this->level) {
1607-
return self::REPORT_INFO;
1613+
return $this->report_info ? self::REPORT_INFO : self::REPORT_SUPPRESS;
16081614
}
16091615

16101616
return self::REPORT_ERROR;

0 commit comments

Comments
 (0)