diff --git a/composer.json b/composer.json index 4b6998fa..91ad4752 100644 --- a/composer.json +++ b/composer.json @@ -46,10 +46,14 @@ "phpunit/phpunit": "^8.0|^9.0", "rector/rector": "0.11.56", "symfony/var-dumper": "^4.2|^5.0|^6.0", - "thecodingmachine/phpstan-strict-rules": "^0.12.0" + "roave/no-floaters": "^1.1", + "symplify/easy-coding-standard": "^6.0", + "thecodingmachine/phpstan-strict-rules": "^0.11.0", + "twig/twig": "^2.0" }, "suggest": { - "ext-simplexml": "It is needed for the checkstyle formatter" + "ext-simplexml": "It is needed for the checkstyle formatter", + "twig/twig": "Twig:^2.0 is needed to support the HTML formattter" }, "autoload-dev": { "psr-4": { diff --git a/dashboard.html b/dashboard.html new file mode 100644 index 00000000..38a8e475 --- /dev/null +++ b/dashboard.html @@ -0,0 +1,2102 @@ + + + + + + + + + + PHP Insights + + +
+ +

PHP Insights

+ +

+ + /Users/tomwitkowski/Projects/private/phpinsights +

+ +
+
+ code quality + +
89.5 %
+
+
+
+ complexity + +
71.6 %
+
+
+
+ structure + +
82.6 %
+
+
+
+ style + +
97.8 %
+
+
+
+ +
+ score scale: + 1 - 49 + 50 - 79 + 80 - 100 +
+ +

code quality

+
+
+
+ + Element name minimal length + (38) + ObjectCalisthenics\Sniffs\NamingConventions\ElementNameMinimalLengthSniff +
+
+
    +
  • + + src/Domain/Insights/Composer/ComposerMustContainName.php:25 + Variable name "e" is only 1 chars long. Must be at least 3. +
  • +
  • + + src/Domain/Insights/Composer/ComposerMustExist.php:17 + Variable name "e" is only 1 chars long. Must be at least 3. +
  • +
  • + + src/Domain/Insights/ForbiddenSecurityIssues.php:63 + Variable name "e" is only 1 chars long. Must be at least 3. +
  • +
  • + + src/Domain/Insights/ForbiddenSecurityIssues.php:67 + Variable name "e" is only 1 chars long. Must be at least 3. +
  • +
  • + + src/Domain/Collector.php:964 + Variable name "x" is only 1 chars long. Must be at least 3. +
  • +
  • + + src/Domain/Collector.php:964 + Variable name "y" is only 1 chars long. Must be at least 3. +
  • +
  • + + src/Domain/Collector.php:966 + Variable name "y" is only 1 chars long. Must be at least 3. +
  • +
  • + + src/Domain/Collector.php:966 + Variable name "x" is only 1 chars long. Must be at least 3. +
  • +
  • + + src/Domain/Collector.php:966 + Variable name "y" is only 1 chars long. Must be at least 3. +
  • +
  • + + src/Domain/File.php:68 + Variable name "e" is only 1 chars long. Must be at least 3. +
  • +
  • + + src/Domain/ComposerLoader.php:18 + Variable name "io" is only 2 chars long. Must be at least 3. +
  • +
  • + + src/Domain/ComposerLoader.php:19 + Variable name "io" is only 2 chars long. Must be at least 3. +
  • +
  • + + src/Domain/Analyser.php:224 + Variable name "j" is only 1 chars long. Must be at least 3. +
  • +
  • + + src/Domain/Analyser.php:224 + Variable name "j" is only 1 chars long. Must be at least 3. +
  • +
  • + + src/Domain/Analyser.php:224 + Variable name "j" is only 1 chars long. Must be at least 3. +
  • +
  • + + src/Domain/Analyser.php:225 + Variable name "j" is only 1 chars long. Must be at least 3. +
  • +
  • + + src/Domain/Analyser.php:226 + Variable name "j" is only 1 chars long. Must be at least 3. +
  • +
  • + + src/Domain/Analyser.php:227 + Variable name "j" is only 1 chars long. Must be at least 3. +
  • +
  • + + src/Domain/Analyser.php:228 + Variable name "j" is only 1 chars long. Must be at least 3. +
  • +
  • + + src/Domain/Analyser.php:235 + Variable name "j" is only 1 chars long. Must be at least 3. +
  • +
  • + + src/Domain/Analyser.php:236 + Variable name "j" is only 1 chars long. Must be at least 3. +
  • +
  • + + src/Domain/Analyser.php:324 + Variable name "j" is only 1 chars long. Must be at least 3. +
  • +
  • + + src/Domain/Analyser.php:326 + Variable name "j" is only 1 chars long. Must be at least 3. +
  • +
  • + + src/Domain/Analyser.php:326 + Variable name "j" is only 1 chars long. Must be at least 3. +
  • +
  • + + src/Domain/Analyser.php:327 + Variable name "j" is only 1 chars long. Must be at least 3. +
  • +
  • + + src/Domain/Analyser.php:328 + Variable name "j" is only 1 chars long. Must be at least 3. +
  • +
  • + + src/Domain/Analyser.php:330 + Variable name "j" is only 1 chars long. Must be at least 3. +
  • +
  • + + src/Domain/Analyser.php:335 + Variable name "j" is only 1 chars long. Must be at least 3. +
  • +
  • + + src/Domain/Analyser.php:345 + Variable name "n" is only 1 chars long. Must be at least 3. +
  • +
  • + + src/Domain/Analyser.php:346 + Variable name "nn" is only 2 chars long. Must be at least 3. +
  • +
  • + + src/Domain/Analyser.php:346 + Variable name "n" is only 1 chars long. Must be at least 3. +
  • +
  • + + src/Domain/Analyser.php:348 + Variable name "n" is only 1 chars long. Must be at least 3. +
  • +
  • + + src/Domain/Analyser.php:348 + Variable name "nn" is only 2 chars long. Must be at least 3. +
  • +
  • + + src/Domain/Analyser.php:349 + Variable name "n" is only 1 chars long. Must be at least 3. +
  • +
  • + + src/Domain/Analyser.php:350 + Variable name "n" is only 1 chars long. Must be at least 3. +
  • +
  • + + src/Domain/Analyser.php:351 + Variable name "n" is only 1 chars long. Must be at least 3. +
  • +
  • + + src/Domain/Analyser.php:352 + Variable name "nn" is only 2 chars long. Must be at least 3. +
  • +
  • + + src/Domain/Analyser.php:360 + Variable name "n" is only 1 chars long. Must be at least 3. +
  • +
+
+
+
+
+ + Max nesting level + (7) + ObjectCalisthenics\Sniffs\Metrics\MaxNestingLevelSniff +
+
+
    +
  • + + src/Application/ConfigResolver.php:92 + Only 2 indentation levels per function/method. Found 3 levels. +
  • +
  • + + src/Application/Console/Formatters/Json.php:74 + Only 2 indentation levels per function/method. Found 3 levels. +
  • +
  • + + src/Application/Console/Formatters/Console.php:268 + Only 2 indentation levels per function/method. Found 4 levels. +
  • +
  • + + src/Domain/Insights/InsightFactory.php:67 + Only 2 indentation levels per function/method. Found 3 levels. +
  • +
  • + + src/Domain/Insights/InsightFactory.php:98 + Only 2 indentation levels per function/method. Found 3 levels. +
  • +
  • + + src/Domain/File.php:52 + Only 2 indentation levels per function/method. Found 3 levels. +
  • +
  • + + src/Domain/Analyser.php:71 + Only 2 indentation levels per function/method. Found 7 levels. +
  • +
+
+
+
+
+ + Disallow array type hint syntax + (2) + SlevomatCodingStandard\Sniffs\TypeHints\DisallowArrayTypeHintSyntaxSniff +
+
+
    +
  • + + src/Application/ConfigResolver.php:87 + Usage of array type hint syntax in "mixed[]" is disallowed, use generic type hint syntax instead. +
  • +
  • + + src/Application/ConfigResolver.php:88 + Usage of array type hint syntax in "mixed[]" is disallowed, use generic type hint syntax instead. +
  • +
+
+
+
+
+ + Disallow mixed type hint + (3) + SlevomatCodingStandard\Sniffs\TypeHints\DisallowMixedTypeHintSniff +
+
+
    +
  • + + src/Application/ConfigResolver.php:87 + Usage of "mixed" type hint is disallowed. +
  • +
  • + + src/Application/ConfigResolver.php:88 + Usage of "mixed" type hint is disallowed. +
  • +
  • + + src/Domain/Insights/InsightFactory.php:122 + Usage of "mixed" type hint is disallowed. +
  • +
+
+
+
+
+ + Type hint declaration + (83) + SlevomatCodingStandard\Sniffs\TypeHints\TypeHintDeclarationSniff +
+
+
    +
  • + + src/Application/ConfigResolver.php:38 + @return annotation of method \NunoMaduro\PhpInsights\Application\ConfigResolver::resolve() does not specify type hint for items of its traversable return value. +
  • +
  • + + src/Application/ConfigResolver.php:90 + @return annotation of method \NunoMaduro\PhpInsights\Application\ConfigResolver::mergeConfig() does not specify type hint for items of its traversable return value. +
  • +
  • + + src/Application/Adapters/Laravel/Commands/InsightsCommand.php:18 + Property \NunoMaduro\PhpInsights\Application\Adapters\Laravel\Commands\InsightsCommand::$name does not have @var annotation. +
  • +
  • + + src/Application/Adapters/Laravel/Commands/InsightsCommand.php:20 + Property \NunoMaduro\PhpInsights\Application\Adapters\Laravel\Commands\InsightsCommand::$description does not have @var annotation. +
  • +
  • + + src/Application/Console/Commands/AnalyseCommand.php:128 + @return annotation of method \NunoMaduro\PhpInsights\Application\Console\Commands\AnalyseCommand::getConfig() does not specify type hint for items of its traversable return value. +
  • +
  • + + src/Application/Console/Commands/AnalyseCommand.php:162 + @param annotation of method \NunoMaduro\PhpInsights\Application\Console\Commands\AnalyseCommand::excludeGlobalInsights() does not specify type hint for items of its traversable parameter $config. +
  • +
  • + + src/Application/Console/Commands/AnalyseCommand.php:164 + @return annotation of method \NunoMaduro\PhpInsights\Application\Console\Commands\AnalyseCommand::excludeGlobalInsights() does not specify type hint for items of its traversable return value. +
  • +
  • + + src/Application/Console/Analyser.php:37 + @param annotation of method \NunoMaduro\PhpInsights\Application\Console\Analyser::analyse() does not specify type hint for items of its traversable parameter $config. +
  • +
  • + + src/Application/Console/Style.php:63 + Method \NunoMaduro\PhpInsights\Application\Console\Style::getOutput() does not need documentation comment. +
  • +
  • + + src/Domain/Insights/InsightFactory.php:60 + @param annotation of method \NunoMaduro\PhpInsights\Domain\Insights\InsightFactory::makeFrom() does not specify type hint for items of its traversable parameter $config. +
  • +
  • + + src/Domain/Insights/InsightFactory.php:94 + @param annotation of method \NunoMaduro\PhpInsights\Domain\Insights\InsightFactory::sniffsFrom() does not specify type hint for items of its traversable parameter $config. +
  • +
  • + + src/Domain/Insights/Composer/ComposerLockMustBeFresh.php:31 + Method \NunoMaduro\PhpInsights\Domain\Insights\Composer\ComposerLockMustBeFresh::getDetails() does not have @return annotation for its traversable return value. +
  • +
  • + + src/Domain/Insights/Composer/ComposerMustBeValid.php:42 + Method \NunoMaduro\PhpInsights\Domain\Insights\Composer\ComposerMustBeValid::getDetails() does not have @return annotation for its traversable return value. +
  • +
  • + + src/Domain/Insights/SniffDecorator.php:53 + Method \NunoMaduro\PhpInsights\Domain\Insights\SniffDecorator::process() does not have parameter type hint for its parameter $stackPtr but it should be possible to add it based on @param annotation "int". +
  • +
  • + + src/Domain/Insights/InsightCollection.php:41 + Method \NunoMaduro\PhpInsights\Domain\Insights\InsightCollection::getCollector() does not need documentation comment. +
  • +
  • + + src/Domain/Insights/ForbiddenSecurityIssues.php:30 + Method \NunoMaduro\PhpInsights\Domain\Insights\ForbiddenSecurityIssues::getDetails() does not have @return annotation for its traversable return value. +
  • +
  • + + src/Domain/Insights/ForbiddenSecurityIssues.php:54 + Method \NunoMaduro\PhpInsights\Domain\Insights\ForbiddenSecurityIssues::getResult() does not need documentation comment. +
  • +
  • + + src/Domain/Container.php:22 + Method \NunoMaduro\PhpInsights\Domain\Container::make() does not need documentation comment. +
  • +
  • + + src/Domain/Collector.php:231 + Method \NunoMaduro\PhpInsights\Domain\Collector::addFile() does not need documentation comment. +
  • +
  • + + src/Domain/Collector.php:246 + Method \NunoMaduro\PhpInsights\Domain\Collector::incrementCommentLines() does not need documentation comment. +
  • +
  • + + src/Domain/Collector.php:254 + Method \NunoMaduro\PhpInsights\Domain\Collector::incrementLogicalLines() does not need documentation comment. +
  • +
  • + + src/Domain/Collector.php:262 + Method \NunoMaduro\PhpInsights\Domain\Collector::currentClassReset() does not need documentation comment. +
  • +
  • + + src/Domain/Collector.php:276 + Method \NunoMaduro\PhpInsights\Domain\Collector::currentClassIncrementComplexity() does not need documentation comment. +
  • +
  • + + src/Domain/Collector.php:284 + Method \NunoMaduro\PhpInsights\Domain\Collector::currentClassIncrementLines() does not need documentation comment. +
  • +
  • + + src/Domain/Collector.php:292 + Method \NunoMaduro\PhpInsights\Domain\Collector::currentMethodStart() does not need documentation comment. +
  • +
  • + + src/Domain/Collector.php:301 + Method \NunoMaduro\PhpInsights\Domain\Collector::currentMethodIncrementComplexity() does not need documentation comment. +
  • +
  • + + src/Domain/Collector.php:310 + Method \NunoMaduro\PhpInsights\Domain\Collector::currentMethodIncrementLines() does not need documentation comment. +
  • +
  • + + src/Domain/Collector.php:320 + Method \NunoMaduro\PhpInsights\Domain\Collector::currentMethodStop() does not need documentation comment. +
  • +
  • + + src/Domain/Collector.php:329 + Method \NunoMaduro\PhpInsights\Domain\Collector::incrementFunctionLines() does not need documentation comment. +
  • +
  • + + src/Domain/Collector.php:349 + Method \NunoMaduro\PhpInsights\Domain\Collector::addPossibleConstantAccesses() does not need documentation comment. +
  • +
  • + + src/Domain/Collector.php:360 + Method \NunoMaduro\PhpInsights\Domain\Collector::addGlobalFunctions() does not need documentation comment. +
  • +
  • + + src/Domain/Collector.php:371 + Method \NunoMaduro\PhpInsights\Domain\Collector::addGlobalVariableAccesses() does not need documentation comment. +
  • +
  • + + src/Domain/Collector.php:382 + Method \NunoMaduro\PhpInsights\Domain\Collector::addSuperGlobalVariableAccesses() does not need documentation comment. +
  • +
  • + + src/Domain/Collector.php:390 + Method \NunoMaduro\PhpInsights\Domain\Collector::incrementNonStaticAttributeAccesses() does not need documentation comment. +
  • +
  • + + src/Domain/Collector.php:398 + Method \NunoMaduro\PhpInsights\Domain\Collector::incrementStaticAttributeAccesses() does not need documentation comment. +
  • +
  • + + src/Domain/Collector.php:426 + Method \NunoMaduro\PhpInsights\Domain\Collector::addNamespace() does not need documentation comment. +
  • +
  • + + src/Domain/Collector.php:447 + Method \NunoMaduro\PhpInsights\Domain\Collector::addAbstractClass() does not need documentation comment. +
  • +
  • + + src/Domain/Collector.php:457 + Method \NunoMaduro\PhpInsights\Domain\Collector::addConcreteFinalClass() does not need documentation comment. +
  • +
  • + + src/Domain/Collector.php:467 + Method \NunoMaduro\PhpInsights\Domain\Collector::addConcreteNonFinalClass() does not need documentation comment. +
  • +
  • + + src/Domain/Collector.php:527 + Method \NunoMaduro\PhpInsights\Domain\Collector::addNamedFunctions() does not need documentation comment. +
  • +
  • + + src/Domain/Collector.php:549 + Method \NunoMaduro\PhpInsights\Domain\Collector::incrementClassConstants() does not need documentation comment. +
  • +
  • + + src/Domain/Collector.php:559 + Method \NunoMaduro\PhpInsights\Domain\Collector::addGlobalConstant() does not need documentation comment. +
  • +
  • + + src/Domain/Collector.php:584 + Method \NunoMaduro\PhpInsights\Domain\Collector::getLines() does not need documentation comment. +
  • +
  • + + src/Domain/Collector.php:595 + Method \NunoMaduro\PhpInsights\Domain\Collector::getCommentLines() does not need documentation comment. +
  • +
  • + + src/Domain/Collector.php:635 + Method \NunoMaduro\PhpInsights\Domain\Collector::getClassLines() does not need documentation comment. +
  • +
  • + + src/Domain/Collector.php:651 + Method \NunoMaduro\PhpInsights\Domain\Collector::getCurrentFilename() does not need documentation comment. +
  • +
  • + + src/Domain/Collector.php:659 + Method \NunoMaduro\PhpInsights\Domain\Collector::getCurrentClassComplexity() does not need documentation comment. +
  • +
  • + + src/Domain/Collector.php:667 + Method \NunoMaduro\PhpInsights\Domain\Collector::getCurrentClassLines() does not need documentation comment. +
  • +
  • + + src/Domain/Collector.php:675 + Method \NunoMaduro\PhpInsights\Domain\Collector::getCurrentMethodComplexity() does not need documentation comment. +
  • +
  • + + src/Domain/Collector.php:683 + Method \NunoMaduro\PhpInsights\Domain\Collector::getCurrentMethodLines() does not need documentation comment. +
  • +
  • + + src/Domain/Collector.php:691 + Method \NunoMaduro\PhpInsights\Domain\Collector::getLogicalLines() does not need documentation comment. +
  • +
  • + + src/Domain/Collector.php:699 + Method \NunoMaduro\PhpInsights\Domain\Collector::getMethodComplexity() does not need documentation comment. +
  • +
  • + + src/Domain/Collector.php:707 + Method \NunoMaduro\PhpInsights\Domain\Collector::getClassConstants() does not need documentation comment. +
  • +
  • + + src/Domain/Collector.php:715 + Method \NunoMaduro\PhpInsights\Domain\Collector::getFunctionLines() does not need documentation comment. +
  • +
  • + + src/Domain/Collector.php:739 + Method \NunoMaduro\PhpInsights\Domain\Collector::getStaticAttributeAccesses() does not need documentation comment. +
  • +
  • + + src/Domain/Collector.php:773 + Method \NunoMaduro\PhpInsights\Domain\Collector::getNonStaticMethodCalls() does not need documentation comment. +
  • +
  • + + src/Domain/Collector.php:781 + Method \NunoMaduro\PhpInsights\Domain\Collector::getNonStaticAttributeAccesses() does not need documentation comment. +
  • +
  • + + src/Domain/Collector.php:789 + Method \NunoMaduro\PhpInsights\Domain\Collector::getAnonymousFunctions() does not need documentation comment. +
  • +
  • + + src/Domain/Collector.php:805 + Method \NunoMaduro\PhpInsights\Domain\Collector::getPublicMethods() does not need documentation comment. +
  • +
  • + + src/Domain/Collector.php:813 + Method \NunoMaduro\PhpInsights\Domain\Collector::getStaticMethods() does not need documentation comment. +
  • +
  • + + src/Domain/Collector.php:821 + Method \NunoMaduro\PhpInsights\Domain\Collector::getNonStaticMethods() does not need documentation comment. +
  • +
  • + + src/Domain/Collector.php:853 + Method \NunoMaduro\PhpInsights\Domain\Collector::getProtectedMethods() does not need documentation comment. +
  • +
  • + + src/Domain/Collector.php:861 + Method \NunoMaduro\PhpInsights\Domain\Collector::getPrivateMethods() does not need documentation comment. +
  • +
  • + + src/Domain/Collector.php:869 + Method \NunoMaduro\PhpInsights\Domain\Collector::getStaticMethodCalls() does not need documentation comment. +
  • +
  • + + src/Domain/Collector.php:877 + Method \NunoMaduro\PhpInsights\Domain\Collector::getInterfaces() does not need documentation comment. +
  • +
  • + + src/Domain/Collector.php:901 + Method \NunoMaduro\PhpInsights\Domain\Collector::getNonCommentLines() does not need documentation comment. +
  • +
  • + + src/Domain/Collector.php:964 + Method \NunoMaduro\PhpInsights\Domain\Collector::divide() does not need documentation comment. +
  • +
  • + + src/Domain/Collector.php:972 + Method \NunoMaduro\PhpInsights\Domain\Collector::getMaximumClassLength() does not need documentation comment. +
  • +
  • + + src/Domain/Collector.php:980 + Method \NunoMaduro\PhpInsights\Domain\Collector::getAverageMethodLength() does not need documentation comment. +
  • +
  • + + src/Domain/Collector.php:988 + Method \NunoMaduro\PhpInsights\Domain\Collector::getMaximumMethodLength() does not need documentation comment. +
  • +
  • + + src/Domain/Collector.php:996 + Method \NunoMaduro\PhpInsights\Domain\Collector::getAverageFunctionLength() does not need documentation comment. +
  • +
  • + + src/Domain/Collector.php:1004 + Method \NunoMaduro\PhpInsights\Domain\Collector::getNotInClassesOrFunctions() does not need documentation comment. +
  • +
  • + + src/Domain/Collector.php:1012 + Method \NunoMaduro\PhpInsights\Domain\Collector::getAverageComplexityPerLogicalLine() does not need documentation comment. +
  • +
  • + + src/Domain/Collector.php:1020 + Method \NunoMaduro\PhpInsights\Domain\Collector::getAverageComplexityPerClass() does not need documentation comment. +
  • +
  • + + src/Domain/Collector.php:1038 + Method \NunoMaduro\PhpInsights\Domain\Collector::getMaximumClassComplexity() does not need documentation comment. +
  • +
  • + + src/Domain/Collector.php:1046 + Method \NunoMaduro\PhpInsights\Domain\Collector::getAverageComplexityPerMethod() does not need documentation comment. +
  • +
  • + + src/Domain/Collector.php:1054 + Method \NunoMaduro\PhpInsights\Domain\Collector::getMaximumMethodComplexity() does not need documentation comment. +
  • +
  • + + src/Domain/Collector.php:1062 + Method \NunoMaduro\PhpInsights\Domain\Collector::getGlobalAccesses() does not need documentation comment. +
  • +
  • + + src/Domain/Collector.php:1070 + Method \NunoMaduro\PhpInsights\Domain\Collector::getGlobalConstantAccesses() does not need documentation comment. +
  • +
  • + + src/Domain/Collector.php:1078 + Method \NunoMaduro\PhpInsights\Domain\Collector::getAttributeAccesses() does not need documentation comment. +
  • +
  • + + src/Domain/ComposerFinder.php:16 + Method \NunoMaduro\PhpInsights\Domain\ComposerFinder::contents() does not need documentation comment. +
  • +
  • + + src/Domain/Sniffs/ForbiddenSetterSniff.php:28 + Method \NunoMaduro\PhpInsights\Domain\Sniffs\ForbiddenSetterSniff::register() does not have @return annotation for its traversable return value. +
  • +
  • + + src/Domain/Sniffs/ForbiddenSetterSniff.php:39 + Method \NunoMaduro\PhpInsights\Domain\Sniffs\ForbiddenSetterSniff::process() does not have parameter type hint for its parameter $position but it should be possible to add it based on @param annotation "int". +
  • +
+
+
+
+
+ + Useless inherit doc comment + (2) + SlevomatCodingStandard\Sniffs\Commenting\UselessInheritDocCommentSniff +
+
+
    +
  • + + src/Infrastructure/Repositories/LocalFilesRepository.php:37 + Useless documentation comment with @inheritDoc. +
  • +
  • + + src/Infrastructure/Repositories/LocalFilesRepository.php:45 + Useless documentation comment with @inheritDoc. +
  • +
+
+
+
+
+ + Unused parameter + (11) + SlevomatCodingStandard\Sniffs\Functions\UnusedParameterSniff +
+
+
    +
  • + + src/Application/DefaultPreset.php:58 + Unused parameter $composer. +
  • +
  • + + src/Application/Console/Formatters/Json.php:24 + Unused parameter $input. +
  • +
  • + + src/Application/Console/Formatters/Json.php:40 + Unused parameter $dir. +
  • +
  • + + src/Application/Console/Formatters/Html.php:24 + Unused parameter $input. +
  • +
  • + + src/Application/Console/Formatters/Html.php:41 + Unused parameter $metrics. +
  • +
  • + + src/Domain/File.php:129 + Unused parameter $isError. +
  • +
  • + + src/Domain/File.php:132 + Unused parameter $column. +
  • +
  • + + src/Domain/File.php:133 + Unused parameter $sniffClassOrCode. +
  • +
  • + + src/Domain/File.php:135 + Unused parameter $severity. +
  • +
  • + + src/Domain/File.php:136 + Unused parameter $isFixable. +
  • +
  • + + src/Domain/Sniffs/ForbiddenSetterSniff.php:94 + Unused parameter $className. +
  • +
+
+
+
+
+ + Static closure + (1) + SlevomatCodingStandard\Sniffs\Functions\StaticClosureSniff +
+
+
    +
  • + + src/Application/Console/Formatters/Html.php:59 + Closure not using "$this" should be declared static. +
  • +
+
+
+
+

complexity

+
+
+
+ + Having `classes` with more than 5 cyclomatic complexity is prohibited - Consider refactoring + (14) + NunoMaduro\PhpInsights\Domain\Insights\CyclomaticComplexityIsHigh +
+
+
    +
  • + + src/Domain/File.php + 6 cyclomatic complexity +
  • +
  • + + src/Domain/Collector.php + 6 cyclomatic complexity +
  • +
  • + + src/Domain/Insights/ForbiddenSecurityIssues.php + 6 cyclomatic complexity +
  • +
  • + + src/Domain/Insights/SniffDecorator.php + 6 cyclomatic complexity +
  • +
  • + + src/Domain/Runner.php + 7 cyclomatic complexity +
  • +
  • + + src/Domain/Sniffs/ForbiddenSetterSniff.php + 8 cyclomatic complexity +
  • +
  • + + src/Domain/Results.php + 8 cyclomatic complexity +
  • +
  • + + src/Domain/Insights/InsightFactory.php + 8 cyclomatic complexity +
  • +
  • + + src/Domain/Insights/InsightCollectionFactory.php + 9 cyclomatic complexity +
  • +
  • + + src/Application/Console/Formatters/Json.php + 12 cyclomatic complexity +
  • +
  • + + src/Application/ConfigResolver.php + 14 cyclomatic complexity +
  • +
  • + + src/Application/Console/Commands/AnalyseCommand.php + 18 cyclomatic complexity +
  • +
  • + + src/Application/Console/Formatters/Console.php + 29 cyclomatic complexity +
  • +
  • + + src/Domain/Analyser.php + 95 cyclomatic complexity +
  • +
+
+
+
+

structure

+
+
+
+ + Class trait and interface length + (3) + ObjectCalisthenics\Sniffs\Files\ClassTraitAndInterfaceLengthSniff +
+
+
    +
  • + + src/Application/Console/Formatters/Console.php:30 + Your class is too long. Currently using 354 lines. Can be up to 200 lines. +
  • +
  • + + src/Domain/Collector.php:13 + Your class is too long. Currently using 1118 lines. Can be up to 200 lines. +
  • +
  • + + src/Domain/Analyser.php:21 + Your class is too long. Currently using 377 lines. Can be up to 200 lines. +
  • +
+
+
+
+
+ + Method per class limit + (3) + ObjectCalisthenics\Sniffs\Metrics\MethodPerClassLimitSniff +
+
+
    +
  • + + src/Domain/Insights/SniffDecorator.php:18 + Class has too many methods: 11. Can be up to 10 methods. +
  • +
  • + + src/Domain/Details.php:7 + Class has too many methods: 16. Can be up to 10 methods. +
  • +
  • + + src/Domain/Collector.php:13 + Class has too many methods: 102. Can be up to 10 methods. +
  • +
+
+
+
+
+ + Property per class limit + (1) + ObjectCalisthenics\Sniffs\Metrics\PropertyPerClassLimitSniff +
+
+
    +
  • + + src/Domain/Collector.php:13 + "class" has too many properties: 40. Can be up to 10 properties. +
  • +
+
+
+
+
+ + Function length + (17) + ObjectCalisthenics\Sniffs\Files\FunctionLengthSniff +
+
+
    +
  • + + src/Application/DefaultPreset.php:25 + Your function is too long. Currently using 27 lines. Can be up to 20 lines. +
  • +
  • + + src/Application/Adapters/Magento2/Preset.php:24 + Your function is too long. Currently using 29 lines. Can be up to 20 lines. +
  • +
  • + + src/Application/Adapters/Laravel/Preset.php:27 + Your function is too long. Currently using 40 lines. Can be up to 20 lines. +
  • +
  • + + src/Application/Console/Formatters/Json.php:38 + Your function is too long. Currently using 21 lines. Can be up to 20 lines. +
  • +
  • + + src/Application/Console/Formatters/Json.php:74 + Your function is too long. Currently using 44 lines. Can be up to 20 lines. +
  • +
  • + + src/Application/Console/Formatters/Console.php:72 + Your function is too long. Currently using 37 lines. Can be up to 20 lines. +
  • +
  • + + src/Application/Console/Formatters/Console.php:120 + Your function is too long. Currently using 32 lines. Can be up to 20 lines. +
  • +
  • + + src/Application/Console/Formatters/Console.php:189 + Your function is too long. Currently using 34 lines. Can be up to 20 lines. +
  • +
  • + + src/Application/Console/Formatters/Console.php:268 + Your function is too long. Currently using 74 lines. Can be up to 20 lines. +
  • +
  • + + src/Application/Console/Commands/AnalyseCommand.php:57 + Your function is too long. Currently using 62 lines. Can be up to 20 lines. +
  • +
  • + + src/Application/Console/Definitions/AnalyseDefinition.php:18 + Your function is too long. Currently using 55 lines. Can be up to 20 lines. +
  • +
  • + + src/Domain/Metrics/Code/Code.php:65 + Your function is too long. Currently using 49 lines. Can be up to 20 lines. +
  • +
  • + + src/Domain/Metrics/Style/Style.php:60 + Your function is too long. Currently using 57 lines. Can be up to 20 lines. +
  • +
  • + + src/Domain/Insights/InsightCollectionFactory.php:49 + Your function is too long. Currently using 35 lines. Can be up to 20 lines. +
  • +
  • + + src/Domain/File.php:52 + Your function is too long. Currently using 22 lines. Can be up to 20 lines. +
  • +
  • + + src/Domain/Analyser.php:71 + Your function is too long. Currently using 312 lines. Can be up to 20 lines. +
  • +
  • + + src/Domain/Runner.php:59 + Your function is too long. Currently using 23 lines. Can be up to 20 lines. +
  • +
+
+
+
+

style

+
+
+
+ + Line length + (187) + PHP_CodeSniffer\Standards\Generic\Sniffs\Files\LineLengthSniff +
+
+
    +
  • + + stubs/laravel.php:66 + Line exceeds 80 characters; contains 83 characters +
  • +
  • + + config/routes/console.php:10 + Line exceeds 80 characters; contains 82 characters +
  • +
  • + + src/Application/ConfigResolver.php:9 + Line exceeds 80 characters; contains 82 characters +
  • +
  • + + src/Application/ConfigResolver.php:72 + Line exceeds 80 characters; contains 81 characters +
  • +
  • + + src/Application/ConfigResolver.php:99 + Line exceeds 80 characters; contains 95 characters +
  • +
  • + + src/Application/ConfigResolver.php:100 + Line exceeds 80 characters; contains 81 characters +
  • +
  • + + src/Application/Adapters/Magento2/Preset.php:67 + Line exceeds 80 characters; contains 83 characters +
  • +
  • + + src/Application/Adapters/Magento2/Preset.php:68 + Line exceeds 80 characters; contains 86 characters +
  • +
  • + + src/Application/Adapters/Magento2/Preset.php:69 + Line exceeds 80 characters; contains 90 characters +
  • +
  • + + src/Application/Adapters/Drupal/Preset.php:59 + Line exceeds 80 characters; contains 84 characters +
  • +
  • + + src/Application/Adapters/Laravel/Preset.php:86 + Line exceeds 80 characters; contains 96 characters +
  • +
  • + + src/Application/Adapters/Laravel/Commands/InsightsCommand.php:29 + Line exceeds 80 characters; contains 103 characters +
  • +
  • + + src/Application/Adapters/Laravel/InsightsServiceProvider.php:8 + Line exceeds 80 characters; contains 81 characters +
  • +
  • + + src/Application/Adapters/Laravel/InsightsServiceProvider.php:18 + Line exceeds 80 characters; contains 95 characters +
  • +
  • + + src/Application/Adapters/Laravel/InsightsServiceProvider.php:25 + Line exceeds 80 characters; contains 81 characters +
  • +
  • + + src/Application/Adapters/Laravel/InsightsServiceProvider.php:27 + Line exceeds 80 characters; contains 99 characters +
  • +
  • + + src/Application/Console/Formatters/Json.php:60 + Line exceeds 80 characters; contains 81 characters +
  • +
  • + + src/Application/Console/Formatters/Json.php:92 + Line exceeds 80 characters; contains 83 characters +
  • +
  • + + src/Application/Console/Formatters/Json.php:110 + Line exceeds 80 characters; contains 81 characters +
  • +
  • + + src/Application/Console/Formatters/Json.php:111 + Line exceeds 80 characters; contains 81 characters +
  • +
  • + + src/Application/Console/Formatters/Json.php:112 + Line exceeds 80 characters; contains 93 characters +
  • +
  • + + src/Application/Console/Formatters/Json.php:113 + Line exceeds 80 characters; contains 90 characters +
  • +
  • + + src/Application/Console/Formatters/Console.php:12 + Line exceeds 80 characters; contains 86 characters +
  • +
  • + + src/Application/Console/Formatters/Console.php:14 + Line exceeds 80 characters; contains 88 characters +
  • +
  • + + src/Application/Console/Formatters/Console.php:15 + Line exceeds 80 characters; contains 92 characters +
  • +
  • + + src/Application/Console/Formatters/Console.php:16 + Line exceeds 80 characters; contains 84 characters +
  • +
  • + + src/Application/Console/Formatters/Console.php:98 + Line exceeds maximum limit of 120 characters; contains 157 characters +
  • +
  • + + src/Application/Console/Formatters/Console.php:99 + Line exceeds maximum limit of 120 characters; contains 272 characters +
  • +
  • + + src/Application/Console/Formatters/Console.php:100 + Line exceeds maximum limit of 120 characters; contains 157 characters +
  • +
  • + + src/Application/Console/Formatters/Console.php:102 + Line exceeds maximum limit of 120 characters; contains 132 characters +
  • +
  • + + src/Application/Console/Formatters/Console.php:107 + Line exceeds 80 characters; contains 108 characters +
  • +
  • + + src/Application/Console/Formatters/Console.php:126 + Line exceeds 80 characters; contains 81 characters +
  • +
  • + + src/Application/Console/Formatters/Console.php:127 + Line exceeds 80 characters; contains 113 characters +
  • +
  • + + src/Application/Console/Formatters/Console.php:140 + Line exceeds 80 characters; contains 100 characters +
  • +
  • + + src/Application/Console/Formatters/Console.php:173 + Line exceeds 80 characters; contains 112 characters +
  • +
  • + + src/Application/Console/Formatters/Console.php:174 + Line exceeds 80 characters; contains 111 characters +
  • +
  • + + src/Application/Console/Formatters/Console.php:196 + Line exceeds 80 characters; contains 89 characters +
  • +
  • + + src/Application/Console/Formatters/Console.php:197 + Line exceeds 80 characters; contains 109 characters +
  • +
  • + + src/Application/Console/Formatters/Console.php:211 + Line exceeds 80 characters; contains 100 characters +
  • +
  • + + src/Application/Console/Formatters/Console.php:244 + Line exceeds 80 characters; contains 102 characters +
  • +
  • + + src/Application/Console/Formatters/Console.php:246 + Line exceeds 80 characters; contains 89 characters +
  • +
  • + + src/Application/Console/Formatters/Console.php:247 + Line exceeds 80 characters; contains 99 characters +
  • +
  • + + src/Application/Console/Formatters/Console.php:250 + Line exceeds 80 characters; contains 118 characters +
  • +
  • + + src/Application/Console/Formatters/Console.php:277 + Line exceeds 80 characters; contains 83 characters +
  • +
  • + + src/Application/Console/Formatters/Console.php:291 + Line exceeds 80 characters; contains 90 characters +
  • +
  • + + src/Application/Console/Formatters/Console.php:293 + Line exceeds 80 characters; contains 99 characters +
  • +
  • + + src/Application/Console/Formatters/Console.php:318 + Line exceeds 80 characters; contains 99 characters +
  • +
  • + + src/Application/Console/Formatters/Console.php:322 + Line exceeds 80 characters; contains 98 characters +
  • +
  • + + src/Application/Console/Formatters/Console.php:326 + Line exceeds 80 characters; contains 102 characters +
  • +
  • + + src/Application/Console/Formatters/Console.php:330 + Line exceeds 80 characters; contains 102 characters +
  • +
  • + + src/Application/Console/Formatters/Console.php:336 + Line exceeds 80 characters; contains 84 characters +
  • +
  • + + src/Application/Console/Formatters/Console.php:339 + Line exceeds 80 characters; contains 85 characters +
  • +
  • + + src/Application/Console/Formatters/FormatResolver.php:43 + Line exceeds maximum limit of 120 characters; contains 136 characters +
  • +
  • + + src/Application/Console/OutputDecorator.php:37 + Line exceeds 80 characters; contains 90 characters +
  • +
  • + + src/Application/Console/Commands/AnalyseCommand.php:43 + Line exceeds 80 characters; contains 85 characters +
  • +
  • + + src/Application/Console/Commands/AnalyseCommand.php:57 + Line exceeds 80 characters; contains 81 characters +
  • +
  • + + src/Application/Console/Commands/AnalyseCommand.php:112 + Line exceeds 80 characters; contains 109 characters +
  • +
  • + + src/Application/Console/Commands/AnalyseCommand.php:117 + Line exceeds maximum limit of 120 characters; contains 203 characters +
  • +
  • + + src/Application/Console/Commands/AnalyseCommand.php:135 + Line exceeds 80 characters; contains 102 characters +
  • +
  • + + src/Application/Console/Commands/AnalyseCommand.php:139 + Line exceeds maximum limit of 120 characters; contains 128 characters +
  • +
  • + + src/Application/Console/Commands/AnalyseCommand.php:152 + Line exceeds 80 characters; contains 103 characters +
  • +
  • + + src/Application/Console/Commands/AnalyseCommand.php:154 + Line exceeds 80 characters; contains 111 characters +
  • +
  • + + src/Application/Console/Commands/InvokableCommand.php:25 + Line exceeds 80 characters; contains 84 characters +
  • +
  • + + src/Application/Console/Analyser.php:28 + Line exceeds 80 characters; contains 83 characters +
  • +
  • + + src/Application/Console/Definitions/AnalyseDefinition.php:64 + Line exceeds 80 characters; contains 92 characters +
  • +
  • + + src/Application/Console/Style.php:49 + Line exceeds 80 characters; contains 115 characters +
  • +
  • + + src/Application/Console/Style.php:52 + Line exceeds 80 characters; contains 112 characters +
  • +
  • + + src/Domain/Metrics/Code/Functions.php:13 + Line exceeds 80 characters; contains 84 characters +
  • +
  • + + src/Domain/Metrics/Code/Functions.php:16 + Line exceeds 80 characters; contains 82 characters +
  • +
  • + + src/Domain/Metrics/Code/Functions.php:18 + Line exceeds 80 characters; contains 88 characters +
  • +
  • + + src/Domain/Metrics/Code/Functions.php:30 + Line exceeds 80 characters; contains 112 characters +
  • +
  • + + src/Domain/Metrics/Code/Code.php:13 + Line exceeds 80 characters; contains 81 characters +
  • +
  • + + src/Domain/Metrics/Code/Code.php:15 + Line exceeds 80 characters; contains 88 characters +
  • +
  • + + src/Domain/Metrics/Code/Code.php:16 + Line exceeds 80 characters; contains 91 characters +
  • +
  • + + src/Domain/Metrics/Code/Code.php:17 + Line exceeds 80 characters; contains 82 characters +
  • +
  • + + src/Domain/Metrics/Code/Code.php:18 + Line exceeds 80 characters; contains 88 characters +
  • +
  • + + src/Domain/Metrics/Code/Code.php:19 + Line exceeds 80 characters; contains 87 characters +
  • +
  • + + src/Domain/Metrics/Code/Code.php:20 + Line exceeds 80 characters; contains 91 characters +
  • +
  • + + src/Domain/Metrics/Code/Code.php:21 + Line exceeds 80 characters; contains 88 characters +
  • +
  • + + src/Domain/Metrics/Code/Code.php:25 + Line exceeds 80 characters; contains 82 characters +
  • +
  • + + src/Domain/Metrics/Code/Code.php:27 + Line exceeds 80 characters; contains 83 characters +
  • +
  • + + src/Domain/Metrics/Code/Code.php:29 + Line exceeds 80 characters; contains 84 characters +
  • +
  • + + src/Domain/Metrics/Code/Code.php:33 + Line exceeds 80 characters; contains 103 characters +
  • +
  • + + src/Domain/Metrics/Code/Code.php:35 + Line exceeds 80 characters; contains 86 characters +
  • +
  • + + src/Domain/Metrics/Code/Code.php:37 + Line exceeds 80 characters; contains 90 characters +
  • +
  • + + src/Domain/Metrics/Code/Code.php:39 + Line exceeds 80 characters; contains 88 characters +
  • +
  • + + src/Domain/Metrics/Code/Code.php:44 + Line exceeds 80 characters; contains 83 characters +
  • +
  • + + src/Domain/Metrics/Code/Code.php:45 + Line exceeds 80 characters; contains 101 characters +
  • +
  • + + src/Domain/Metrics/Code/Comments.php:20 + Line exceeds 80 characters; contains 81 characters +
  • +
  • + + src/Domain/Metrics/Code/Comments.php:34 + Line exceeds 80 characters; contains 111 characters +
  • +
  • + + src/Domain/Metrics/Code/Classes.php:15 + Line exceeds 80 characters; contains 88 characters +
  • +
  • + + src/Domain/Metrics/Code/Classes.php:18 + Line exceeds 80 characters; contains 85 characters +
  • +
  • + + src/Domain/Metrics/Code/Classes.php:23 + Line exceeds 80 characters; contains 83 characters +
  • +
  • + + src/Domain/Metrics/Code/Classes.php:32 + Line exceeds 80 characters; contains 109 characters +
  • +
  • + + src/Domain/Metrics/Code/Globally.php:23 + Line exceeds maximum limit of 120 characters; contains 122 characters +
  • +
  • + + src/Domain/Metrics/Style/Style.php:8 + Line exceeds 80 characters; contains 81 characters +
  • +
  • + + src/Domain/Metrics/Style/Style.php:14 + Line exceeds 80 characters; contains 88 characters +
  • +
  • + + src/Domain/Metrics/Style/Style.php:15 + Line exceeds 80 characters; contains 90 characters +
  • +
  • + + src/Domain/Metrics/Style/Style.php:17 + Line exceeds 80 characters; contains 83 characters +
  • +
  • + + src/Domain/Metrics/Style/Style.php:18 + Line exceeds 80 characters; contains 81 characters +
  • +
  • + + src/Domain/Metrics/Style/Style.php:26 + Line exceeds 80 characters; contains 82 characters +
  • +
  • + + src/Domain/Metrics/Style/Style.php:27 + Line exceeds 80 characters; contains 89 characters +
  • +
  • + + src/Domain/Metrics/Style/Style.php:29 + Line exceeds 80 characters; contains 87 characters +
  • +
  • + + src/Domain/Metrics/Style/Style.php:35 + Line exceeds 80 characters; contains 83 characters +
  • +
  • + + src/Domain/Metrics/Style/Style.php:36 + Line exceeds 80 characters; contains 83 characters +
  • +
  • + + src/Domain/Metrics/Style/Style.php:40 + Line exceeds 80 characters; contains 84 characters +
  • +
  • + + src/Domain/Metrics/Style/Style.php:41 + Line exceeds 80 characters; contains 81 characters +
  • +
  • + + src/Domain/Metrics/Architecture/Traits.php:23 + Line exceeds maximum limit of 120 characters; contains 126 characters +
  • +
  • + + src/Domain/Metrics/Architecture/Classes.php:47 + Line exceeds 80 characters; contains 120 characters +
  • +
  • + + src/Domain/Metrics/Architecture/Globally.php:14 + Line exceeds maximum limit of 120 characters; contains 137 characters +
  • +
  • + + src/Domain/Metrics/Architecture/Globally.php:16 + Line exceeds 80 characters; contains 102 characters +
  • +
  • + + src/Domain/Metrics/Architecture/Namespaces.php:10 + Line exceeds 80 characters; contains 82 characters +
  • +
  • + + src/Domain/Metrics/Architecture/Interfaces.php:22 + Line exceeds maximum limit of 120 characters; contains 123 characters +
  • +
  • + + src/Domain/Insights/ForbiddenPrivateMethods.php:16 + Line exceeds 80 characters; contains 97 characters +
  • +
  • + + src/Domain/Insights/InsightFactory.php:49 + Line exceeds 80 characters; contains 102 characters +
  • +
  • + + src/Domain/Insights/InsightFactory.php:74 + Line exceeds 80 characters; contains 87 characters +
  • +
  • + + src/Domain/Insights/InsightFactory.php:84 + Line exceeds 80 characters; contains 105 characters +
  • +
  • + + src/Domain/Insights/InsightFactory.php:86 + Line exceeds 80 characters; contains 102 characters +
  • +
  • + + src/Domain/Insights/InsightFactory.php:103 + Line exceeds 80 characters; contains 85 characters +
  • +
  • + + src/Domain/Insights/InsightFactory.php:107 + Line exceeds 80 characters; contains 84 characters +
  • +
  • + + src/Domain/Insights/InsightCollectionFactory.php:35 + Line exceeds 80 characters; contains 85 characters +
  • +
  • + + src/Domain/Insights/InsightCollectionFactory.php:59 + Line exceeds 80 characters; contains 110 characters +
  • +
  • + + src/Domain/Insights/InsightCollectionFactory.php:61 + Line exceeds 80 characters; contains 81 characters +
  • +
  • + + src/Domain/Insights/InsightCollectionFactory.php:69 + Line exceeds 80 characters; contains 104 characters +
  • +
  • + + src/Domain/Insights/InsightCollectionFactory.php:72 + Line exceeds 80 characters; contains 93 characters +
  • +
  • + + src/Domain/Insights/InsightCollectionFactory.php:75 + Line exceeds maximum limit of 120 characters; contains 160 characters +
  • +
  • + + src/Domain/Insights/InsightCollectionFactory.php:76 + Line exceeds 80 characters; contains 90 characters +
  • +
  • + + src/Domain/Insights/InsightCollectionFactory.php:85 + Line exceeds 80 characters; contains 93 characters +
  • +
  • + + src/Domain/Insights/Composer/ComposerLockMustBeFresh.php:28 + Line exceeds 80 characters; contains 90 characters +
  • +
  • + + src/Domain/Insights/Composer/ComposerLockMustBeFresh.php:35 + Line exceeds 80 characters; contains 101 characters +
  • +
  • + + src/Domain/Insights/Composer/ComposerMustContainName.php:24 + Line exceeds 80 characters; contains 86 characters +
  • +
  • + + src/Domain/Insights/Composer/ComposerMustContainName.php:29 + Line exceeds 80 characters; contains 119 characters +
  • +
  • + + src/Domain/Insights/Composer/ComposerMustContainName.php:34 + Line exceeds 80 characters; contains 85 characters +
  • +
  • + + src/Domain/Insights/Composer/ComposerMustBeValid.php:32 + Line exceeds maximum limit of 120 characters; contains 129 characters +
  • +
  • + + src/Domain/Insights/Composer/ComposerMustBeValid.php:34 + Line exceeds 80 characters; contains 94 characters +
  • +
  • + + src/Domain/Insights/Composer/ComposerMustBeValid.php:46 + Line exceeds 80 characters; contains 95 characters +
  • +
  • + + src/Domain/Insights/SniffDecorator.php:55 + Line exceeds 80 characters; contains 85 characters +
  • +
  • + + src/Domain/Insights/SniffDecorator.php:71 + Line exceeds 80 characters; contains 98 characters +
  • +
  • + + src/Domain/Insights/ForbiddenUsingGlobals.php:16 + Line exceeds 80 characters; contains 87 characters +
  • +
  • + + src/Domain/Insights/ForbiddenFinalClasses.php:19 + Line exceeds maximum limit of 120 characters; contains 135 characters +
  • +
  • + + src/Domain/Insights/ForbiddenNormalClasses.php:19 + Line exceeds 80 characters; contains 118 characters +
  • +
  • + + src/Domain/Insights/ForbiddenSecurityIssues.php:43 + Line exceeds 80 characters; contains 99 characters +
  • +
  • + + src/Domain/Insights/ForbiddenSecurityIssues.php:65 + Line exceeds 80 characters; contains 92 characters +
  • +
  • + + src/Domain/Insights/ForbiddenDefineGlobalConstants.php:17 + Line exceeds 80 characters; contains 86 characters +
  • +
  • + + src/Domain/Insights/ForbiddenDefineGlobalConstants.php:34 + Line exceeds 80 characters; contains 87 characters +
  • +
  • + + src/Domain/Insights/Laravel/ComposerCheckLaravelVersion.php:16 + Line exceeds 80 characters; contains 86 characters +
  • +
  • + + src/Domain/Insights/Laravel/ComposerCheckLaravelVersion.php:23 + Line exceeds 80 characters; contains 84 characters +
  • +
  • + + src/Domain/Insights/Laravel/ComposerCheckLaravelVersion.php:28 + Line exceeds 80 characters; contains 95 characters +
  • +
  • + + src/Domain/Insights/ForbiddenGlobals.php:19 + Line exceeds 80 characters; contains 83 characters +
  • +
  • + + src/Domain/Insights/ForbiddenGlobals.php:29 + Line exceeds 80 characters; contains 85 characters +
  • +
  • + + src/Domain/Insights/ForbiddenGlobals.php:31 + Line exceeds 80 characters; contains 111 characters +
  • +
  • + + src/Domain/Insights/CyclomaticComplexityIsHigh.php:27 + Line exceeds 80 characters; contains 108 characters +
  • +
  • + + src/Domain/Results.php:32 + Line exceeds 80 characters; contains 112 characters +
  • +
  • + + src/Domain/Results.php:104 + Line exceeds 80 characters; contains 95 characters +
  • +
  • + + src/Domain/Results.php:111 + Line exceeds 80 characters; contains 86 characters +
  • +
  • + + src/Domain/Results.php:138 + Line exceeds 80 characters; contains 92 characters +
  • +
  • + + src/Domain/Results.php:143 + Line exceeds 80 characters; contains 90 characters +
  • +
  • + + src/Domain/Collector.php:265 + Line exceeds 80 characters; contains 91 characters +
  • +
  • + + src/Domain/Collector.php:266 + Line exceeds 80 characters; contains 81 characters +
  • +
  • + + src/Domain/Collector.php:323 + Line exceeds 80 characters; contains 93 characters +
  • +
  • + + src/Domain/Collector.php:373 + Line exceeds 80 characters; contains 84 characters +
  • +
  • + + src/Domain/Collector.php:382 + Line exceeds 80 characters; contains 81 characters +
  • +
  • + + src/Domain/Collector.php:384 + Line exceeds 80 characters; contains 89 characters +
  • +
  • + + src/Domain/Collector.php:767 + Line exceeds 80 characters; contains 94 characters +
  • +
  • + + src/Domain/Collector.php:998 + Line exceeds 80 characters; contains 85 characters +
  • +
  • + + src/Domain/Collector.php:1006 + Line exceeds 80 characters; contains 93 characters +
  • +
  • + + src/Domain/Collector.php:1064 + Line exceeds maximum limit of 120 characters; contains 133 characters +
  • +
  • + + src/Domain/Collector.php:1072 + Line exceeds 80 characters; contains 96 characters +
  • +
  • + + src/Domain/Collector.php:1080 + Line exceeds 80 characters; contains 92 characters +
  • +
  • + + src/Domain/Collector.php:1100 + Line exceeds maximum limit of 120 characters; contains 137 characters +
  • +
  • + + src/Domain/Collector.php:1120 + Line exceeds 80 characters; contains 82 characters +
  • +
  • + + src/Domain/File.php:62 + Line exceeds 80 characters; contains 85 characters +
  • +
  • + + src/Domain/File.php:69 + Line exceeds 80 characters; contains 118 characters +
  • +
  • + + src/Domain/Analyser.php:168 + Line exceeds 80 characters; contains 87 characters +
  • +
  • + + src/Domain/Analyser.php:193 + Line exceeds 80 characters; contains 81 characters +
  • +
  • + + src/Domain/Analyser.php:204 + Line exceeds 80 characters; contains 84 characters +
  • +
  • + + src/Domain/Analyser.php:310 + Line exceeds 80 characters; contains 101 characters +
  • +
  • + + src/Domain/Analyser.php:322 + Line exceeds 80 characters; contains 96 characters +
  • +
  • + + src/Domain/Analyser.php:328 + Line exceeds 80 characters; contains 81 characters +
  • +
  • + + src/Domain/Analyser.php:330 + Line exceeds 80 characters; contains 102 characters +
  • +
  • + + src/Domain/Analyser.php:370 + Line exceeds 80 characters; contains 108 characters +
  • +
  • + + src/Domain/Analyser.php:376 + Line exceeds 80 characters; contains 94 characters +
  • +
  • + + src/Domain/Analyser.php:378 + Line exceeds 80 characters; contains 116 characters +
  • +
  • + + src/Domain/Runner.php:26 + Line exceeds 80 characters; contains 85 characters +
  • +
  • + + src/Domain/Runner.php:99 + Line exceeds 80 characters; contains 89 characters +
  • +
  • + + src/Domain/Kernel.php:33 + Line exceeds 80 characters; contains 98 characters +
  • +
  • + + src/Domain/Kernel.php:35 + Line exceeds 80 characters; contains 88 characters +
  • +
+
+
+
+ +
+ + + + + diff --git a/docs/get-started.md b/docs/get-started.md index 4bddaddc..de309f1d 100644 --- a/docs/get-started.md +++ b/docs/get-started.md @@ -133,11 +133,18 @@ For changing the output format you can add the `format` flag. The following form - console - json - checkstyle +- html ```bash ./vendor/bin/phpinsights analyse --format=json ``` +::: Twig for HTML +The HTML formatter requires Twig to render. +So you have to add it do your dependencies if you want to use it. +`composer require --dev twig/twig: ^2.0` +::: + ## Saving output to file You can pipe the result to a file or to anywhere you like. @@ -145,6 +152,7 @@ A common use case is parsing the output formatted as json to a json file. ```bash ./vendor/bin/phpinsights analyse --format=json > test.json +./vendor/bin/phpinsights analyse --format=html > test.html ``` When piping the result remember to add the no interaction flag `-n`, as the part where you need to interact is also getting piped. (the json format does not have any interaction) diff --git a/phpstan.neon b/phpstan.neon index 71da8796..f3922e3b 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -25,6 +25,7 @@ parameters: - '#Access to an undefined property PHP_CodeSniffer\\Sniffs\\Sniff::\$#' - '#NunoMaduro\\PhpInsights\\Application\\Console\\Formatters\\Json has an unused parameter \$input#' - '#NunoMaduro\\PhpInsights\\Application\\Console\\Formatters\\Checkstyle has an unused parameter \$input#' + - '#NunoMaduro\\PhpInsights\\Application\\Console\\Formatters\\Html has an unused parameter \$input#' - '#In method "NunoMaduro\\PhpInsights\\Domain\\File::process", caught "Throwable" must be rethrown#' - '#In method "NunoMaduro\\PhpInsights\\Domain\\FileProcessors\\FixerFileProcessor::processFile", caught "Throwable" must be rethrown#' - '#Empty catch block. If you are sure this is meant to be empty, please add a "// @ignoreException" comment in the catch block.#' diff --git a/src/Application/Console/Formatters/FormatResolver.php b/src/Application/Console/Formatters/FormatResolver.php index 14c38c81..ff51f8d3 100644 --- a/src/Application/Console/Formatters/FormatResolver.php +++ b/src/Application/Console/Formatters/FormatResolver.php @@ -20,6 +20,7 @@ final class FormatResolver 'checkstyle' => Checkstyle::class, 'github-action' => GithubAction::class, 'codeclimate' => CodeClimate::class, + 'html' => Html::class, ]; public static function resolve( diff --git a/src/Application/Console/Formatters/Html.php b/src/Application/Console/Formatters/Html.php new file mode 100644 index 00000000..a2eadfc4 --- /dev/null +++ b/src/Application/Console/Formatters/Html.php @@ -0,0 +1,70 @@ +output = $output; + } + + /** + * Format the result to the desired format. + * + * @param InsightCollection $insightCollection + * @param string $dir + * @param array $metrics + * + * @throws Exception + */ + public function format( + InsightCollection $insightCollection, + string $dir, + array $metrics + ): void { + $this->output->write($this->getTwig()->render('dashboard.html.twig', [ + 'dir' => $dir, + 'results' => $insightCollection->results(), + 'insights' => $insightCollection, + ]), false, OutputInterface::OUTPUT_RAW); + } + + private function getTwig(): Twig + { + $loader = new FilesystemLoader(__DIR__.'/../../../../views'); + $twig = new Twig($loader, [ + 'cache' => false, + 'debug' => true, + ]); + + $twig->addFilter(new TwigFilter('sluggify', static function (string $slug): string { + $slug = preg_replace('/<(.*?)>/u', '', (string) $slug); + $slug = preg_replace('/[\'"‘’“”]/u', '', (string) $slug); + $slug = mb_strtolower((string) $slug, 'UTF-8'); + + preg_match_all('/[\p{L}\p{N}\.]+/u', (string) $slug, $words); + + return implode('-', array_filter($words[0])); + })); + + return $twig; + } +} diff --git a/src/Domain/Insights/InsightCollection.php b/src/Domain/Insights/InsightCollection.php index 1d5c5a49..255c3dbd 100644 --- a/src/Domain/Insights/InsightCollection.php +++ b/src/Domain/Insights/InsightCollection.php @@ -38,6 +38,14 @@ public function getCollector(): Collector return $this->collector; } + /** + * @return array> + */ + public function getInsightsPerMetric(): array + { + return $this->insightsPerMetric; + } + /** * Gets all insights. * diff --git a/views/dashboard.html.twig b/views/dashboard.html.twig new file mode 100644 index 00000000..b30edd7b --- /dev/null +++ b/views/dashboard.html.twig @@ -0,0 +1,46 @@ + + + + + + + + + + PHP Insights + + +
+ +

PHP Insights

+ +

+ + {{ dir }} +

+ +
+
{% include 'partials/stats_per_metric.html.twig' with {'id': 'quality', 'title': 'code quality', 'score': results.codeQuality} %}
+
{% include 'partials/stats_per_metric.html.twig' with {'id': 'complexity', 'title': 'complexity', 'score': results.complexity} %}
+
{% include 'partials/stats_per_metric.html.twig' with {'id': 'structure', 'title': 'structure', 'score': results.structure} %}
+
{% include 'partials/stats_per_metric.html.twig' with {'id': 'style', 'title': 'style', 'score': results.style} %}
+
+ +
+ score scale: + 1 - 49 + 50 - 79 + 80 - 100 +
+ + {% include 'partials/insights_per_metric.html.twig' with {'id': 'quality', 'title': 'code quality', 'metricNamespacePart': '\\Code\\'} %} + {% include 'partials/insights_per_metric.html.twig' with {'id': 'complexity', 'title': 'complexity', 'metricNamespacePart': '\\Complexity\\'} %} + {% include 'partials/insights_per_metric.html.twig' with {'id': 'structure', 'title': 'structure', 'metricNamespacePart': '\\Architecture\\'} %} + {% include 'partials/insights_per_metric.html.twig' with {'id': 'style', 'title': 'style', 'metricNamespacePart': '\\Style\\'} %} + +
+ + + + + diff --git a/views/partials/insights_per_metric.html.twig b/views/partials/insights_per_metric.html.twig new file mode 100644 index 00000000..2c1fc6b4 --- /dev/null +++ b/views/partials/insights_per_metric.html.twig @@ -0,0 +1,35 @@ +

{{ title }}

+
+ {% for metric, insightsPerMetric in insights.insightsPerMetric %} + {% if metricNamespacePart in metric %} + {% for insight in insightsPerMetric %} + {% if insight.hasIssue() %} +
+
+ + {{ insight.title }} + ({{ insight.details|length }}) + {{ insight.insightClass }} +
+
+
    + {% for detail in insight.details %} +
  • + {% if detail.hasFile() %} + + {{ detail.file }}{% if detail.hasLine() %}:{{ detail.line }}{% endif %}{% if detail.hasFunction() %}:{{ detail.function }}{% endif %} + + {% endif %} + {% if detail.hasMessage() %} + {{ detail.message }} + {% endif %} +
  • + {% endfor %} +
+
+
+ {% endif %} + {% endfor %} + {% endif %} + {% endfor %} +
diff --git a/views/partials/stats_per_metric.html.twig b/views/partials/stats_per_metric.html.twig new file mode 100644 index 00000000..af4a8b58 --- /dev/null +++ b/views/partials/stats_per_metric.html.twig @@ -0,0 +1,5 @@ +
+ {{ title }} + +
{{ score|number_format(1, '.') }} %
+