Lethexie has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/291489

Change subject: Add function commenting sniff.
......................................................................

Add function commenting sniff.

All new methods should document their parameters and return values as mentioned
in Coding_Conventions.

Details in T136464.

Change-Id: I4918bd59a07490952f5d17242631ab36c350a99e
---
A MediaWiki/Tests/files/Commenting/commenting_function_fail.php.expect
A MediaWiki/Tests/files/Commenting/commenting_function_pass.php
A MediaWiki/Tests/files/Commenting/commentinng_function_fail.php
M MediaWiki/ruleset.xml
4 files changed, 31 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/tools/codesniffer 
refs/changes/89/291489/1

diff --git 
a/MediaWiki/Tests/files/Commenting/commenting_function_fail.php.expect 
b/MediaWiki/Tests/files/Commenting/commenting_function_fail.php.expect
new file mode 100644
index 0000000..5dc9377
--- /dev/null
+++ b/MediaWiki/Tests/files/Commenting/commenting_function_fail.php.expect
@@ -0,0 +1,9 @@
+
+FILE: ...r/MediaWiki/Tests/files/Commenting/commentinng_function_fail.php
+----------------------------------------------------------------------
+FOUND 1 ERROR AFFECTING 1 LINE
+----------------------------------------------------------------------
+ 5 | ERROR | Missing function doc comment
+----------------------------------------------------------------------
+
+Time: 23ms; Memory: 3.25Mb
diff --git a/MediaWiki/Tests/files/Commenting/commenting_function_pass.php 
b/MediaWiki/Tests/files/Commenting/commenting_function_pass.php
new file mode 100644
index 0000000..8b43bd7
--- /dev/null
+++ b/MediaWiki/Tests/files/Commenting/commenting_function_pass.php
@@ -0,0 +1,13 @@
+<?php
+
+class TestFunctionClass {
+       /**
+        * Single Test function.
+        *
+        * @param  integer $testVar For test.
+        * @return integer $testVar For test.
+        */
+       public function test( $testVar ) {
+               return $testVar;
+       }
+}
diff --git a/MediaWiki/Tests/files/Commenting/commentinng_function_fail.php 
b/MediaWiki/Tests/files/Commenting/commentinng_function_fail.php
new file mode 100644
index 0000000..4bd5606
--- /dev/null
+++ b/MediaWiki/Tests/files/Commenting/commentinng_function_fail.php
@@ -0,0 +1,8 @@
+<?php
+
+class TestClass {
+
+       public function test( $testVar ) {
+               return $testVar;
+       }
+}
diff --git a/MediaWiki/ruleset.xml b/MediaWiki/ruleset.xml
index 17a7aa8..137b81c 100644
--- a/MediaWiki/ruleset.xml
+++ b/MediaWiki/ruleset.xml
@@ -88,6 +88,7 @@
 
        <rule ref="Squiz.CSS.SemicolonSpacing" />
        <rule ref="Squiz.Classes.ValidClassName" />
+       <rule ref="Squiz.Commenting.FunctionComment" />
        <rule ref="Squiz.Scope.StaticThisUsage" />
        <rule ref="Squiz.WhiteSpace.LanguageConstructSpacing" />
        <rule ref="Squiz.WhiteSpace.LogicalOperatorSpacing" />

-- 
To view, visit https://gerrit.wikimedia.org/r/291489
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I4918bd59a07490952f5d17242631ab36c350a99e
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/tools/codesniffer
Gerrit-Branch: master
Gerrit-Owner: Lethexie <xietaoe...@gmail.com>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to