Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

What does phpinsights think of itself? #24

Closed
szepeviktor opened this issue May 8, 2019 · 8 comments
Closed

What does phpinsights think of itself? #24

szepeviktor opened this issue May 8, 2019 · 8 comments
Labels
enhancement New feature or request

Comments

@szepeviktor
Copy link
Contributor

I think phpinsights should have a clean output when being executed on itself.

What are you thinking?

@owenvoke
Copy link
Contributor

owenvoke commented May 8, 2019

It's still WIP. So maybe in future. 🤔 Have you tried running it on itself?

@szepeviktor
Copy link
Contributor Author

• [Code] Forbidden public property:
  src/Domain/File.php:24: Do not use public properties. Use method access instead.
  src/Domain/File.php:29: Do not use public properties. Use method access instead.

• [Code] Element name minimal length:
  src/Domain/Insights/CyclomaticComplexityIsHigh.php:43: Variable name "a" is only 1 chars long. Must be at least 3.
  src/Domain/Insights/ForbiddenSecurityIssues.php:69: Variable name "e" is only 1 chars long. Must be at least 3.
  src/Domain/Insights/ForbiddenSecurityIssues.php:73: Variable name "e" is only 1 chars long. Must be at least 3.
  +36 issues omitted

• [Code] Max nesting level:
  src/Domain/File.php:111: Only 2 indentation levels per function/method. Found 3 levels.
  src/Domain/Insights/InsightFactory.php:87: Only 2 indentation levels per function/method. Found 3 levels.
  src/Domain/Insights/InsightFactory.php:115: Only 2 indentation levels per function/method. Found 3 levels.
  +2 issues omitted

• [Code] Multiple statement alignment:
  src/Domain/Results.php:32: Equals sign not aligned with surrounding assignments; expected 11 spaces but found 1 space
  src/Domain/Results.php:118: Equals sign not aligned with surrounding assignments; expected 10 spaces but found 1 space
  src/Domain/Results.php:119: Equals sign not aligned with surrounding assignments; expected 10 spaces but found 1 space
  +95 issues omitted

• [Code] Trailing array comma:
  src/Application/Adapters/Symfony/Preset.php:32: Multi-line arrays must have a trailing comma after the last element.
  src/Domain/Metrics/Code/Classes.php:72: Multi-line arrays must have a trailing comma after the last element.

• [Code] Unused parameter:
  src/Domain/File.php:184: Unused parameter $severity.
  src/Domain/File.php:185: Unused parameter $isFixable.
  src/Infrastructure/Repositories/LocalFilesRepository.php:70: Unused parameter $source.
  +4 issues omitted

• [Code] Disallow equal operators:
  src/Domain/Analyser.php:213: Operator != is disallowed, use !== instead.
  src/Domain/Analyser.php:321: Operator != is disallowed, use !== instead.
  src/Domain/Collector.php:941: Operator != is disallowed, use !== instead.

• [Code] Declare strict types:
  src/Domain/Exceptions/ComposerNotFound.php:1: Missing declare(strict_types=1).
  src/Domain/Exceptions/DirectoryNotFound.php:1: Missing declare(strict_types=1).
  src/Domain/Exceptions/InternetConnectionNotFound.php:1: Missing declare(strict_types=1).
  +4 issues omitted

• [Code] Including file:
  src/Application/Console/Commands/AnalyseCommand.php:88: File is being conditionally included; use "include" instead
  src/Domain/Container.php:25: File is being conditionally included; use "include" instead
  src/Domain/EcsContainer.php:31: File is being conditionally included; use "include" instead
  +1 issues omitted

• [Code] Disallow one line property doc comment:
  src/Application/Console/Commands/InvokableCommand.php:14: Found one-line comment for property \NunoMaduro\PhpInsights\Application\Console\Commands\InvokableCommand::$callable, use multi-line comment instead.

