Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Moved PHP standard files so PEAR package can install as a CodeSniffer…

… standard
  • Loading branch information...
commit 023c1051a4c330b48757d8a56a6b13cfc8517834 1 parent a579ae2
@rodnaph rodnaph authored
View
2  .gitignore
@@ -1,3 +1,5 @@
log
nbproject
*.tgz
+.DS_Store
+catalog.xml
View
2  PHP/Sniffs/CodeAnalysis/LongMethodSniff.php → PHP/BoxUK/Sniffs/CodeAnalysis/LongMethodSniff.php
@@ -2,7 +2,7 @@
/**
* @package BoxUK
*/
-class PHP_Sniffs_CodeAnalysis_LongMethodSniff implements PHP_CodeSniffer_Sniff {
+class BoxUK_Sniffs_CodeAnalysis_LongMethodSniff implements PHP_CodeSniffer_Sniff {
private $methodLengthLimit = 50;
View
2  PHP/Sniffs/CodeAnalysis/PPrefixSniff.php → PHP/BoxUK/Sniffs/CodeAnalysis/PPrefixSniff.php
@@ -4,7 +4,7 @@
*
* @package BoxUK
*/
-class PHP_Sniffs_CodeAnalysis_PPrefixSniff implements PHP_CodeSniffer_Sniff {
+class BoxUK_Sniffs_CodeAnalysis_PPrefixSniff implements PHP_CodeSniffer_Sniff {
/**
* Registers the type of tokens we're sniffing for
View
2  PHP/Sniffs/CodeAnalysis/SingletonAccessSniff.php → ...oxUK/Sniffs/CodeAnalysis/SingletonAccessSniff.php
@@ -4,7 +4,7 @@
*
* @package BoxUK
*/
-class PHP_Sniffs_CodeAnalysis_SingletonAccessSniff implements PHP_CodeSniffer_Sniff {
+class BoxUK_Sniffs_CodeAnalysis_SingletonAccessSniff implements PHP_CodeSniffer_Sniff {
private static $aMethods = array( 'getInstance', 'setInstance' );
View
2  PHP/Sniffs/Commenting/FunctionCommentSniff.php → PHP/BoxUK/Sniffs/Commenting/FunctionCommentSniff.php
@@ -8,7 +8,7 @@
*
* @package BoxUK
*/
-class PHP_Sniffs_Commenting_FunctionCommentSniff implements PHP_CodeSniffer_Sniff {
+class BoxUK_Sniffs_Commenting_FunctionCommentSniff implements PHP_CodeSniffer_Sniff {
/**
* The name of the method that we are currently processing.
View
2  PHP/Sniffs/Commenting/PackageAnnotationSniff.php → ...oxUK/Sniffs/Commenting/PackageAnnotationSniff.php
@@ -4,7 +4,7 @@
*
* @package Amaxus
*/
-class PHP_Sniffs_Commenting_PackageAnnotationSniff implements PHP_CodeSniffer_Sniff {
+class BoxUK_Sniffs_Commenting_PackageAnnotationSniff implements PHP_CodeSniffer_Sniff {
/**
* Registers tokens we're sniffing for
View
13 PHP/ruleset.xml → PHP/BoxUK/ruleset.xml
@@ -3,40 +3,29 @@
<description>The Box UK PHP coding standard.</description>
- <!-- Include some additional sniffs from the Generic standard -->
<rule ref="Generic.CodeAnalysis.EmptyStatement"/>
<rule ref="Generic.CodeAnalysis.JumbledIncrementer"/>
<rule ref="Generic.CodeAnalysis.UnconditionalIfStatement"/>
<rule ref="Generic.CodeAnalysis.UnusedFunctionParameter"/>
<rule ref="Generic.CodeAnalysis.UselessOverridingMethod"/>
<rule ref="Generic.WhiteSpace.DisallowTabIndent"/>
-
<rule ref="Generic.Formatting.DisallowMultipleStatements"/>
-
<rule ref="Generic.Metrics.CyclomaticComplexity"/>
<rule ref="Generic.Metrics.NestingLevel"/>
-
<rule ref="Generic.PHP.ForbiddenFunctions"/>
-
-
<rule ref="Generic.NamingConventions.UpperCaseConstantName"/>
<rule ref="Generic.NamingConventions.ConstructorName"/>
<rule ref="Generic.WhiteSpace.ScopeIndent"/>
<rule ref="PEAR.Functions.ValidDefaultValue"/>
<rule ref="PEAR.NamingConventions.ValidClassName"/>
- <rule ref="Squiz.Commenting.FunctionCommentThrowTag"/>
-
+ <rule ref="Squiz.Commenting.FunctionCommentThrowTag"/>
<rule ref="Squiz.Scope.MemberVarScope"/>
<rule ref="Squiz.Scope.MethodScope"/>
<rule ref="Squiz.PHP.GlobalKeyword"/>
<rule ref="Squiz.PHP.DisallowSizeFunctionsInLoops"/>
<rule ref="Squiz.Scope.StaticThisUsage"/>
-
-
<rule ref="Squiz.PHP.NonExecutableCode"/>
-
-
</ruleset>
View
6 package.xml → PHP/package.xml
@@ -26,9 +26,9 @@
<license uri="http://www.opensource.org/licenses/mit-license.php">MIT</license>
<notes>-</notes>
<contents>
- <dir baseinstalldir="/BoxUK/CodingStandards" name="/">
- <dir name="PHP">
- <file name="ruleset.xml" role="data" />
+ <dir baseinstalldir="/PHP/CodeSniffer/Standards/" name="/">
+ <dir name="BoxUK">
+ <file name="ruleset.xml" role="php" />
<dir name="Sniffs">
<dir name="CodeAnalysis">
<file name="LongMethodSniff.php" role="php" />
View
2  README.md
@@ -17,5 +17,5 @@ The PHP standard is written for PHP_CodeSniffer (http://pear.php.net/package/PHP
and can be run by using the *--standard* switch to _phpcs_.
<pre>
-%> phpcs /my/code/php --standard=/path/to/boxuk-codingstandards/PHP
+%> phpcs /my/code/php --standard=/path/to/boxuk-codingstandards/PHP/BoxUK
</pre>
View
21 build.xml
@@ -8,11 +8,30 @@
</target>
<target name="test-php-cs">
- <exec command="phpcs -n PHP/ --standard=PHP/" checkreturn="true" passthru="true" />
+ <exec command="phpcs -n PHP/ --standard=PHP/BoxUK" checkreturn="true" passthru="true" />
</target>
<target name="test-php" depends="test-php-unit,test-php-cs"></target>
<target name="test" depends="test-php"></target>
+ <target name="pear-package" description="Create PEAR package for PHP standard">
+ <phingcall target="pear-package-clean" />
+ <exec dir="PHP" command="pear package" />
+ <copy todir=".">
+ <fileset dir="PHP">
+ <include name="*.tgz" />
+ </fileset>
+ </copy>
+ <phingcall target="pear-package-clean" />
+ </target>
+
+ <target name="pear-package-clean">
+ <delete>
+ <fileset dir="PHP">
+ <include name="*.tgz" />
+ </fileset>
+ </delete>
+ </target>
+
</project>
View
2  tests/php/CodingStandardTest.php
@@ -103,7 +103,7 @@ public function testFileWithCorrectCodingStandardsDoesNotReportAnyErrors() {
private function runSniff( $type, $name ) {
$path = sprintf( 'tests/data/php/%s/%s.php', $type, $name );
- $command = sprintf( 'phpcs %s --standard=PHP', $path );
+ $command = sprintf( 'phpcs %s --standard=PHP/BoxUK', $path );
exec( $command, $output, $returnCode );
Please sign in to comment.
Something went wrong with that request. Please try again.