diff --git a/Taskfile.yml b/Taskfile.yml index ca16cde..b5f5a3b 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -58,6 +58,12 @@ tasks: deps: [install] cmd: 'vendor/bin/composer-unused {{.CLI_ARGS}}' + run: + cmd: './bin/comments_density analyze:comments' + + base: + cmd: './bin/comments_density generate:baseline' + check: cmds: - task: cs diff --git a/bin/comments_density b/bin/comments_density index ddb0b84..6a06782 100755 --- a/bin/comments_density +++ b/bin/comments_density @@ -4,8 +4,8 @@ declare(strict_types=1); use Composer\XdebugHandler\XdebugHandler; -use SavinMikhail\CommentsDensity\Commands\AnalyzeCommentCommand; -use SavinMikhail\CommentsDensity\Commands\BaselineCommand; +use SavinMikhail\CommentsDensity\AnalyzeComments\Commands\AnalyzeCommentCommand; +use SavinMikhail\CommentsDensity\Baseline\Commands\BaselineCommand; use Symfony\Component\Console\Application; // Display all errors and warnings diff --git a/comments_density.php b/comments_density.php index 7b9b2a5..0592930 100644 --- a/comments_density.php +++ b/comments_density.php @@ -2,10 +2,9 @@ declare(strict_types=1); -use SavinMikhail\CommentsDensity\Config\DTO\ConfigDTO; -use SavinMikhail\CommentsDensity\Config\DTO\ConsoleOutputDTO; -use SavinMikhail\CommentsDensity\Config\DTO\MissingDocblockConfigDTO; -use SavinMikhail\CommentsDensity\Config\DTO\OutputDTO; +use SavinMikhail\CommentsDensity\AnalyzeComments\Config\DTO\ConfigDTO; +use SavinMikhail\CommentsDensity\AnalyzeComments\Config\DTO\ConsoleOutputDTO; +use SavinMikhail\CommentsDensity\AnalyzeComments\Config\DTO\MissingDocblockConfigDTO; return new ConfigDTO( thresholds: [ diff --git a/src/Analyzer/AnalyzeFileTask.php b/src/AnalyzeComments/Analyzer/AnalyzeFileTask.php similarity index 91% rename from src/Analyzer/AnalyzeFileTask.php rename to src/AnalyzeComments/Analyzer/AnalyzeFileTask.php index f9fde88..bf91282 100644 --- a/src/Analyzer/AnalyzeFileTask.php +++ b/src/AnalyzeComments/Analyzer/AnalyzeFileTask.php @@ -2,16 +2,15 @@ declare(strict_types=1); -namespace SavinMikhail\CommentsDensity\Analyzer; +namespace SavinMikhail\CommentsDensity\AnalyzeComments\Analyzer; -use SavinMikhail\CommentsDensity\Analyzer\DTO\Output\CommentDTO; -use SavinMikhail\CommentsDensity\Comments\CommentFactory; -use SavinMikhail\CommentsDensity\Config\DTO\ConfigDTO; -use SavinMikhail\CommentsDensity\MissingDocblock\MissingDocBlockAnalyzer; +use SavinMikhail\CommentsDensity\AnalyzeComments\Analyzer\DTO\Output\CommentDTO; +use SavinMikhail\CommentsDensity\AnalyzeComments\Comments\CommentFactory; +use SavinMikhail\CommentsDensity\AnalyzeComments\Config\DTO\ConfigDTO; +use SavinMikhail\CommentsDensity\AnalyzeComments\MissingDocblock\MissingDocBlockAnalyzer; use SplFileInfo; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Contracts\Cache\CacheInterface; - use function array_merge; use function count; use function file; @@ -19,7 +18,6 @@ use function in_array; use function is_array; use function token_get_all; - use const T_COMMENT; use const T_DOC_COMMENT; diff --git a/src/Analyzer/Analyzer.php b/src/AnalyzeComments/Analyzer/Analyzer.php similarity index 84% rename from src/Analyzer/Analyzer.php rename to src/AnalyzeComments/Analyzer/Analyzer.php index 770e1c3..596ebc4 100755 --- a/src/Analyzer/Analyzer.php +++ b/src/AnalyzeComments/Analyzer/Analyzer.php @@ -2,20 +2,19 @@ declare(strict_types=1); -namespace SavinMikhail\CommentsDensity\Analyzer; - -use SavinMikhail\CommentsDensity\Analyzer\DTO\Output\CommentDTO; -use SavinMikhail\CommentsDensity\Analyzer\DTO\Output\CommentStatisticsDTO; -use SavinMikhail\CommentsDensity\Analyzer\DTO\Output\OutputDTO; +namespace SavinMikhail\CommentsDensity\AnalyzeComments\Analyzer; + +use SavinMikhail\CommentsDensity\AnalyzeComments\Analyzer\DTO\Output\CommentDTO; +use SavinMikhail\CommentsDensity\AnalyzeComments\Analyzer\DTO\Output\CommentStatisticsDTO; +use SavinMikhail\CommentsDensity\AnalyzeComments\Analyzer\DTO\Output\OutputDTO; +use SavinMikhail\CommentsDensity\AnalyzeComments\Comments\CommentFactory; +use SavinMikhail\CommentsDensity\AnalyzeComments\Config\DTO\ConfigDTO; +use SavinMikhail\CommentsDensity\AnalyzeComments\Metrics\MetricsFacade; +use SavinMikhail\CommentsDensity\AnalyzeComments\MissingDocblock\MissingDocBlockAnalyzer; use SavinMikhail\CommentsDensity\Baseline\Storage\BaselineStorageInterface; -use SavinMikhail\CommentsDensity\Comments\CommentFactory; -use SavinMikhail\CommentsDensity\Config\DTO\ConfigDTO; -use SavinMikhail\CommentsDensity\Metrics\MetricsFacade; -use SavinMikhail\CommentsDensity\MissingDocblock\MissingDocBlockAnalyzer; use SplFileInfo; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Contracts\Cache\CacheInterface; - use function array_push; final class Analyzer diff --git a/src/Analyzer/AnalyzerFactory.php b/src/AnalyzeComments/Analyzer/AnalyzerFactory.php similarity index 67% rename from src/Analyzer/AnalyzerFactory.php rename to src/AnalyzeComments/Analyzer/AnalyzerFactory.php index 3abed0b..38c085e 100644 --- a/src/Analyzer/AnalyzerFactory.php +++ b/src/AnalyzeComments/Analyzer/AnalyzerFactory.php @@ -2,16 +2,16 @@ declare(strict_types=1); -namespace SavinMikhail\CommentsDensity\Analyzer; +namespace SavinMikhail\CommentsDensity\AnalyzeComments\Analyzer; +use SavinMikhail\CommentsDensity\AnalyzeComments\Comments\CommentFactory; +use SavinMikhail\CommentsDensity\AnalyzeComments\Config\DTO\ConfigDTO; +use SavinMikhail\CommentsDensity\AnalyzeComments\Metrics\CDS; +use SavinMikhail\CommentsDensity\AnalyzeComments\Metrics\ComToLoc; +use SavinMikhail\CommentsDensity\AnalyzeComments\Metrics\MetricsFacade; +use SavinMikhail\CommentsDensity\AnalyzeComments\Metrics\ResourceUtilization; +use SavinMikhail\CommentsDensity\AnalyzeComments\MissingDocblock\MissingDocBlockAnalyzer; use SavinMikhail\CommentsDensity\Baseline\Storage\BaselineStorageInterface; -use SavinMikhail\CommentsDensity\Comments\CommentFactory; -use SavinMikhail\CommentsDensity\Config\DTO\ConfigDTO; -use SavinMikhail\CommentsDensity\Metrics\CDS; -use SavinMikhail\CommentsDensity\Metrics\ComToLoc; -use SavinMikhail\CommentsDensity\Metrics\MetricsFacade; -use SavinMikhail\CommentsDensity\Metrics\ResourceUtilization; -use SavinMikhail\CommentsDensity\MissingDocblock\MissingDocBlockAnalyzer; use Symfony\Component\Cache\Adapter\FilesystemAdapter; use Symfony\Component\Console\Output\OutputInterface; diff --git a/src/Analyzer/CommentStatisticsAggregator.php b/src/AnalyzeComments/Analyzer/CommentStatisticsAggregator.php similarity index 82% rename from src/Analyzer/CommentStatisticsAggregator.php rename to src/AnalyzeComments/Analyzer/CommentStatisticsAggregator.php index 59a9967..4719642 100644 --- a/src/Analyzer/CommentStatisticsAggregator.php +++ b/src/AnalyzeComments/Analyzer/CommentStatisticsAggregator.php @@ -2,17 +2,15 @@ declare(strict_types=1); -namespace SavinMikhail\CommentsDensity\Analyzer; - -use SavinMikhail\CommentsDensity\Analyzer\DTO\Output\CommentDTO; -use SavinMikhail\CommentsDensity\Analyzer\DTO\Output\CommentStatisticsDTO; -use SavinMikhail\CommentsDensity\Comments\CommentFactory; -use SavinMikhail\CommentsDensity\Config\DTO\ConfigDTO; -use SavinMikhail\CommentsDensity\Exception\CommentsDensityException; -use SavinMikhail\CommentsDensity\MissingDocblock\MissingDocBlockAnalyzer; +namespace SavinMikhail\CommentsDensity\AnalyzeComments\Analyzer; +use SavinMikhail\CommentsDensity\AnalyzeComments\Analyzer\DTO\Output\CommentDTO; +use SavinMikhail\CommentsDensity\AnalyzeComments\Analyzer\DTO\Output\CommentStatisticsDTO; +use SavinMikhail\CommentsDensity\AnalyzeComments\Comments\CommentFactory; +use SavinMikhail\CommentsDensity\AnalyzeComments\Config\DTO\ConfigDTO; +use SavinMikhail\CommentsDensity\AnalyzeComments\Exception\CommentsDensityException; +use SavinMikhail\CommentsDensity\AnalyzeComments\MissingDocblock\MissingDocBlockAnalyzer; use function substr_count; - use const PHP_EOL; final readonly class CommentStatisticsAggregator diff --git a/src/Analyzer/DTO/Output/CdsDTO.php b/src/AnalyzeComments/Analyzer/DTO/Output/CdsDTO.php similarity index 68% rename from src/Analyzer/DTO/Output/CdsDTO.php rename to src/AnalyzeComments/Analyzer/DTO/Output/CdsDTO.php index 4d53c64..05934e7 100644 --- a/src/Analyzer/DTO/Output/CdsDTO.php +++ b/src/AnalyzeComments/Analyzer/DTO/Output/CdsDTO.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace SavinMikhail\CommentsDensity\Analyzer\DTO\Output; +namespace SavinMikhail\CommentsDensity\AnalyzeComments\Analyzer\DTO\Output; final readonly class CdsDTO { diff --git a/src/Analyzer/DTO/Output/ComToLocDTO.php b/src/AnalyzeComments/Analyzer/DTO/Output/ComToLocDTO.php similarity index 69% rename from src/Analyzer/DTO/Output/ComToLocDTO.php rename to src/AnalyzeComments/Analyzer/DTO/Output/ComToLocDTO.php index 2dbb8f9..e72dc6a 100644 --- a/src/Analyzer/DTO/Output/ComToLocDTO.php +++ b/src/AnalyzeComments/Analyzer/DTO/Output/ComToLocDTO.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace SavinMikhail\CommentsDensity\Analyzer\DTO\Output; +namespace SavinMikhail\CommentsDensity\AnalyzeComments\Analyzer\DTO\Output; final readonly class ComToLocDTO { diff --git a/src/Analyzer/DTO/Output/CommentDTO.php b/src/AnalyzeComments/Analyzer/DTO/Output/CommentDTO.php similarity index 87% rename from src/Analyzer/DTO/Output/CommentDTO.php rename to src/AnalyzeComments/Analyzer/DTO/Output/CommentDTO.php index 3954c9e..64dcf4e 100644 --- a/src/Analyzer/DTO/Output/CommentDTO.php +++ b/src/AnalyzeComments/Analyzer/DTO/Output/CommentDTO.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace SavinMikhail\CommentsDensity\Analyzer\DTO\Output; +namespace SavinMikhail\CommentsDensity\AnalyzeComments\Analyzer\DTO\Output; final readonly class CommentDTO { diff --git a/src/Analyzer/DTO/Output/CommentStatisticsDTO.php b/src/AnalyzeComments/Analyzer/DTO/Output/CommentStatisticsDTO.php similarity index 77% rename from src/Analyzer/DTO/Output/CommentStatisticsDTO.php rename to src/AnalyzeComments/Analyzer/DTO/Output/CommentStatisticsDTO.php index afe5028..a5bd2c3 100644 --- a/src/Analyzer/DTO/Output/CommentStatisticsDTO.php +++ b/src/AnalyzeComments/Analyzer/DTO/Output/CommentStatisticsDTO.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace SavinMikhail\CommentsDensity\Analyzer\DTO\Output; +namespace SavinMikhail\CommentsDensity\AnalyzeComments\Analyzer\DTO\Output; final readonly class CommentStatisticsDTO { diff --git a/src/Analyzer/DTO/Output/OutputDTO.php b/src/AnalyzeComments/Analyzer/DTO/Output/OutputDTO.php similarity index 86% rename from src/Analyzer/DTO/Output/OutputDTO.php rename to src/AnalyzeComments/Analyzer/DTO/Output/OutputDTO.php index e36ba52..da13969 100644 --- a/src/Analyzer/DTO/Output/OutputDTO.php +++ b/src/AnalyzeComments/Analyzer/DTO/Output/OutputDTO.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace SavinMikhail\CommentsDensity\Analyzer\DTO\Output; +namespace SavinMikhail\CommentsDensity\AnalyzeComments\Analyzer\DTO\Output; final readonly class OutputDTO { diff --git a/src/Analyzer/DTO/Output/PerformanceMetricsDTO.php b/src/AnalyzeComments/Analyzer/DTO/Output/PerformanceMetricsDTO.php similarity index 72% rename from src/Analyzer/DTO/Output/PerformanceMetricsDTO.php rename to src/AnalyzeComments/Analyzer/DTO/Output/PerformanceMetricsDTO.php index 102d072..4d93fbb 100644 --- a/src/Analyzer/DTO/Output/PerformanceMetricsDTO.php +++ b/src/AnalyzeComments/Analyzer/DTO/Output/PerformanceMetricsDTO.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace SavinMikhail\CommentsDensity\Analyzer\DTO\Output; +namespace SavinMikhail\CommentsDensity\AnalyzeComments\Analyzer\DTO\Output; final readonly class PerformanceMetricsDTO { diff --git a/src/Commands/AnalyzeCommentCommand.php b/src/AnalyzeComments/Commands/AnalyzeCommentCommand.php similarity index 52% rename from src/Commands/AnalyzeCommentCommand.php rename to src/AnalyzeComments/Commands/AnalyzeCommentCommand.php index f80ea92..4375328 100755 --- a/src/Commands/AnalyzeCommentCommand.php +++ b/src/AnalyzeComments/Commands/AnalyzeCommentCommand.php @@ -2,12 +2,18 @@ declare(strict_types=1); -namespace SavinMikhail\CommentsDensity\Commands; +namespace SavinMikhail\CommentsDensity\AnalyzeComments\Commands; -use SavinMikhail\CommentsDensity\Analyzer\AnalyzerFactory; +use RecursiveDirectoryIterator; +use RecursiveIteratorIterator; +use SavinMikhail\CommentsDensity\AnalyzeComments\Analyzer\AnalyzerFactory; +use SavinMikhail\CommentsDensity\AnalyzeComments\Config\ConfigLoader; +use SavinMikhail\CommentsDensity\AnalyzeComments\Config\DTO\ConfigDTO; +use SavinMikhail\CommentsDensity\AnalyzeComments\Exception\CommentsDensityException; +use SavinMikhail\CommentsDensity\AnalyzeComments\Reporters\ReporterFactory; use SavinMikhail\CommentsDensity\Baseline\Storage\TreePhpBaselineStorage; -use SavinMikhail\CommentsDensity\Reporters\ReporterFactory; -use Symfony\Component\Console\Command\Command as SymfonyCommand; +use SplFileInfo; +use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; @@ -22,14 +28,15 @@ protected function configure(): void protected function execute(InputInterface $input, OutputInterface $output): int { - $path = __DIR__ . '/../../baseline.php'; + $configLoader = new ConfigLoader(); + $path = $configLoader->getProjectRoot() . '/baseline.php'; $storage = new TreePhpBaselineStorage(); $storage->init($path); - $configDto = $this->getConfigDto(); - + $configDto = $configLoader->getConfigDto(); $files = $this->getFilesFromDirectories($configDto->directories); + $reporter = (new ReporterFactory())->createReporter($output, $configDto); $analyzerFactory = new AnalyzerFactory(); @@ -42,10 +49,24 @@ protected function execute(InputInterface $input, OutputInterface $output): int if ($outputDTO->exceedThreshold) { $output->writeln('Comment thresholds were exceeded!'); - return SymfonyCommand::FAILURE; + return Command::FAILURE; } $output->writeln('Comment thresholds are passed!'); - return SymfonyCommand::SUCCESS; + return Command::SUCCESS; + } + + /** + * @param string[] $directories + * @return SplFileInfo[] + */ + protected function getFilesFromDirectories(array $directories): iterable + { + foreach ($directories as $directory) { + $iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($directory)); + foreach ($iterator as $file) { + yield $file; + } + } } } diff --git a/src/Comments/Comment.php b/src/AnalyzeComments/Comments/Comment.php similarity index 96% rename from src/Comments/Comment.php rename to src/AnalyzeComments/Comments/Comment.php index c9c612a..1fdc921 100644 --- a/src/Comments/Comment.php +++ b/src/AnalyzeComments/Comments/Comment.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace SavinMikhail\CommentsDensity\Comments; +namespace SavinMikhail\CommentsDensity\AnalyzeComments\Comments; use Stringable; diff --git a/src/Comments/CommentConstantsInterface.php b/src/AnalyzeComments/Comments/CommentConstantsInterface.php similarity index 78% rename from src/Comments/CommentConstantsInterface.php rename to src/AnalyzeComments/Comments/CommentConstantsInterface.php index 611e06d..328864e 100644 --- a/src/Comments/CommentConstantsInterface.php +++ b/src/AnalyzeComments/Comments/CommentConstantsInterface.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace SavinMikhail\CommentsDensity\Comments; +namespace SavinMikhail\CommentsDensity\AnalyzeComments\Comments; interface CommentConstantsInterface { diff --git a/src/Comments/CommentFactory.php b/src/AnalyzeComments/Comments/CommentFactory.php similarity index 95% rename from src/Comments/CommentFactory.php rename to src/AnalyzeComments/Comments/CommentFactory.php index f526cd1..78fd47f 100644 --- a/src/Comments/CommentFactory.php +++ b/src/AnalyzeComments/Comments/CommentFactory.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace SavinMikhail\CommentsDensity\Comments; +namespace SavinMikhail\CommentsDensity\AnalyzeComments\Comments; use function in_array; diff --git a/src/Comments/CommentTypeInterface.php b/src/AnalyzeComments/Comments/CommentTypeInterface.php similarity index 86% rename from src/Comments/CommentTypeInterface.php rename to src/AnalyzeComments/Comments/CommentTypeInterface.php index 806dce1..7f7fdc9 100644 --- a/src/Comments/CommentTypeInterface.php +++ b/src/AnalyzeComments/Comments/CommentTypeInterface.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace SavinMikhail\CommentsDensity\Comments; +namespace SavinMikhail\CommentsDensity\AnalyzeComments\Comments; interface CommentTypeInterface { diff --git a/src/Comments/DocBlockComment.php b/src/AnalyzeComments/Comments/DocBlockComment.php similarity index 82% rename from src/Comments/DocBlockComment.php rename to src/AnalyzeComments/Comments/DocBlockComment.php index d8d6e7d..c3b8f35 100644 --- a/src/Comments/DocBlockComment.php +++ b/src/AnalyzeComments/Comments/DocBlockComment.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace SavinMikhail\CommentsDensity\Comments; +namespace SavinMikhail\CommentsDensity\AnalyzeComments\Comments; final class DocBlockComment extends Comment { diff --git a/src/Comments/FixMeComment.php b/src/AnalyzeComments/Comments/FixMeComment.php similarity index 81% rename from src/Comments/FixMeComment.php rename to src/AnalyzeComments/Comments/FixMeComment.php index a711430..f2aba1a 100644 --- a/src/Comments/FixMeComment.php +++ b/src/AnalyzeComments/Comments/FixMeComment.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace SavinMikhail\CommentsDensity\Comments; +namespace SavinMikhail\CommentsDensity\AnalyzeComments\Comments; final class FixMeComment extends Comment { diff --git a/src/Comments/LicenseComment.php b/src/AnalyzeComments/Comments/LicenseComment.php similarity index 82% rename from src/Comments/LicenseComment.php rename to src/AnalyzeComments/Comments/LicenseComment.php index e5b0b93..bc6b208 100644 --- a/src/Comments/LicenseComment.php +++ b/src/AnalyzeComments/Comments/LicenseComment.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace SavinMikhail\CommentsDensity\Comments; +namespace SavinMikhail\CommentsDensity\AnalyzeComments\Comments; final class LicenseComment extends Comment { diff --git a/src/Comments/RegularComment.php b/src/AnalyzeComments/Comments/RegularComment.php similarity index 86% rename from src/Comments/RegularComment.php rename to src/AnalyzeComments/Comments/RegularComment.php index ece48a2..cf4cfd1 100644 --- a/src/Comments/RegularComment.php +++ b/src/AnalyzeComments/Comments/RegularComment.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace SavinMikhail\CommentsDensity\Comments; +namespace SavinMikhail\CommentsDensity\AnalyzeComments\Comments; final class RegularComment extends Comment { diff --git a/src/Comments/TodoComment.php b/src/AnalyzeComments/Comments/TodoComment.php similarity index 81% rename from src/Comments/TodoComment.php rename to src/AnalyzeComments/Comments/TodoComment.php index a29c2c7..f23d55c 100644 --- a/src/Comments/TodoComment.php +++ b/src/AnalyzeComments/Comments/TodoComment.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace SavinMikhail\CommentsDensity\Comments; +namespace SavinMikhail\CommentsDensity\AnalyzeComments\Comments; final class TodoComment extends Comment { diff --git a/src/Config/ConfigLoader.php b/src/AnalyzeComments/Config/ConfigLoader.php similarity index 81% rename from src/Config/ConfigLoader.php rename to src/AnalyzeComments/Config/ConfigLoader.php index 2b42698..df26a80 100644 --- a/src/Config/ConfigLoader.php +++ b/src/AnalyzeComments/Config/ConfigLoader.php @@ -2,21 +2,19 @@ declare(strict_types=1); -namespace SavinMikhail\CommentsDensity\Config; - -use SavinMikhail\CommentsDensity\Config\DTO\ConfigDTO; -use SavinMikhail\CommentsDensity\Exception\CommentsDensityException; +namespace SavinMikhail\CommentsDensity\AnalyzeComments\Config; +use SavinMikhail\CommentsDensity\AnalyzeComments\Config\DTO\ConfigDTO; +use SavinMikhail\CommentsDensity\AnalyzeComments\Exception\CommentsDensityException; use function defined; use function dirname; use function file_exists; - use const DIRECTORY_SEPARATOR; final readonly class ConfigLoader { private const CONFIG_FILE = 'comments_density.php'; - private const DIR_LEVEL = COMMENTS_DENSITY_ENVIRONMENT === 'dev' ? 2 : 5; + private const DIR_LEVEL = COMMENTS_DENSITY_ENVIRONMENT === 'dev' ? 3 : 6; /** * @throws CommentsDensityException @@ -46,7 +44,7 @@ public function getConfigDto(): ConfigDTO return $config; } - private function getProjectRoot(): string + public function getProjectRoot(): string { return dirname(__DIR__, self::DIR_LEVEL); } diff --git a/src/Config/DTO/ConfigDTO.php b/src/AnalyzeComments/Config/DTO/ConfigDTO.php similarity index 94% rename from src/Config/DTO/ConfigDTO.php rename to src/AnalyzeComments/Config/DTO/ConfigDTO.php index e213436..7607a08 100644 --- a/src/Config/DTO/ConfigDTO.php +++ b/src/AnalyzeComments/Config/DTO/ConfigDTO.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace SavinMikhail\CommentsDensity\Config\DTO; +namespace SavinMikhail\CommentsDensity\AnalyzeComments\Config\DTO; final readonly class ConfigDTO { diff --git a/src/Config/DTO/ConsoleOutputDTO.php b/src/AnalyzeComments/Config/DTO/ConsoleOutputDTO.php similarity index 79% rename from src/Config/DTO/ConsoleOutputDTO.php rename to src/AnalyzeComments/Config/DTO/ConsoleOutputDTO.php index b41ed21..2702deb 100644 --- a/src/Config/DTO/ConsoleOutputDTO.php +++ b/src/AnalyzeComments/Config/DTO/ConsoleOutputDTO.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace SavinMikhail\CommentsDensity\Config\DTO; +namespace SavinMikhail\CommentsDensity\AnalyzeComments\Config\DTO; final readonly class ConsoleOutputDTO extends OutputDTO { diff --git a/src/Config/DTO/HtmlOutputDTO.php b/src/AnalyzeComments/Config/DTO/HtmlOutputDTO.php similarity index 84% rename from src/Config/DTO/HtmlOutputDTO.php rename to src/AnalyzeComments/Config/DTO/HtmlOutputDTO.php index b46d12e..f1cc85d 100644 --- a/src/Config/DTO/HtmlOutputDTO.php +++ b/src/AnalyzeComments/Config/DTO/HtmlOutputDTO.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace SavinMikhail\CommentsDensity\Config\DTO; +namespace SavinMikhail\CommentsDensity\AnalyzeComments\Config\DTO; final readonly class HtmlOutputDTO extends OutputDTO { diff --git a/src/Config/DTO/MissingDocblockConfigDTO.php b/src/AnalyzeComments/Config/DTO/MissingDocblockConfigDTO.php similarity index 85% rename from src/Config/DTO/MissingDocblockConfigDTO.php rename to src/AnalyzeComments/Config/DTO/MissingDocblockConfigDTO.php index 46f65c2..f374a5c 100644 --- a/src/Config/DTO/MissingDocblockConfigDTO.php +++ b/src/AnalyzeComments/Config/DTO/MissingDocblockConfigDTO.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace SavinMikhail\CommentsDensity\Config\DTO; +namespace SavinMikhail\CommentsDensity\AnalyzeComments\Config\DTO; final readonly class MissingDocblockConfigDTO { diff --git a/src/Config/DTO/OutputDTO.php b/src/AnalyzeComments/Config/DTO/OutputDTO.php similarity index 78% rename from src/Config/DTO/OutputDTO.php rename to src/AnalyzeComments/Config/DTO/OutputDTO.php index d47a51a..c619866 100644 --- a/src/Config/DTO/OutputDTO.php +++ b/src/AnalyzeComments/Config/DTO/OutputDTO.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace SavinMikhail\CommentsDensity\Config\DTO; +namespace SavinMikhail\CommentsDensity\AnalyzeComments\Config\DTO; abstract readonly class OutputDTO { diff --git a/src/Exception/CommentsDensityException.php b/src/AnalyzeComments/Exception/CommentsDensityException.php similarity index 62% rename from src/Exception/CommentsDensityException.php rename to src/AnalyzeComments/Exception/CommentsDensityException.php index d308255..fae99b8 100644 --- a/src/Exception/CommentsDensityException.php +++ b/src/AnalyzeComments/Exception/CommentsDensityException.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace SavinMikhail\CommentsDensity\Exception; +namespace SavinMikhail\CommentsDensity\AnalyzeComments\Exception; use Exception; diff --git a/src/Metrics/CDS.php b/src/AnalyzeComments/Metrics/CDS.php similarity index 91% rename from src/Metrics/CDS.php rename to src/AnalyzeComments/Metrics/CDS.php index 29bf58d..197b0bb 100644 --- a/src/Metrics/CDS.php +++ b/src/AnalyzeComments/Metrics/CDS.php @@ -2,14 +2,13 @@ declare(strict_types=1); -namespace SavinMikhail\CommentsDensity\Metrics; +namespace SavinMikhail\CommentsDensity\AnalyzeComments\Metrics; use InvalidArgumentException; use Mikhail\PrimitiveWrappers\Int\Integer; -use SavinMikhail\CommentsDensity\Analyzer\DTO\Output\CdsDTO; -use SavinMikhail\CommentsDensity\Analyzer\DTO\Output\CommentStatisticsDTO; -use SavinMikhail\CommentsDensity\Comments\CommentFactory; - +use SavinMikhail\CommentsDensity\AnalyzeComments\Analyzer\DTO\Output\CdsDTO; +use SavinMikhail\CommentsDensity\AnalyzeComments\Analyzer\DTO\Output\CommentStatisticsDTO; +use SavinMikhail\CommentsDensity\AnalyzeComments\Comments\CommentFactory; use function in_array; use function round; diff --git a/src/Metrics/ComToLoc.php b/src/AnalyzeComments/Metrics/ComToLoc.php similarity index 85% rename from src/Metrics/ComToLoc.php rename to src/AnalyzeComments/Metrics/ComToLoc.php index 225f095..e6ddcd4 100644 --- a/src/Metrics/ComToLoc.php +++ b/src/AnalyzeComments/Metrics/ComToLoc.php @@ -2,11 +2,10 @@ declare(strict_types=1); -namespace SavinMikhail\CommentsDensity\Metrics; - -use SavinMikhail\CommentsDensity\Analyzer\DTO\Output\CommentStatisticsDTO; -use SavinMikhail\CommentsDensity\Analyzer\DTO\Output\ComToLocDTO; +namespace SavinMikhail\CommentsDensity\AnalyzeComments\Metrics; +use SavinMikhail\CommentsDensity\AnalyzeComments\Analyzer\DTO\Output\CommentStatisticsDTO; +use SavinMikhail\CommentsDensity\AnalyzeComments\Analyzer\DTO\Output\ComToLocDTO; use function round; final class ComToLoc diff --git a/src/Metrics/MetricsFacade.php b/src/AnalyzeComments/Metrics/MetricsFacade.php similarity index 76% rename from src/Metrics/MetricsFacade.php rename to src/AnalyzeComments/Metrics/MetricsFacade.php index 6af5607..4b04f9b 100644 --- a/src/Metrics/MetricsFacade.php +++ b/src/AnalyzeComments/Metrics/MetricsFacade.php @@ -2,12 +2,12 @@ declare(strict_types=1); -namespace SavinMikhail\CommentsDensity\Metrics; +namespace SavinMikhail\CommentsDensity\AnalyzeComments\Metrics; -use SavinMikhail\CommentsDensity\Analyzer\DTO\Output\CdsDTO; -use SavinMikhail\CommentsDensity\Analyzer\DTO\Output\CommentStatisticsDTO; -use SavinMikhail\CommentsDensity\Analyzer\DTO\Output\ComToLocDTO; -use SavinMikhail\CommentsDensity\Analyzer\DTO\Output\PerformanceMetricsDTO; +use SavinMikhail\CommentsDensity\AnalyzeComments\Analyzer\DTO\Output\CdsDTO; +use SavinMikhail\CommentsDensity\AnalyzeComments\Analyzer\DTO\Output\CommentStatisticsDTO; +use SavinMikhail\CommentsDensity\AnalyzeComments\Analyzer\DTO\Output\ComToLocDTO; +use SavinMikhail\CommentsDensity\AnalyzeComments\Analyzer\DTO\Output\PerformanceMetricsDTO; final readonly class MetricsFacade { diff --git a/src/Metrics/ResourceUtilization.php b/src/AnalyzeComments/Metrics/ResourceUtilization.php similarity index 86% rename from src/Metrics/ResourceUtilization.php rename to src/AnalyzeComments/Metrics/ResourceUtilization.php index 7aae8b8..7af7fb9 100644 --- a/src/Metrics/ResourceUtilization.php +++ b/src/AnalyzeComments/Metrics/ResourceUtilization.php @@ -2,10 +2,9 @@ declare(strict_types=1); -namespace SavinMikhail\CommentsDensity\Metrics; - -use SavinMikhail\CommentsDensity\Analyzer\DTO\Output\PerformanceMetricsDTO; +namespace SavinMikhail\CommentsDensity\AnalyzeComments\Metrics; +use SavinMikhail\CommentsDensity\AnalyzeComments\Analyzer\DTO\Output\PerformanceMetricsDTO; use function memory_get_peak_usage; use function microtime; use function round; diff --git a/src/MissingDocblock/MissingDocBlockAnalyzer.php b/src/AnalyzeComments/MissingDocblock/MissingDocBlockAnalyzer.php similarity index 83% rename from src/MissingDocblock/MissingDocBlockAnalyzer.php rename to src/AnalyzeComments/MissingDocblock/MissingDocBlockAnalyzer.php index f1d87be..15df3ed 100644 --- a/src/MissingDocblock/MissingDocBlockAnalyzer.php +++ b/src/AnalyzeComments/MissingDocblock/MissingDocBlockAnalyzer.php @@ -2,15 +2,15 @@ declare(strict_types=1); -namespace SavinMikhail\CommentsDensity\MissingDocblock; +namespace SavinMikhail\CommentsDensity\AnalyzeComments\MissingDocblock; use PhpParser\NodeTraverser; use PhpParser\NodeVisitor\NameResolver; use PhpParser\ParserFactory; -use SavinMikhail\CommentsDensity\Analyzer\DTO\Output\CommentDTO; -use SavinMikhail\CommentsDensity\Config\DTO\MissingDocblockConfigDTO; -use SavinMikhail\CommentsDensity\MissingDocblock\Visitors\Checkers\NodeNeedsDocblockChecker; -use SavinMikhail\CommentsDensity\MissingDocblock\Visitors\MissingDocBlockVisitor; +use SavinMikhail\CommentsDensity\AnalyzeComments\Analyzer\DTO\Output\CommentDTO; +use SavinMikhail\CommentsDensity\AnalyzeComments\Config\DTO\MissingDocblockConfigDTO; +use SavinMikhail\CommentsDensity\AnalyzeComments\MissingDocblock\Visitors\Checkers\NodeNeedsDocblockChecker; +use SavinMikhail\CommentsDensity\AnalyzeComments\MissingDocblock\Visitors\MissingDocBlockVisitor; final class MissingDocBlockAnalyzer { diff --git a/src/MissingDocblock/Visitors/Checkers/NodeNeedsDocblockChecker.php b/src/AnalyzeComments/MissingDocblock/Visitors/Checkers/NodeNeedsDocblockChecker.php similarity index 92% rename from src/MissingDocblock/Visitors/Checkers/NodeNeedsDocblockChecker.php rename to src/AnalyzeComments/MissingDocblock/Visitors/Checkers/NodeNeedsDocblockChecker.php index 7aca84b..fce5a49 100644 --- a/src/MissingDocblock/Visitors/Checkers/NodeNeedsDocblockChecker.php +++ b/src/AnalyzeComments/MissingDocblock/Visitors/Checkers/NodeNeedsDocblockChecker.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace SavinMikhail\CommentsDensity\MissingDocblock\Visitors\Checkers; +namespace SavinMikhail\CommentsDensity\AnalyzeComments\MissingDocblock\Visitors\Checkers; use PhpParser\Node; use PhpParser\Node\Stmt\Class_; @@ -13,7 +13,7 @@ use PhpParser\Node\Stmt\Interface_; use PhpParser\Node\Stmt\Property; use PhpParser\Node\Stmt\Trait_; -use SavinMikhail\CommentsDensity\Config\DTO\MissingDocblockConfigDTO; +use SavinMikhail\CommentsDensity\AnalyzeComments\Config\DTO\MissingDocblockConfigDTO; final readonly class NodeNeedsDocblockChecker { diff --git a/src/MissingDocblock/Visitors/MissingDocBlockVisitor.php b/src/AnalyzeComments/MissingDocblock/Visitors/MissingDocBlockVisitor.php similarity index 72% rename from src/MissingDocblock/Visitors/MissingDocBlockVisitor.php rename to src/AnalyzeComments/MissingDocblock/Visitors/MissingDocBlockVisitor.php index ede74ba..5d15b10 100644 --- a/src/MissingDocblock/Visitors/MissingDocBlockVisitor.php +++ b/src/AnalyzeComments/MissingDocblock/Visitors/MissingDocBlockVisitor.php @@ -2,13 +2,13 @@ declare(strict_types=1); -namespace SavinMikhail\CommentsDensity\MissingDocblock\Visitors; +namespace SavinMikhail\CommentsDensity\AnalyzeComments\MissingDocblock\Visitors; use PhpParser\Node; use PhpParser\NodeVisitorAbstract; -use SavinMikhail\CommentsDensity\Analyzer\DTO\Output\CommentDTO; -use SavinMikhail\CommentsDensity\MissingDocblock\MissingDocBlockAnalyzer; -use SavinMikhail\CommentsDensity\MissingDocblock\Visitors\Checkers\NodeNeedsDocblockChecker; +use SavinMikhail\CommentsDensity\AnalyzeComments\Analyzer\DTO\Output\CommentDTO; +use SavinMikhail\CommentsDensity\AnalyzeComments\MissingDocblock\MissingDocBlockAnalyzer; +use SavinMikhail\CommentsDensity\AnalyzeComments\MissingDocblock\Visitors\Checkers\NodeNeedsDocblockChecker; final class MissingDocBlockVisitor extends NodeVisitorAbstract { diff --git a/src/Reporters/ConsoleReporter.php b/src/AnalyzeComments/Reporters/ConsoleReporter.php similarity index 81% rename from src/Reporters/ConsoleReporter.php rename to src/AnalyzeComments/Reporters/ConsoleReporter.php index 12d888a..b7db2ee 100644 --- a/src/Reporters/ConsoleReporter.php +++ b/src/AnalyzeComments/Reporters/ConsoleReporter.php @@ -2,17 +2,16 @@ declare(strict_types=1); -namespace SavinMikhail\CommentsDensity\Reporters; +namespace SavinMikhail\CommentsDensity\AnalyzeComments\Reporters; -use SavinMikhail\CommentsDensity\Analyzer\DTO\Output\CdsDTO; -use SavinMikhail\CommentsDensity\Analyzer\DTO\Output\CommentDTO; -use SavinMikhail\CommentsDensity\Analyzer\DTO\Output\CommentStatisticsDTO; -use SavinMikhail\CommentsDensity\Analyzer\DTO\Output\ComToLocDTO; -use SavinMikhail\CommentsDensity\Analyzer\DTO\Output\OutputDTO; -use SavinMikhail\CommentsDensity\Analyzer\DTO\Output\PerformanceMetricsDTO; +use SavinMikhail\CommentsDensity\AnalyzeComments\Analyzer\DTO\Output\CdsDTO; +use SavinMikhail\CommentsDensity\AnalyzeComments\Analyzer\DTO\Output\CommentDTO; +use SavinMikhail\CommentsDensity\AnalyzeComments\Analyzer\DTO\Output\CommentStatisticsDTO; +use SavinMikhail\CommentsDensity\AnalyzeComments\Analyzer\DTO\Output\ComToLocDTO; +use SavinMikhail\CommentsDensity\AnalyzeComments\Analyzer\DTO\Output\OutputDTO; +use SavinMikhail\CommentsDensity\AnalyzeComments\Analyzer\DTO\Output\PerformanceMetricsDTO; use Symfony\Component\Console\Helper\Table; use Symfony\Component\Console\Output\OutputInterface; - use function array_map; final readonly class ConsoleReporter implements ReporterInterface diff --git a/src/Reporters/HtmlReporter.php b/src/AnalyzeComments/Reporters/HtmlReporter.php similarity index 96% rename from src/Reporters/HtmlReporter.php rename to src/AnalyzeComments/Reporters/HtmlReporter.php index 602783f..e9cde6a 100644 --- a/src/Reporters/HtmlReporter.php +++ b/src/AnalyzeComments/Reporters/HtmlReporter.php @@ -2,14 +2,12 @@ declare(strict_types=1); -namespace SavinMikhail\CommentsDensity\Reporters; - -use SavinMikhail\CommentsDensity\Analyzer\DTO\Output\OutputDTO; +namespace SavinMikhail\CommentsDensity\AnalyzeComments\Reporters; +use SavinMikhail\CommentsDensity\AnalyzeComments\Analyzer\DTO\Output\OutputDTO; use function file_put_contents; use function htmlspecialchars; use function nl2br; - use const ENT_QUOTES; use const ENT_SUBSTITUTE; diff --git a/src/Reporters/ReporterFactory.php b/src/AnalyzeComments/Reporters/ReporterFactory.php similarity index 75% rename from src/Reporters/ReporterFactory.php rename to src/AnalyzeComments/Reporters/ReporterFactory.php index 7b68774..8d7b3fa 100644 --- a/src/Reporters/ReporterFactory.php +++ b/src/AnalyzeComments/Reporters/ReporterFactory.php @@ -2,9 +2,9 @@ declare(strict_types=1); -namespace SavinMikhail\CommentsDensity\Reporters; +namespace SavinMikhail\CommentsDensity\AnalyzeComments\Reporters; -use SavinMikhail\CommentsDensity\Config\DTO\ConfigDTO; +use SavinMikhail\CommentsDensity\AnalyzeComments\Config\DTO\ConfigDTO; use Symfony\Component\Console\Output\OutputInterface; final readonly class ReporterFactory diff --git a/src/AnalyzeComments/Reporters/ReporterInterface.php b/src/AnalyzeComments/Reporters/ReporterInterface.php new file mode 100644 index 0000000..4fb05fc --- /dev/null +++ b/src/AnalyzeComments/Reporters/ReporterInterface.php @@ -0,0 +1,12 @@ +getProjectRoot() . '/baseline.php'; $storage = new TreePhpBaselineStorage(); - $storage->init($path); - $configDto = $this->getConfigDto(); + $storage->init($path); + $configDto = $configLoader->getConfigDto(); $files = $this->getFilesFromDirectories($configDto->directories); + $analyzerFactory = new AnalyzerFactory(); $analyzer = $analyzerFactory->getAnalyzer($configDto, $output, $storage); @@ -38,6 +46,20 @@ protected function execute(InputInterface $input, OutputInterface $output): int $output->writeln('Baseline generated successfully!'); - return SymfonyCommand::SUCCESS; + return Command::SUCCESS; + } + + /** + * @param string[] $directories + * @return SplFileInfo[] + */ + protected function getFilesFromDirectories(array $directories): iterable + { + foreach ($directories as $directory) { + $iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($directory)); + foreach ($iterator as $file) { + yield $file; + } + } } } diff --git a/src/Baseline/Storage/BaselineStorageInterface.php b/src/Baseline/Storage/BaselineStorageInterface.php index 8acadf3..3572008 100644 --- a/src/Baseline/Storage/BaselineStorageInterface.php +++ b/src/Baseline/Storage/BaselineStorageInterface.php @@ -4,7 +4,7 @@ namespace SavinMikhail\CommentsDensity\Baseline\Storage; -use SavinMikhail\CommentsDensity\Analyzer\DTO\Output\CommentDTO; +use SavinMikhail\CommentsDensity\AnalyzeComments\Analyzer\DTO\Output\CommentDTO; interface BaselineStorageInterface { diff --git a/src/Baseline/Storage/TreePhpBaselineStorage.php b/src/Baseline/Storage/TreePhpBaselineStorage.php index fb679e1..634ebcd 100644 --- a/src/Baseline/Storage/TreePhpBaselineStorage.php +++ b/src/Baseline/Storage/TreePhpBaselineStorage.php @@ -4,8 +4,7 @@ namespace SavinMikhail\CommentsDensity\Baseline\Storage; -use SavinMikhail\CommentsDensity\Analyzer\DTO\Output\CommentDTO; - +use SavinMikhail\CommentsDensity\AnalyzeComments\Analyzer\DTO\Output\CommentDTO; use const DIRECTORY_SEPARATOR; final class TreePhpBaselineStorage implements BaselineStorageInterface diff --git a/src/Commands/Command.php b/src/Commands/Command.php deleted file mode 100644 index a7a218d..0000000 --- a/src/Commands/Command.php +++ /dev/null @@ -1,38 +0,0 @@ -getConfigDto(); - } - - /** - * @param string[] $directories - * @return SplFileInfo[] - */ - protected function getFilesFromDirectories(array $directories): iterable - { - foreach ($directories as $directory) { - $iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($directory)); - foreach ($iterator as $file) { - yield $file; - } - } - } -} diff --git a/src/Composer/CommentsDensityPlugin.php b/src/ComposerPlugin/CommentsDensityPlugin.php similarity index 98% rename from src/Composer/CommentsDensityPlugin.php rename to src/ComposerPlugin/CommentsDensityPlugin.php index 19cbd72..16d7f14 100644 --- a/src/Composer/CommentsDensityPlugin.php +++ b/src/ComposerPlugin/CommentsDensityPlugin.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace SavinMikhail\CommentsDensity\Composer; +namespace SavinMikhail\CommentsDensity\ComposerPlugin; use Composer\Composer; use Composer\EventDispatcher\EventSubscriberInterface; diff --git a/src/Reporters/ReporterInterface.php b/src/Reporters/ReporterInterface.php deleted file mode 100644 index 084fb7c..0000000 --- a/src/Reporters/ReporterInterface.php +++ /dev/null @@ -1,12 +0,0 @@ -cacheDir = $this->tempCacheDir; $configDto->directories = [__DIR__]; $configDto->exclude = []; - $configDto->output = new \SavinMikhail\CommentsDensity\Config\DTO\OutputDTO('console', ''); + $configDto->output = new \SavinMikhail\CommentsDensity\AnalyzeComments\Config\DTO\OutputDTO('console', ''); $configDto->useBaseline = false; $baselineStorage = $this->createMock(TreePhpBaselineStorage::class); diff --git a/tests/Comments/CommentTest.php b/tests/Comments/CommentTest.php index 87057f8..7be59fe 100755 --- a/tests/Comments/CommentTest.php +++ b/tests/Comments/CommentTest.php @@ -7,13 +7,13 @@ use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use ReflectionClass; -use SavinMikhail\CommentsDensity\Comments\Comment; -use SavinMikhail\CommentsDensity\Comments\CommentFactory; -use SavinMikhail\CommentsDensity\Comments\DocBlockComment; -use SavinMikhail\CommentsDensity\Comments\FixMeComment; -use SavinMikhail\CommentsDensity\Comments\LicenseComment; -use SavinMikhail\CommentsDensity\Comments\RegularComment; -use SavinMikhail\CommentsDensity\Comments\TodoComment; +use SavinMikhail\CommentsDensity\AnalyzeComments\Comments\Comment; +use SavinMikhail\CommentsDensity\AnalyzeComments\Comments\CommentFactory; +use SavinMikhail\CommentsDensity\AnalyzeComments\Comments\DocBlockComment; +use SavinMikhail\CommentsDensity\AnalyzeComments\Comments\FixMeComment; +use SavinMikhail\CommentsDensity\AnalyzeComments\Comments\LicenseComment; +use SavinMikhail\CommentsDensity\AnalyzeComments\Comments\RegularComment; +use SavinMikhail\CommentsDensity\AnalyzeComments\Comments\TodoComment; final class CommentTest extends TestCase { diff --git a/tests/Composer/CommentsDensityPluginTest.php b/tests/Composer/CommentsDensityPluginTest.php index 0637559..37cfdbc 100644 --- a/tests/Composer/CommentsDensityPluginTest.php +++ b/tests/Composer/CommentsDensityPluginTest.php @@ -10,7 +10,7 @@ use Mockery; use PHPUnit\Framework\TestCase; use ReflectionClass; -use SavinMikhail\CommentsDensity\Composer\CommentsDensityPlugin; +use SavinMikhail\CommentsDensity\ComposerPlugin\CommentsDensityPlugin; final class CommentsDensityPluginTest extends TestCase { diff --git a/tests/ConfigLoaderTest.php b/tests/ConfigLoaderTest.php index ec34330..5c8dd7c 100644 --- a/tests/ConfigLoaderTest.php +++ b/tests/ConfigLoaderTest.php @@ -7,13 +7,11 @@ use org\bovigo\vfs\vfsStream; use PHPUnit\Framework\TestCase; use ReflectionClass; -use SavinMikhail\CommentsDensity\Config\ConfigLoader; -use SavinMikhail\CommentsDensity\Config\DTO\ConfigDTO; -use SavinMikhail\CommentsDensity\Config\DTO\MissingDocblockConfigDTO; -use SavinMikhail\CommentsDensity\Exception\CommentsDensityException; - +use SavinMikhail\CommentsDensity\AnalyzeComments\Config\ConfigLoader; +use SavinMikhail\CommentsDensity\AnalyzeComments\Config\DTO\ConfigDTO; +use SavinMikhail\CommentsDensity\AnalyzeComments\Config\DTO\MissingDocblockConfigDTO; +use SavinMikhail\CommentsDensity\AnalyzeComments\Exception\CommentsDensityException; use function define; - use const DIRECTORY_SEPARATOR; final class ConfigLoaderTest extends TestCase diff --git a/tests/Metrics/CDSTest.php b/tests/Metrics/CDSTest.php index 2041eac..e13828f 100644 --- a/tests/Metrics/CDSTest.php +++ b/tests/Metrics/CDSTest.php @@ -6,10 +6,10 @@ use PHPUnit\Framework\TestCase; use ReflectionClass; -use SavinMikhail\CommentsDensity\Analyzer\DTO\Output\CdsDTO; -use SavinMikhail\CommentsDensity\Analyzer\DTO\Output\CommentStatisticsDTO; -use SavinMikhail\CommentsDensity\Comments\CommentFactory; -use SavinMikhail\CommentsDensity\Metrics\CDS; +use SavinMikhail\CommentsDensity\AnalyzeComments\Analyzer\DTO\Output\CdsDTO; +use SavinMikhail\CommentsDensity\AnalyzeComments\Analyzer\DTO\Output\CommentStatisticsDTO; +use SavinMikhail\CommentsDensity\AnalyzeComments\Comments\CommentFactory; +use SavinMikhail\CommentsDensity\AnalyzeComments\Metrics\CDS; final class CDSTest extends TestCase { diff --git a/tests/Metrics/ComToLocTest.php b/tests/Metrics/ComToLocTest.php index 37f9eba..f757132 100644 --- a/tests/Metrics/ComToLocTest.php +++ b/tests/Metrics/ComToLocTest.php @@ -5,8 +5,8 @@ namespace SavinMikhail\Tests\CommentsDensity\Metrics; use PHPUnit\Framework\TestCase; -use SavinMikhail\CommentsDensity\Analyzer\DTO\Output\CommentStatisticsDTO; -use SavinMikhail\CommentsDensity\Metrics\ComToLoc; +use SavinMikhail\CommentsDensity\AnalyzeComments\Analyzer\DTO\Output\CommentStatisticsDTO; +use SavinMikhail\CommentsDensity\AnalyzeComments\Metrics\ComToLoc; final class ComToLocTest extends TestCase { diff --git a/tests/Metrics/PerformanceMonitorTest.php b/tests/Metrics/PerformanceMonitorTest.php index 3b37925..de445cc 100644 --- a/tests/Metrics/PerformanceMonitorTest.php +++ b/tests/Metrics/PerformanceMonitorTest.php @@ -6,8 +6,8 @@ use PHPUnit\Framework\TestCase; use ReflectionClass; -use SavinMikhail\CommentsDensity\Analyzer\DTO\Output\PerformanceMetricsDTO; -use SavinMikhail\CommentsDensity\Metrics\ResourceUtilization; +use SavinMikhail\CommentsDensity\AnalyzeComments\Analyzer\DTO\Output\PerformanceMetricsDTO; +use SavinMikhail\CommentsDensity\AnalyzeComments\Metrics\ResourceUtilization; final class PerformanceMonitorTest extends TestCase { diff --git a/tests/MissingDocblock/MDBAdvancedCheckForMethodTest.php b/tests/MissingDocblock/MDBAdvancedCheckForMethodTest.php index 8ceb6f8..e88489e 100644 --- a/tests/MissingDocblock/MDBAdvancedCheckForMethodTest.php +++ b/tests/MissingDocblock/MDBAdvancedCheckForMethodTest.php @@ -7,11 +7,9 @@ use Generator; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; -use SavinMikhail\CommentsDensity\Config\DTO\MissingDocblockConfigDTO; -use SavinMikhail\CommentsDensity\MissingDocblock\MissingDocBlockAnalyzer; - +use SavinMikhail\CommentsDensity\AnalyzeComments\Config\DTO\MissingDocblockConfigDTO; +use SavinMikhail\CommentsDensity\AnalyzeComments\MissingDocblock\MissingDocBlockAnalyzer; use function file_get_contents; - use const DIRECTORY_SEPARATOR; final class MDBAdvancedCheckForMethodTest extends TestCase diff --git a/tests/MissingDocblock/MissingDocBlockAnalyzerTest.php b/tests/MissingDocblock/MissingDocBlockAnalyzerTest.php index e5a6572..b5cbb46 100644 --- a/tests/MissingDocblock/MissingDocBlockAnalyzerTest.php +++ b/tests/MissingDocblock/MissingDocBlockAnalyzerTest.php @@ -7,8 +7,8 @@ use Generator; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; -use SavinMikhail\CommentsDensity\Config\DTO\MissingDocblockConfigDTO; -use SavinMikhail\CommentsDensity\MissingDocblock\MissingDocBlockAnalyzer; +use SavinMikhail\CommentsDensity\AnalyzeComments\Config\DTO\MissingDocblockConfigDTO; +use SavinMikhail\CommentsDensity\AnalyzeComments\MissingDocblock\MissingDocBlockAnalyzer; final class MissingDocBlockAnalyzerTest extends TestCase { diff --git a/tests/Reporters/HtmlReporterTest.php b/tests/Reporters/HtmlReporterTest.php index 9006805..1a4e509 100644 --- a/tests/Reporters/HtmlReporterTest.php +++ b/tests/Reporters/HtmlReporterTest.php @@ -5,13 +5,13 @@ namespace SavinMikhail\Tests\CommentsDensity\Reporters; use PHPUnit\Framework\TestCase; -use SavinMikhail\CommentsDensity\Analyzer\DTO\Output\CdsDTO; -use SavinMikhail\CommentsDensity\Analyzer\DTO\Output\CommentDTO; -use SavinMikhail\CommentsDensity\Analyzer\DTO\Output\CommentStatisticsDTO; -use SavinMikhail\CommentsDensity\Analyzer\DTO\Output\ComToLocDTO; -use SavinMikhail\CommentsDensity\Analyzer\DTO\Output\OutputDTO; -use SavinMikhail\CommentsDensity\Analyzer\DTO\Output\PerformanceMetricsDTO; -use SavinMikhail\CommentsDensity\Reporters\HtmlReporter; +use SavinMikhail\CommentsDensity\AnalyzeComments\Analyzer\DTO\Output\CdsDTO; +use SavinMikhail\CommentsDensity\AnalyzeComments\Analyzer\DTO\Output\CommentDTO; +use SavinMikhail\CommentsDensity\AnalyzeComments\Analyzer\DTO\Output\CommentStatisticsDTO; +use SavinMikhail\CommentsDensity\AnalyzeComments\Analyzer\DTO\Output\ComToLocDTO; +use SavinMikhail\CommentsDensity\AnalyzeComments\Analyzer\DTO\Output\OutputDTO; +use SavinMikhail\CommentsDensity\AnalyzeComments\Analyzer\DTO\Output\PerformanceMetricsDTO; +use SavinMikhail\CommentsDensity\AnalyzeComments\Reporters\HtmlReporter; final class HtmlReporterTest extends TestCase {