• [Code] Require one line property doc comment:
  src/Domain/Results.php:14: Found multi-line comment for property \NunoMaduro\PhpInsights\Domain\Results::$collector with single line content, use one-line comment instead.
  src/Domain/Results.php:19: Found multi-line comment for property \NunoMaduro\PhpInsights\Domain\Results::$perCategoryInsights with single line content, use one-line comment instead.
  src/Infrastructure/Repositories/LocalFilesRepository.php:15: Found multi-line comment for property \NunoMaduro\PhpInsights\Infrastructure\Repositories\LocalFilesRepository::$finder with single line content, use one-line comment instead.
  +85 issues omitted

• [Code] Disallow array type hint syntax:
  src/Domain/Metrics/Architecture/Namespaces.php:27: Usage of array type hint syntax in "string[]" is disallowed, use generic type hint syntax instead.
  src/Domain/MetricsFinder.php:19: Usage of array type hint syntax in "string[]" is disallowed, use generic type hint syntax instead.
  src/Domain/Reflection.php:39: Usage of array type hint syntax in "string[]" is disallowed, use generic type hint syntax instead.
  +58 issues omitted

• [Code] Disallow mixed type hint:
  src/Domain/Reflection.php:57: Usage of "mixed" type hint is disallowed.

• [Code] Type hint declaration:
  src/Domain/Insights/InsightFactory.php:62: @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:83: @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/InsightFactory.php:132: @param annotation of method \NunoMaduro\PhpInsights\Domain\Insights\InsightFactory::getSniffCollector() does not specify type hint for items of its traversable parameter $config.
  +99 issues omitted

• [Code] Useless inherit doc comment:
  src/Domain/Metrics/Code/Globally.php:24: Useless documentation comment with @inheritDoc.
  src/Domain/Metrics/Complexity/Complexity.php:14: Useless documentation comment with @inheritDoc.
  src/Infrastructure/Repositories/LocalFilesRepository.php:35: Useless documentation comment with @inheritDoc.
  +64 issues omitted

• [Code] Unused function parameter:
  src/Domain/File.php:177: The method parameter $severity is never used
  src/Domain/File.php:177: The method parameter $isError is never used
  src/Infrastructure/Repositories/LocalFilesRepository.php:70: The method parameter $source is never used
  +2 issues omitted

• [Code] Function call signature:
  src/Domain/Insights/ForbiddenSecurityIssues.php:67: Multi-line function call not indented correctly; expected 16 spaces but found 24
  src/Domain/Insights/ForbiddenSecurityIssues.php:67: Only one argument is allowed per line in a multi-line function call
  src/Domain/Insights/InsightCollection.php:94: Only one argument is allowed per line in a multi-line function call
  +8 issues omitted

• [Code] Fully qualified global functions:
  src/Domain/Results.php:129: Function number_format() should be referenced via a fully qualified name.
  src/Infrastructure/Repositories/LocalFilesRepository.php:40: Function getcwd() should be referenced via a fully qualified name.
  src/Infrastructure/Repositories/LocalFilesRepository.php:59: Function substr() should be referenced via a fully qualified name.
  +174 issues omitted

• [Code] Static closure:
  src/Domain/Insights/CyclomaticComplexityIsHigh.php:48: Closure not using "$this" should be declared static.
  src/Domain/Insights/InsightCollectionFactory.php:73: Closure not using "$this" should be declared static.
  src/Domain/Insights/Sniff.php:79: Closure not using "$this" should be declared static.
  +7 issues omitted

• [Complexity] Having `classes` with more than 5 cyclomatic complexity is prohibited - Consider refactoring:
  src/Domain/Insights/InsightFactory.php: 10 cyclomatic complexity
  src/Application/Console/Style.php: 18 cyclomatic complexity
  src/Domain/Analyser.php: 94 cyclomatic complexity
  +7 issues omitted

• [Architecture] Class trait and interface length:
  src/Domain/Analyser.php:20: Your class is too long. Currently using 373 lines. Can be up to 200 lines.
  src/Domain/Collector.php:13: Your class is too long. Currently using 1083 lines. Can be up to 200 lines.
  src/Domain/File.php:19: Your class is too long. Currently using 213 lines. Can be up to 200 lines.
  +1 issues omitted

• [Architecture] Method per class limit:
  src/Domain/Collector.php:13: Class has too many methods: 102. Can be up to 10 methods.

