]> git.mjollnir.org Git - moodle.git/commitdiff
CodeSniffer MDL-19247 I updated the README, moved and renamed phpcs => runsniffer...
authormoodler <moodler>
Wed, 20 May 2009 06:35:46 +0000 (06:35 +0000)
committermoodler <moodler>
Wed, 20 May 2009 06:35:46 +0000 (06:35 +0000)
lib/pear/PHP/CodeSniffer/Standards/Moodle/Sniffs/Files/IncludingFileSniff.php
lib/pear/PHP/CodeSniffer/Standards/Moodle/Sniffs/Files/LineLengthSniff.php
lib/pear/PHP/runsniffer [moved from phpcs with 57% similarity]
lib/pear/README_MOODLE.txt

index 35be2b140e10296ef94b63beb0f05203463f1261..6a5bb2461181c629baf92b862fbc0d84606adfdd 100644 (file)
@@ -74,13 +74,13 @@ class Moodle_Sniffs_Files_IncludingFileSniff implements PHP_CodeSniffer_Sniff
     {
         $tokens = $phpcsFile->getTokens();
 
-        $nextToken = $phpcsFile->findNext(PHP_CodeSniffer_Tokens::$emptyTokens, ($stackPtr + 1), null, true);
-        if ($tokens[$nextToken]['code'] === T_OPEN_PARENTHESIS) {
-            $error  = '"'.$tokens[$stackPtr]['content'].'"';
-            $error .= ' is a statement, not a function; ';
-            $error .= 'no parentheses are required';
-            $phpcsFile->addError($error, $stackPtr);
-        }
+        //$nextToken = $phpcsFile->findNext(PHP_CodeSniffer_Tokens::$emptyTokens, ($stackPtr + 1), null, true);
+        //if ($tokens[$nextToken]['code'] === T_OPEN_PARENTHESIS) {
+        //    $error  = '"'.$tokens[$stackPtr]['content'].'"';
+        //    $error .= ' is a statement, not a function; ';
+        //    $error .= 'no parentheses are required';
+        //    $phpcsFile->addError($error, $stackPtr);
+        //}
 
         $inCondition = (count($tokens[$stackPtr]['conditions']) !== 0) ? true : false;
 
index 0e62631b9a9869406180b3154acd3963a535a5f2..00a14cfd5d97dd667d0094b48aa4ca1b9acf30f0 100644 (file)
@@ -38,7 +38,7 @@ class Moodle_Sniffs_Files_LineLengthSniff implements PHP_CodeSniffer_Sniff
      *
      * @var int
      */
-    protected $lineLimit = 80;
+    protected $lineLimit = 120;
 
     /**
      * The limit that the length of a line must not exceed.
@@ -47,7 +47,7 @@ class Moodle_Sniffs_Files_LineLengthSniff implements PHP_CodeSniffer_Sniff
      *
      * @var int
      */
-    protected $absoluteLineLimit = 120;
+    protected $absoluteLineLimit = 200;
 
 
     /**
similarity index 57%
rename from phpcs
rename to lib/pear/PHP/runsniffer
index a1addb1b8a105dd3e55f64d50c620045724cd6c9..fc3e3e666c668e36784bf888f9d1333aa884c06d 100755 (executable)
--- a/phpcs
@@ -1,25 +1,22 @@
 #!/usr/bin/php
 <?php
 /**
- * PHP_CodeSniffer tokenises PHP code and detects violations of a
- * defined set of coding standards.
+ * This script will run PHP CodeSniffer across given Moodle directories and 
+ * produce reports of coding standard violations.
  *
- * PHP version 5
+ * HOW TO USE:
+ *    php lib/pear/PHP/runsniffer mod/forum
  *
- * @category  PHP
  * @package   PHP_CodeSniffer
- * @author    Greg Sherwood <gsherwood@squiz.net>
- * @author    Marc McIntyre <mmcintyre@squiz.net>
  * @copyright 2006 Squiz Pty Ltd (ABN 77 084 670 600)
  * @license   http://matrix.squiz.net/developer/tools/php_cs/licence BSD Licence
- * @version   CVS: $Id$
  * @link      http://pear.php.net/package/PHP_CodeSniffer
  */
 
 error_reporting(E_ALL | E_STRICT);
 
-if (is_file(dirname(__FILE__).'/../CodeSniffer/CLI.php') === true) {
-    include_once dirname(__FILE__).'/../CodeSniffer/CLI.php';
+if (is_file(dirname(__FILE__).'/CodeSniffer/CLI.php') === true) {
+    include_once dirname(__FILE__).'/CodeSniffer/CLI.php';
 } else {
     include_once 'lib/pear/PHP/CodeSniffer/CLI.php';
 }
index b9b23672098ac356069076ddf29f06cfe71454e6..5e936936ac2906edbe30b4cecd6f61b4ea987944 100644 (file)
@@ -1,3 +1,10 @@
+MOODLE-SPECIFIC PEAR MODIFICATIONS
+==================================
+
+
+Spreadsheet/Excel
+=================
+
 These functions:
     _calculateSharedStringsSizes()
     _storeSharedStringsTable()
@@ -10,5 +17,14 @@ and documented for Moodle at:
 Such modifications should be carefuly each time the Excel PEAR package is updated
 to a new release within Moodle.
 
-stronk7
-$Id$
+
+PHP/CodeSniffer
+===============
+
+A whole Moodle coding standards definition sits in lib/pear/PHP/CodeSniffer/Standards/Moodle
+
+To run the codesniffer, you can call the runsniffer script using your command-line php binary:
+
+Example:  /usr/bin/php lib/pear/PHP/runsniffer mod/forum
+
+