presto-player
Last commit date
dist
1 month ago
img
1 month ago
inc
1 month ago
languages
1 month ago
src
1 month ago
templates
2 months ago
vendor
1 month ago
CLAUDE.md
1 month ago
FORCE_UI_SETUP.md
1 month ago
LICENSE
5 years ago
TAILWIND_SETUP.md
1 month ago
index.php
4 years ago
package.json
1 month ago
phpinsights.php
1 month ago
presto-player.php
1 month ago
readme.txt
1 month ago
phpinsights.php
298 lines
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | return [ |
| 6 | |
| 7 | /* |
| 8 | |-------------------------------------------------------------------------- |
| 9 | | Default Preset |
| 10 | |-------------------------------------------------------------------------- |
| 11 | | |
| 12 | | This option controls the default preset that will be used by PHP Insights |
| 13 | | to make your code reliable, simple, and clean. However, you can always |
| 14 | | adjust the `Metrics` and `Insights` below in this configuration file. |
| 15 | | |
| 16 | | Supported: "default", "laravel", "symfony", "magento2", "drupal", "wordpress" |
| 17 | | |
| 18 | */ |
| 19 | |
| 20 | 'preset' => 'wordpress', |
| 21 | |
| 22 | /* |
| 23 | |-------------------------------------------------------------------------- |
| 24 | | IDE |
| 25 | |-------------------------------------------------------------------------- |
| 26 | | |
| 27 | | This options allow to add hyperlinks in your terminal to quickly open |
| 28 | | files in your favorite IDE while browsing your PhpInsights report. |
| 29 | | |
| 30 | | Supported: "textmate", "macvim", "emacs", "sublime", "phpstorm", |
| 31 | | "atom", "vscode". |
| 32 | | |
| 33 | | If you have another IDE that is not in this list but which provide an |
| 34 | | url-handler, you could fill this config with a pattern like this: |
| 35 | | |
| 36 | | myide://open?url=file://%f&line=%l |
| 37 | | |
| 38 | */ |
| 39 | |
| 40 | 'ide' => 'myide://open?url=file://%f&line=%l', |
| 41 | |
| 42 | /* |
| 43 | |-------------------------------------------------------------------------- |
| 44 | | Configuration |
| 45 | |-------------------------------------------------------------------------- |
| 46 | | |
| 47 | | Here you may adjust all the various `Insights` that will be used by PHP |
| 48 | | Insights. You can either add, remove or configure `Insights`. Keep in |
| 49 | | mind, that all added `Insights` must belong to a specific `Metric`. |
| 50 | | |
| 51 | */ |
| 52 | |
| 53 | 'exclude' => [ |
| 54 | 'assets/*', |
| 55 | 'dist/*', |
| 56 | 'node_modules', |
| 57 | 'vendor', |
| 58 | 'tests', |
| 59 | 'tests-e2e', |
| 60 | 'packages/*', |
| 61 | 'inc/lib', |
| 62 | 'inc/Libraries', |
| 63 | 'phpinsights.php', |
| 64 | ], |
| 65 | |
| 66 | 'add' => [ |
| 67 | |
| 68 | ], |
| 69 | |
| 70 | 'remove' => [ |
| 71 | /** |
| 72 | * Globals accesses detected |
| 73 | * ToDo: Remove this rule after fixing the issue |
| 74 | */ |
| 75 | NunoMaduro\PhpInsights\Domain\Insights\ForbiddenGlobals::class, |
| 76 | |
| 77 | /** |
| 78 | * Global keyword |
| 79 | * ToDo: Remove this rule after fixing the issue |
| 80 | */ |
| 81 | PHP_CodeSniffer\Standards\Squiz\Sniffs\PHP\GlobalKeywordSniff::class, |
| 82 | |
| 83 | /** |
| 84 | * Defining global helpers is prohibited |
| 85 | * ToDo: Remove this rule after fixing the issue |
| 86 | */ |
| 87 | NunoMaduro\PhpInsights\Domain\Insights\ForbiddenDefineFunctions::class, |
| 88 | |
| 89 | /** |
| 90 | * Return, Property, Parameter type hint |
| 91 | */ |
| 92 | SlevomatCodingStandard\Sniffs\TypeHints\ReturnTypeHintSniff::class, |
| 93 | SlevomatCodingStandard\Sniffs\TypeHints\PropertyTypeHintSniff::class, |
| 94 | SlevomatCodingStandard\Sniffs\TypeHints\ParameterTypeHintSniff::class, |
| 95 | |
| 96 | /** |
| 97 | * Disallow mixed type hint |
| 98 | */ |
| 99 | SlevomatCodingStandard\Sniffs\TypeHints\DisallowMixedTypeHintSniff::class, |
| 100 | |
| 101 | /** |
| 102 | * Disallow empty |
| 103 | */ |
| 104 | SlevomatCodingStandard\Sniffs\ControlStructures\DisallowEmptySniff::class, |
| 105 | |
| 106 | /** |
| 107 | * Forbidden public property |
| 108 | */ |
| 109 | SlevomatCodingStandard\Sniffs\Classes\ForbiddenPublicPropertySniff::class, |
| 110 | |
| 111 | /** |
| 112 | * Having `classes` with more than 5 cyclomatic complexity is prohibited - Consider refactoring. |
| 113 | */ |
| 114 | NunoMaduro\PhpInsights\Domain\Insights\CyclomaticComplexityIsHigh::class, |
| 115 | |
| 116 | /** |
| 117 | * Function length |
| 118 | */ |
| 119 | SlevomatCodingStandard\Sniffs\Functions\FunctionLengthSniff::class, |
| 120 | |
| 121 | /** |
| 122 | * Valid class name, not in PascalCase format. |
| 123 | */ |
| 124 | PHP_CodeSniffer\Standards\Squiz\Sniffs\Classes\ValidClassNameSniff::class, |
| 125 | |
| 126 | /** |
| 127 | * Indentation conflict with PHPCS. |
| 128 | */ |
| 129 | PhpCsFixer\Fixer\Whitespace\MethodChainingIndentationFixer::class, |
| 130 | |
| 131 | /** |
| 132 | * No spaces around offset. |
| 133 | */ |
| 134 | PhpCsFixer\Fixer\Whitespace\NoSpacesAroundOffsetFixer::class, |
| 135 | |
| 136 | /** |
| 137 | * Side effects. |
| 138 | */ |
| 139 | PHP_CodeSniffer\Standards\PSR1\Sniffs\Files\SideEffectsSniff::class, |
| 140 | |
| 141 | /** |
| 142 | * Arbitrary parentheses spacing |
| 143 | */ |
| 144 | PHP_CodeSniffer\Standards\Generic\Sniffs\WhiteSpace\ArbitraryParenthesesSpacingSniff::class, |
| 145 | |
| 146 | /** |
| 147 | * Character before p h p opening tag |
| 148 | */ |
| 149 | PHP_CodeSniffer\Standards\Generic\Sniffs\PHP\CharacterBeforePHPOpeningTagSniff::class, |
| 150 | |
| 151 | /** |
| 152 | * Disallow tab indent |
| 153 | */ |
| 154 | PHP_CodeSniffer\Standards\Generic\Sniffs\WhiteSpace\DisallowTabIndentSniff::class, |
| 155 | |
| 156 | /** |
| 157 | * Line length |
| 158 | */ |
| 159 | PHP_CodeSniffer\Standards\Generic\Sniffs\Files\LineLengthSniff::class, |
| 160 | |
| 161 | /** |
| 162 | * Binary operator spaces. |
| 163 | */ |
| 164 | PhpCsFixer\Fixer\Operator\BinaryOperatorSpacesFixer::class, |
| 165 | |
| 166 | /** |
| 167 | * No spaces inside parenthesis |
| 168 | */ |
| 169 | PhpCsFixer\Fixer\Whitespace\NoSpacesInsideParenthesisFixer::class, |
| 170 | |
| 171 | /** |
| 172 | * No spaces after function name |
| 173 | */ |
| 174 | PhpCsFixer\Fixer\FunctionNotation\FunctionDeclarationFixer::class, |
| 175 | |
| 176 | /** |
| 177 | * Class definition |
| 178 | */ |
| 179 | PhpCsFixer\Fixer\ClassNotation\ClassDefinitionFixer::class, |
| 180 | |
| 181 | /** |
| 182 | * Method argument space |
| 183 | */ |
| 184 | PhpCsFixer\Fixer\FunctionNotation\MethodArgumentSpaceFixer::class, |
| 185 | |
| 186 | /** |
| 187 | * Braces fixer |
| 188 | */ |
| 189 | PhpCsFixer\Fixer\Basic\BracesFixer::class, |
| 190 | |
| 191 | /** |
| 192 | * Declare strict types. |
| 193 | */ |
| 194 | SlevomatCodingStandard\Sniffs\TypeHints\DeclareStrictTypesSniff::class, |
| 195 | |
| 196 | |
| 197 | /** |
| 198 | * DOC comment spacing |
| 199 | */ |
| 200 | SlevomatCodingStandard\Sniffs\Commenting\DocCommentSpacingSniff::class, |
| 201 | |
| 202 | |
| 203 | /** |
| 204 | * Camel caps method name |
| 205 | */ |
| 206 | PHP_CodeSniffer\Standards\PSR1\Sniffs\Methods\CamelCapsMethodNameSniff::class, |
| 207 | |
| 208 | /** |
| 209 | * Normal classes are forbidden. Classes must be final or abstract |
| 210 | * Todo: Remove this rule after fixing the issue |
| 211 | */ |
| 212 | NunoMaduro\PhpInsights\Domain\Insights\ForbiddenNormalClasses::class, |
| 213 | |
| 214 | /** |
| 215 | * Traits disallowed. |
| 216 | */ |
| 217 | NunoMaduro\PhpInsights\Domain\Insights\ForbiddenTraits::class, |
| 218 | |
| 219 | /** |
| 220 | * Globals prohibited. |
| 221 | */ |
| 222 | NunoMaduro\PhpInsights\Domain\Insights\ForbiddenDefineGlobalConstants::class, |
| 223 | |
| 224 | /** |
| 225 | * Unused parameter. Case: Shortcode callback attr, hook callback attr, etc. |
| 226 | */ |
| 227 | SlevomatCodingStandard\Sniffs\Functions\UnusedParameterSniff::class, |
| 228 | |
| 229 | /** |
| 230 | * Disallow alternate php tags. Case: Backbone template used for search. |
| 231 | */ |
| 232 | PHP_CodeSniffer\Standards\Generic\Sniffs\PHP\DisallowAlternativePHPTagsSniff::class, |
| 233 | |
| 234 | /** |
| 235 | * Used class but still showing as unused. |
| 236 | */ |
| 237 | SlevomatCodingStandard\Sniffs\Namespaces\UnusedUsesSniff::class, |
| 238 | |
| 239 | /** |
| 240 | * Forbidden security issues. |
| 241 | */ |
| 242 | NunoMaduro\PhpInsights\Domain\Insights\ForbiddenSecurityIssues::class, |
| 243 | |
| 244 | PhpCsFixer\Fixer\Comment\NoTrailingWhitespaceInCommentFixer::class, |
| 245 | ], |
| 246 | |
| 247 | 'config' => [ |
| 248 | |
| 249 | ], |
| 250 | |
| 251 | /* |
| 252 | |-------------------------------------------------------------------------- |
| 253 | | Requirements |
| 254 | |-------------------------------------------------------------------------- |
| 255 | | |
| 256 | | Here you may define a level you want to reach per `Insights` category. |
| 257 | | When a score is lower than the minimum level defined, then an error |
| 258 | | code will be returned. This is optional and individually defined. |
| 259 | | |
| 260 | */ |
| 261 | |
| 262 | 'requirements' => [ |
| 263 | // Initial baseline thresholds set just below current scores so CI passes. |
| 264 | // Raise these as code quality improves. |
| 265 | 'min-quality' => 60, |
| 266 | 'min-complexity' => 40, |
| 267 | 'min-architecture' => 80, |
| 268 | 'min-style' => 60, |
| 269 | 'disable-security-check' => false, |
| 270 | ], |
| 271 | |
| 272 | /* |
| 273 | |-------------------------------------------------------------------------- |
| 274 | | Threads |
| 275 | |-------------------------------------------------------------------------- |
| 276 | | |
| 277 | | Here you may adjust how many threads (core) PHPInsights can use to perform |
| 278 | | the analysis. This is optional, don't provide it and the tool will guess |
| 279 | | the max core number available. It accepts null value or integer > 0. |
| 280 | | |
| 281 | */ |
| 282 | |
| 283 | 'threads' => null, |
| 284 | |
| 285 | /* |
| 286 | |-------------------------------------------------------------------------- |
| 287 | | Timeout |
| 288 | |-------------------------------------------------------------------------- |
| 289 | | Here you may adjust the timeout (in seconds) for PHPInsights to run before |
| 290 | | a ProcessTimedOutException is thrown. |
| 291 | | This accepts an int > 0. Default is 60 seconds, which is the default value |
| 292 | | of Symfony's setTimeout function. |
| 293 | | |
| 294 | */ |
| 295 | |
| 296 | 'timeout' => 60, |
| 297 | ]; |
| 298 |