Skip to content

Commit ee015c2

Browse files
committed
Use Squizlabs Commenting sniffs for Method PHPDoc
This commit addss support for the standard Commenting sniffs relating to methods only. Some of the specific sniffs have been disabled, or their severity/type changed to suit our rules. Fixes moodlehq#30
1 parent 522bb7b commit ee015c2

File tree

1 file changed

+52
-0
lines changed

1 file changed

+52
-0
lines changed

moodle/ruleset.xml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,58 @@
6565
</properties>
6666
</rule>
6767

68+
<!-- Check phpdoc comments for functions -->
69+
<rule ref="Squiz.Commenting.FunctionComment"/>
70+
71+
<!-- We do not enforce specific formatting of @params with regards spacing -->
72+
<rule ref="Squiz.Commenting.FunctionComment.SpacingAfterParamType">
73+
<severity>0</severity>
74+
</rule>
75+
<rule ref="Squiz.Commenting.FunctionComment.SpacingAfterParamName">
76+
<severity>0</severity>
77+
</rule>
78+
<rule ref="Squiz.Commenting.FunctionComment.ParamCommentAlignment">
79+
<severity>0</severity>
80+
</rule>
81+
<rule ref="Squiz.Commenting.FunctionComment.ParamCommentAlignmentExceeded">
82+
<severity>0</severity>
83+
</rule>
84+
85+
<!-- Parameter comments are optional, but recommended -->
86+
<rule ref="Squiz.Commenting.FunctionComment.MissingParamComment">
87+
<type>warning</type>
88+
<severity>2</severity>
89+
</rule>
90+
91+
<!-- Parameter comments do not need to start with a capital letter -->
92+
<rule ref="Squiz.Commenting.FunctionComment.ParamCommentNotCapital">
93+
<severity>0</severity>
94+
</rule>
95+
96+
<!-- Parameter comments do not need to end with a full stop -->
97+
<rule ref="Squiz.Commenting.FunctionComment.ParamCommentFullStop">
98+
<severity>0</severity>
99+
</rule>
100+
101+
<!-- Type hints are optional, but strongly recommended -->
102+
<rule ref="Squiz.Commenting.FunctionComment.TypeHintMissing">
103+
<type>warning</type>
104+
</rule>
105+
<rule ref="Squiz.Commenting.FunctionComment.ScalarTypeHintMissing">
106+
<type>warning</type>
107+
</rule>
108+
109+
<!--
110+
Sadly this rule does not let you configure it to ignore missing returns if no return is present.
111+
We do not recommend use of `@return void` but they mandate it.
112+
-->
113+
<rule ref="Squiz.Commenting.FunctionComment.MissingReturn">
114+
<severity>0</severity>
115+
</rule>
116+
117+
118+
<rule ref="Squiz.Commenting.FunctionCommentThrowTag"/>
119+
68120
<rule ref="Squiz.Scope.MethodScope"/>
69121
<rule ref="Squiz.Scope.StaticThisUsage"/>
70122

0 commit comments

Comments
 (0)