Skip to content

Commit 3214d57

Browse files
committed
disable rules
1 parent 963f2fa commit 3214d57

File tree

3 files changed

+20
-4
lines changed

3 files changed

+20
-4
lines changed

src/Analyzer/AnalyzeFileTask.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,12 @@ private function analyzeFile(string $filename): array
8989
private function shouldAnalyzeMissingDocBlocks(): bool
9090
{
9191
return
92-
$this->configDTO->only === []
93-
|| in_array($this->missingDocBlock->getName(), $this->configDTO->only, true);
92+
$this->configDTO->getAllowedTypes() === []
93+
|| in_array(
94+
$this->missingDocBlock->getName(),
95+
$this->configDTO->getAllowedTypes(),
96+
true
97+
);
9498
}
9599

96100
/**

src/Analyzer/AnalyzerFactory.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public function getAnalyzer(
2222
OutputInterface $output,
2323
BaselineStorageInterface $baselineStorage,
2424
): Analyzer {
25-
$commentFactory = new CommentFactory($configDto->only);
25+
$commentFactory = new CommentFactory($configDto->getAllowedTypes());
2626
$missingDocBlock = new MissingDocBlockAnalyzer($configDto->docblockConfigDTO);
2727
$cds = new CDS($configDto->thresholds, $commentFactory);
2828

src/Config/DTO/ConfigDTO.php

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,18 @@ public function __construct(
2626
public string $cacheDir = 'var/cache/comments-density',
2727
/** Disable certain types; set to empty array for full statistics */
2828
public array $disable = [],
29-
public array $only = [],
3029
) {}
30+
31+
public function getAllowedTypes(): array
32+
{
33+
$types = [
34+
'docBlock',
35+
'regular',
36+
'todo',
37+
'fixme',
38+
'missingDocBlock',
39+
];
40+
41+
return array_diff($types, $this->disable);
42+
}
3143
}

0 commit comments

Comments
 (0)