1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
namespace SavinMikhail\CommentsDensity\Baseline\Commands; |
6
|
|
|
|
7
|
|
|
use SavinMikhail\CommentsDensity\AnalyzeComments\Analyzer\AnalyzerFactory; |
|
|
|
|
8
|
|
|
use SavinMikhail\CommentsDensity\AnalyzeComments\Config\ConfigLoader; |
9
|
|
|
use SavinMikhail\CommentsDensity\Baseline\Storage\TreePhpBaselineStorage; |
10
|
|
|
use Symfony\Component\Console\Command\Command; |
11
|
|
|
use Symfony\Component\Console\Input\InputInterface; |
12
|
|
|
use Symfony\Component\Console\Output\OutputInterface; |
13
|
|
|
|
14
|
|
|
final class BaselineCommand extends Command |
15
|
|
|
{ |
16
|
|
|
public function __construct( |
17
|
|
|
private readonly ConfigLoader $configLoader = new ConfigLoader(), |
18
|
|
|
private readonly TreePhpBaselineStorage $storage = new TreePhpBaselineStorage(), |
19
|
|
|
private readonly AnalyzerFactory $analyzerFactory = new AnalyzerFactory(), |
20
|
|
|
?string $name = null, |
21
|
|
|
) { |
22
|
|
|
parent::__construct($name); |
23
|
|
|
} |
24
|
|
|
|
25
|
|
|
protected function configure(): void |
26
|
|
|
{ |
27
|
|
|
$this->setName('baseline') |
28
|
|
|
->setDescription('Generate a baseline of comments to ignore them in the future') |
29
|
|
|
->setHelp('This command allows you to ignore old tech debt and start this quality check from this point'); |
30
|
|
|
} |
31
|
|
|
|
32
|
|
|
protected function execute(InputInterface $input, OutputInterface $output): int |
33
|
|
|
{ |
34
|
|
|
$path = $this->configLoader->getProjectRoot() . '/baseline.php'; |
35
|
|
|
|
36
|
|
|
$this->storage->init($path); |
37
|
|
|
|
38
|
|
|
$configDto = $this->configLoader->getConfigDto(); |
39
|
|
|
|
40
|
|
|
$analyzer = $this->analyzerFactory->getAnalyzer($configDto, $this->storage); |
41
|
|
|
$report = $analyzer->analyze(); |
42
|
|
|
|
43
|
|
|
$this->storage->setComments($report->comments); // todo create some baseline reporter |
44
|
|
|
|
45
|
|
|
$output->writeln('<info>Baseline generated successfully!</info>'); |
46
|
|
|
|
47
|
|
|
return Command::SUCCESS; |
48
|
|
|
} |
49
|
|
|
} |
50
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths