-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathphpinsights.php
More file actions
106 lines (101 loc) · 3.8 KB
/
phpinsights.php
File metadata and controls
106 lines (101 loc) · 3.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
<?php
declare(strict_types=1);
use NunoMaduro\PhpInsights\Domain\Insights\ForbiddenDefineGlobalConstants;
use NunoMaduro\PhpInsights\Domain\Insights\ForbiddenTraits;
use NunoMaduro\PhpInsights\Domain\Sniffs\ForbiddenSetterSniff;
use PHP_CodeSniffer\Standards\Generic\Sniffs\CodeAnalysis\EmptyStatementSniff;
use PHP_CodeSniffer\Standards\Generic\Sniffs\Files\LineLengthSniff;
use PHP_CodeSniffer\Standards\Generic\Sniffs\PHP\NoSilencedErrorsSniff;
use SlevomatCodingStandard\Sniffs\Functions\UnusedParameterSniff;
use SlevomatCodingStandard\Sniffs\TypeHints\DisallowArrayTypeHintSyntaxSniff;
use SlevomatCodingStandard\Sniffs\TypeHints\DisallowMixedTypeHintSniff;
$config = [
'preset' => 'default',
'exclude' => [
'lib/external',
'tmp',
'util',
'store',
'lib/component/FpdiPdfParser',
'migration',
],
'add' => [
\NunoMaduro\PhpInsights\Domain\Metrics\Code\Code::class => [
\Skeleton\Coding\Standard\EmptyStatementSniff::class,
]
],
'remove' => [
PHP_CodeSniffer\Standards\PSR1\Sniffs\Methods\CamelCapsMethodNameSniff::class,
PhpCsFixer\Fixer\ClassNotation\ClassDefinitionFixer::class,
SlevomatCodingStandard\Sniffs\ControlStructures\DisallowEmptySniff::class,
PHP_CodeSniffer\Standards\Generic\Sniffs\WhiteSpace\DisallowTabIndentSniff::class,
NunoMaduro\PhpInsights\Domain\Insights\ForbiddenGlobals::class,
SlevomatCodingStandard\Sniffs\Classes\ModernClassNameReferenceSniff::class,
PHP_CodeSniffer\Standards\Squiz\Sniffs\Classes\ValidClassNameSniff::class,
NunoMaduro\PhpInsights\Domain\Insights\ForbiddenNormalClasses::class,
PHP_CodeSniffer\Standards\PSR1\Sniffs\Classes\ClassDeclarationSniff::class,
SlevomatCodingStandard\Sniffs\Classes\ForbiddenPublicPropertySniff::class,
NunoMaduro\PhpInsights\Domain\Sniffs\ForbiddenSetterSniff::class,
NunoMaduro\PhpInsights\Domain\Insights\ForbiddenTraits::class,
PHP_CodeSniffer\Standards\Generic\Sniffs\CodeAnalysis\EmptyStatementSniff::class,
SlevomatCodingStandard\Sniffs\TypeHints\ParameterTypeHintSniff::class
],
'config' => [
ForbiddenDefineGlobalConstants::class => [
'ignore' => [
'PHP_CODESNIFFER_VERBOSITY',
'PHP_CODESNIFFER_CBF',
],
],
LineLengthSniff::class => [
'lineLimit' => 120,
'absoluteLineLimit' => 120,
'ignoreComments' => true,
],
PhpCsFixer\Fixer\Basic\BracesFixer::class => [
'allow_single_line_closure' => true,
'position_after_anonymous_constructs' => 'same', // possible values ['same', 'next']
'position_after_control_structures' => 'same', // possible values ['same', 'next']
'position_after_functions_and_oop_constructs' => 'same',
'indent' => ' ',
],
PhpCsFixer\Fixer\FunctionNotation\FunctionDeclarationFixer::class => [
'closure_function_spacing' => 'none',
],
PHP_CodeSniffer\Standards\Generic\Sniffs\Formatting\SpaceAfterNotSniff::class => [
'spacing' => 0,
],
PHP_CodeSniffer\Standards\Generic\Sniffs\Formatting\SpaceAfterCastSniff::class => [
'spacing' => 0,
],
SlevomatCodingStandard\Sniffs\Commenting\DocCommentSpacingSniff::class => [
'linesCountBetweenDifferentAnnotationsTypes' => 0,
'linesCountBetweenAnnotationsGroups' => 0,
],
PhpCsFixer\Fixer\CastNotation\CastSpacesFixer::class => [
'space' => 'none',
],
NunoMaduro\PhpInsights\Domain\Insights\CyclomaticComplexityIsHigh::class => [
'maxComplexity' => 10,
'exclude' => [
],
],
\SlevomatCodingStandard\Sniffs\Functions\FunctionLengthSniff::class => [
'maxLinesLength' => 40,
],
],
'requirements' => [
'min-quality' => 39.2,
'min-architecture' => 64.3,
'min-style' => 28.8,
'min-complexity' => 13.2,
],
'diff_context' => 10,
];
/**
* If the project does not contain a composer.lock file, no security check can be done
*/
if (!file_exists('composer.lock')) {
$config['remove'][] = NunoMaduro\PhpInsights\Domain\Insights\ForbiddenSecurityIssues::class;
}
return $config;