|
| 1 | +<?php |
| 2 | + |
| 3 | +declare(strict_types=1); |
| 4 | + |
| 5 | +use NunoMaduro\PhpInsights\Domain\Insights\CyclomaticComplexityIsHigh; |
| 6 | +use NunoMaduro\PhpInsights\Domain\Insights\ForbiddenDefineFunctions; |
| 7 | +use NunoMaduro\PhpInsights\Domain\Insights\ForbiddenFinalClasses; |
| 8 | +use NunoMaduro\PhpInsights\Domain\Insights\ForbiddenNormalClasses; |
| 9 | +use NunoMaduro\PhpInsights\Domain\Insights\ForbiddenPrivateMethods; |
| 10 | +use NunoMaduro\PhpInsights\Domain\Insights\ForbiddenTraits; |
| 11 | +use NunoMaduro\PhpInsights\Domain\Metrics\Architecture\Classes; |
| 12 | +use NunoMaduro\PhpInsights\Domain\Sniffs\ForbiddenSetterSniff; |
| 13 | +use ObjectCalisthenics\Sniffs\Files\FunctionLengthSniff; |
| 14 | +use ObjectCalisthenics\Sniffs\Metrics\MethodPerClassLimitSniff; |
| 15 | +use ObjectCalisthenics\Sniffs\NamingConventions\ElementNameMinimalLengthSniff; |
| 16 | +use PHP_CodeSniffer\Standards\Generic\Sniffs\Files\LineLengthSniff; |
| 17 | +use SlevomatCodingStandard\Sniffs\Classes\SuperfluousExceptionNamingSniff; |
| 18 | +use SlevomatCodingStandard\Sniffs\Classes\SuperfluousInterfaceNamingSniff; |
| 19 | +use SlevomatCodingStandard\Sniffs\Classes\SuperfluousTraitNamingSniff; |
| 20 | +use SlevomatCodingStandard\Sniffs\Functions\StaticClosureSniff; |
| 21 | +use SlevomatCodingStandard\Sniffs\Namespaces\AlphabeticallySortedUsesSniff; |
| 22 | +use SlevomatCodingStandard\Sniffs\TypeHints\DeclareStrictTypesSniff; |
| 23 | +use SlevomatCodingStandard\Sniffs\TypeHints\TypeHintDeclarationSniff; |
| 24 | + |
| 25 | +return [ |
| 26 | + |
| 27 | + /* |
| 28 | + |-------------------------------------------------------------------------- |
| 29 | + | Default Preset |
| 30 | + |-------------------------------------------------------------------------- |
| 31 | + | |
| 32 | + | This option controls the default preset that will be used by PHP Insights |
| 33 | + | to make your code reliable, simple, and clean. However, you can always |
| 34 | + | adjust the `Metrics` and `Insights` below in this configuration file. |
| 35 | + | |
| 36 | + | Supported: "default", "laravel", "symfony", "magento2", "drupal" |
| 37 | + | |
| 38 | + */ |
| 39 | + |
| 40 | + 'preset' => 'laravel', |
| 41 | + /* |
| 42 | + |-------------------------------------------------------------------------- |
| 43 | + | IDE |
| 44 | + |-------------------------------------------------------------------------- |
| 45 | + | |
| 46 | + | This options allow to add hyperlinks in your terminal to quickly open |
| 47 | + | files in your favorite IDE while browsing your PhpInsights report. |
| 48 | + | |
| 49 | + | Supported: "textmate", "macvim", "emacs", "sublime", "phpstorm", |
| 50 | + | "atom", "vscode". |
| 51 | + | |
| 52 | + | If you have another IDE that is not in this list but which provide an |
| 53 | + | url-handler, you could fill this config with a pattern like this: |
| 54 | + | |
| 55 | + | myide://open?url=file://%f&line=%l |
| 56 | + | |
| 57 | + */ |
| 58 | + |
| 59 | + 'ide' => null, |
| 60 | + /* |
| 61 | + |-------------------------------------------------------------------------- |
| 62 | + | Configuration |
| 63 | + |-------------------------------------------------------------------------- |
| 64 | + | |
| 65 | + | Here you may adjust all the various `Insights` that will be used by PHP |
| 66 | + | Insights. You can either add, remove or configure `Insights`. Keep in |
| 67 | + | mind that all added `Insights` must belong to a specific `Metric`. |
| 68 | + | |
| 69 | + */ |
| 70 | + |
| 71 | + 'exclude' => [ |
| 72 | + // 'path/to/directory-or-file' |
| 73 | + ], |
| 74 | + |
| 75 | + 'add' => [ |
| 76 | + Classes::class => [ |
| 77 | + ForbiddenFinalClasses::class, |
| 78 | + ], |
| 79 | + ], |
| 80 | + |
| 81 | + 'remove' => [ |
| 82 | + AlphabeticallySortedUsesSniff::class, |
| 83 | + DeclareStrictTypesSniff::class, |
| 84 | + ForbiddenDefineFunctions::class, |
| 85 | + ForbiddenNormalClasses::class, |
| 86 | + ForbiddenTraits::class, |
| 87 | + TypeHintDeclarationSniff::class, |
| 88 | + ForbiddenSetterSniff::class, |
| 89 | + SuperfluousExceptionNamingSniff::class, |
| 90 | + SuperfluousInterfaceNamingSniff::class, |
| 91 | + SuperfluousTraitNamingSniff::class, |
| 92 | + CyclomaticComplexityIsHigh::class, |
| 93 | + ], |
| 94 | + |
| 95 | + 'config' => [ |
| 96 | + ForbiddenPrivateMethods::class => [ |
| 97 | + 'title' => 'The usage of private methods is not idiomatic in Laravel.', |
| 98 | + ], |
| 99 | + MethodPerClassLimitSniff::class => [ |
| 100 | + 'maxCount' => 15, |
| 101 | + ], |
| 102 | + LineLengthSniff::class => [ |
| 103 | + 'lineLimit' => 120, |
| 104 | + 'absoluteLineLimit' => 140, |
| 105 | + 'ignoreComments' => false, |
| 106 | + ], |
| 107 | + ElementNameMinimalLengthSniff::class => [ |
| 108 | + 'allowedShortNames' => ['e'], |
| 109 | + ], |
| 110 | + StaticClosureSniff::class => [ |
| 111 | + 'exclude' => [ |
| 112 | + 'src/Provider/RequestQueryParserProvider.php', |
| 113 | + ], |
| 114 | + ], |
| 115 | + FunctionLengthSniff::class => [ |
| 116 | + 'exclude' => [ |
| 117 | + 'src/BuilderParamsApplierTrait.php', |
| 118 | + ], |
| 119 | + ], |
| 120 | + ], |
| 121 | +]; |
0 commit comments