-
Notifications
You must be signed in to change notification settings - Fork 1
/
0001-Add-Drupal-8-project-Code-Climate-config.patch
117 lines (117 loc) · 4.18 KB
/
0001-Add-Drupal-8-project-Code-Climate-config.patch
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
106
107
108
109
110
111
112
113
114
115
116
117
diff --git a/.codeclimate.yml b/.codeclimate.yml
new file mode 100644
index 0000000..b1e6de8
--- /dev/null
+++ b/.codeclimate.yml
@@ -0,0 +1,27 @@
+---
+engines:
+ phpmd:
+ enabled: true
+ config:
+ file_extensions: "php,inc,module,install"
+ rulesets: ".phpmd.xml"
+ phpcodesniffer:
+ enabled: true
+ config:
+ file_extensions: "php,inc,module,install"
+ encoding: utf-8
+ standard: "Drupal"
+ ignore_warnings: true
+ratings:
+ paths:
+ - "modules/custom/**.php"
+ - "modules/custom/**.inc"
+ - "modules/custom/**.module"
+ - "modules/custom/**.install"
+exclude_paths:
+ - core
+ - modules/contrib
+ - profiles
+ - sites
+ - themes
+ - vendor
diff --git a/.phpmd.xml b/.phpmd.xml
new file mode 100644
index 0000000..c1a66cf
--- /dev/null
+++ b/.phpmd.xml
@@ -0,0 +1,78 @@
+<?xml version="1.0"?>
+<ruleset xmlns="http://pmd.sourceforge.net/ruleset/2.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="PMD Ruleset for Drupal" xsi:schemaLocation="http://pmd.sourceforge.net/ruleset/2.0.0 http://pmd.sourceforge.net/ruleset_2_0_0.xsd">
+ <description>
+ A PMD Ruleset for Drupal coding standards.
+ </description>
+
+ <!--
+ Include each rule explicitly so we know what we have.
+ @see https://github.com/phpmd/phpmd/blob/master/src/main/resources/rulesets/
+ -->
+
+ <!-- Clean Code -->
+ <!--
+ These don't align with Drupal standards, so they are excluded.
+ @todo Static calls are hard to test and extend, is there a way to whitelist the ones that are OK?
+ <rule ref="rulesets/cleancode.xml/BooleanArgumentFlag"/>
+ <rule ref="rulesets/cleancode.xml/ElseExpression"/>
+ <rule ref="rulesets/cleancode.xml/StaticAccess"/>
+ -->
+
+ <!-- Code Size -->
+ <rule ref="rulesets/codesize.xml/CyclomaticComplexity"/>
+ <rule ref="rulesets/codesize.xml/NPathComplexity"/>
+ <rule ref="rulesets/codesize.xml/ExcessiveMethodLength"/>
+ <rule ref="rulesets/codesize.xml/ExcessiveClassLength"/>
+ <rule ref="rulesets/codesize.xml/ExcessiveParameterList"/>
+ <rule ref="rulesets/codesize.xml/ExcessivePublicCount"/>
+ <rule ref="rulesets/codesize.xml/TooManyFields"/>
+
+ <!-- Controversial -->
+ <rule ref="rulesets/controversial.xml/Superglobals"/>
+ <!--
+ These checks do not need to be included since PHPCS will check for style.
+ <rule ref="rulesets/controversial.xml/CamelCaseClassName"/>
+ <rule ref="rulesets/controversial.xml/CamelCasePropertyName"/>
+ <rule ref="rulesets/controversial.xml/CamelCaseMethodName"/>
+ <rule ref="rulesets/controversial.xml/CamelCaseParameterName"/>
+ <rule ref="rulesets/controversial.xml/CamelCaseVariableName"/>
+ -->
+
+ <!-- Design -->
+ <rule ref="rulesets/design.xml/ExitExpression"/>
+ <rule ref="rulesets/design.xml/EvalExpression"/>
+ <rule ref="rulesets/design.xml/GotoStatement"/>
+ <rule ref="rulesets/design.xml/NumberOfChildren"/>
+ <rule ref="rulesets/design.xml/DepthOfInheritance"/>
+ <rule ref="rulesets/design.xml/CouplingBetweenObjects"/>
+ <rule ref="rulesets/design.xml/DevelopmentCodeFragment"/>
+
+ <!-- Naming -->
+ <rule ref="rulesets/naming.xml/ShortVariable">
+ <properties>
+ <!-- Allow $id as a variable name. -->
+ <property name="exceptions" description="Comma-separated list of exceptions" value="id"/>
+ </properties>
+ </rule>
+ <rule ref="rulesets/naming.xml/LongVariable">
+ <properties>
+ <!-- Bump variable length to a more reasonable number. -->
+ <property name="maximum" description="The variable length reporting threshold" value="35"/>
+ </properties>
+ </rule>
+ <rule ref="rulesets/naming.xml/ShortMethodName"/>
+ <rule ref="rulesets/naming.xml/ConstructorWithNameAsEnclosingClass"/>
+ <rule ref="rulesets/naming.xml/ConstantNamingConventions"/>
+ <rule ref="rulesets/naming.xml/BooleanGetMethodName"/>
+
+ <!-- Unused Code -->
+ <rule ref="rulesets/unusedcode.xml/UnusedPrivateField"/>
+ <rule ref="rulesets/unusedcode.xml/UnusedLocalVariable"/>
+ <rule ref="rulesets/unusedcode.xml/UnusedPrivateMethod"/>
+ <!--
+ Hooks often have unused parameters, so ignore this warning.
+ @todo is there a way to allow unused parameters in hooks but not elsewhere?
+ <rule ref="rulesets/unusedcode.xml/UnusedFormalParameter"/>
+ -->
+
+</ruleset>