• [Architecture] Property per class limit:
  src/Domain/Collector.php:13: "class" has too many properties: 40. Can be up to 10 properties.

• [Architecture] Function length:
  src/Domain/Metrics/Code/Code.php:74: Your function is too long. Currently using 58 lines. Can be up to 20 lines.
  src/Domain/Metrics/Code/Comments.php:48: Your function is too long. Currently using 21 lines. Can be up to 20 lines.
  src/Domain/Metrics/Style/Style.php:64: Your function is too long. Currently using 56 lines. Can be up to 20 lines.
  +14 issues omitted

• [Style] End file newline:
  src/Domain/Container.php:30: Expected 1 newline at end of file; 0 found
  src/Domain/Contracts/Sniffer.php:29: Expected 1 newline at end of file; 0 found
  src/Domain/EcsContainer.php:36: Expected 1 newline at end of file; 0 found
  +2 issues omitted

• [Style] Line length:
  src/Domain/Results.php:30: Line exceeds maximum limit of 100 characters; contains 112 characters
  src/Domain/Results.php:127: Line exceeds 80 characters; contains 92 characters
  stubs/laravel.php:65: Line exceeds 80 characters; contains 83 characters
  +208 issues omitted

• [Style] Else if declaration:
  src/Domain/Analyser.php:261: Usage of ELSE IF is discouraged; use ELSEIF instead
  src/Domain/Analyser.php:357: Usage of ELSE IF is discouraged; use ELSEIF instead
  src/Domain/Analyser.php:372: Usage of ELSE IF is discouraged; use ELSEIF instead
  +8 issues omitted

• [Style] Alphabetically sorted uses:
  src/Application/Console/Commands/InvokableCommand.php:8: Use statements should be sorted alphabetically. The first wrong one is Symfony\Component\Console\Command\Command.
  src/Domain/Insights/InsightCollectionFactory.php:10: Use statements should be sorted alphabetically. The first wrong one is HasInsights.

• [Style] Namespace spacing:
  src/Domain/Exceptions/ComposerNotFound.php:5: Expected 1 lines before namespace statement, found 3.

• [Style] Unused uses:
  src/Domain/Metrics/Style/Style.php:32: Type PHP_CodeSniffer\Standards\Generic\Sniffs\WhiteSpace\ScopeIndentSniff is not used in this file.
  src/Domain/Metrics/Style/Style.php:47: Type SlevomatCodingStandard\Sniffs\Namespaces\MultipleUsesPerLineSniff is not used in this file.
  src/Domain/Metrics/Style/Style.php:49: Type SlevomatCodingStandard\Sniffs\Namespaces\ReferenceUsedNamesOnlySniff is not used in this file.
  +5 issues omitted

• [Style] Use spacing:
  src/Domain/Insights/InsightCollectionFactory.php:14: Expected 0 lines between same types of use statement, found 3.

• [Style] Doc comment spacing:
  src/Domain/Analyser.php:18: Expected 1 lines between different annotations types, found 0.

• [Style] Class instantiation:
  src/Application/Console/OutputDecorator.php:35: Parentheses must be used when instantiating a new class
  src/Application/Console/Style.php:202: Parentheses must be used when instantiating a new class
  src/Domain/Insights/InsightCollectionFactory.php:99: Parentheses must be used when instantiating a new class
  +2 issues omitted

@nunomaduro
Copy link
Owner

Ideally, PHP Insights should return a result plus and exit code. Any ideas on this?

@nunomaduro nunomaduro added the enhancement New feature or request label May 8, 2019
@szepeviktor
Copy link
Contributor Author

szepeviktor commented May 8, 2019

Ideally, PHP Insights should return a result plus and exit code. Any ideas on this?

Yes, this forced terminal usage may not make it popular in automation.

@nunomaduro
Copy link
Owner

Not sure on that buddy, as we have a quality result out of this.

@ijpatricio
Copy link

If I understood correctly, what could be done are output formats, not only terminal.

Like --output=html or --output=json, so that integrations could happen smoothly, (CI and more)

@ijpatricio
Copy link

Output format, plus the exit code 👍

@szepeviktor
Copy link
Contributor Author

That was in #3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants