nunomaduro / phpinsights

🔰 Instant PHP quality checks from your console
https://phpinsights.com
MIT License
5.3k stars 281 forks source link

Different results between CI and local development environment #104

Closed ghost closed 5 years ago

ghost commented 5 years ago
Q A
Bug report? no
Feature request? no
Library version 1.2.1

I have now added phpinsights as a command to ScrutinizerCI. Actually, I would expect to get the same results in a CI tool and in my local development environment (Laravel Homestead), but that wasn't the case.

These phpinsights rules were active in ScrutinizerCI • [Code] Forbidden public property: • [Code] 1 unused private attributes: • [Code] No setter: • [Code] Element name minimal length: • [Code] Useless overriding method: • [Code] Unused parameter: • [Code] Useless parentheses: • [Code] Declare strict types: • [Code] Empty comment: • [Code] Todo: • [Code] Disallow mixed type hint: • [Code] Type hint declaration: • [Code] Useless constant type hint: • [Code] Static closure: • [Complexity] Having classes with more than 5 cyclomatic complexity is prohibited - Consider refactoring: • [Architecture] Normal classes are forbidden. Classes must be final or abstract: • [Architecture] Class trait and interface length: • [Architecture] Property per class limit: • [Architecture] Function length: • [Architecture] The use of traits is prohibited: • [Style] Object operator indent: • [Style] Line length: • [Style] Alphabetically sorted uses:

These phpinsights rules were active in Laravel Homestead. • [Code] Forbidden public property: • [Code] 1 unused private attributes: • [Code] No setter: • [Code] Element name minimal length: • [Code] Useless overriding method: • [Code] Unused parameter: • [Code] Useless parentheses: • [Code] Empty comment: • [Code] Todo: • [Code] Useless constant type hint: • [Code] Static closure: • [Complexity] Having classes with more than 5 cyclomatic complexity is prohibited - Consider refactoring: • [Architecture] Class trait and interface length: • [Architecture] Property per class limit: • [Architecture] Function length: • [Style] Object operator indent: • [Style] Line length:

Has anyone made similar or the same experiences?

I've also checked if the laravel config file and phpinsights are in its latest version and both things are checked.

olivernybroe commented 5 years ago

Are you using the same php version in CI and homestead?

ghost commented 5 years ago

yes i do

olivernybroe commented 5 years ago

How are you running phpinsights? Could you share your command on both CI and local for when you run it.

ghost commented 5 years ago

When I started using php insights in Scrutinizer CI, the short bin path didn't worked, so I use the long version.

Scrutinizer CI vendor/nunomaduro/phpinsights/bin/phpinsights analyse --ansi -v --no-interaction

homestead php artisan insights

olivernybroe commented 5 years ago

So what I can see from here is that the config/insights.php file is not being passed to your CI command. Try doing vendor/nunomaduro/phpinsights/bin/phpinsights analyse --ansi -v --no-interaction --config-path=config/insights.php

A better approach would be to change your CI to also use php artisan insights.