-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add PHP_CodeSniffer and fix low-hanging fruit
- Loading branch information
Jelle Raaijmakers
committed
Feb 25, 2019
1 parent
0494494
commit b495f17
Showing
13 changed files
with
193 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,119 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<ruleset name="composer-velocita"> | ||
<description>PHP_CodeSniffer ruleset for composer-velocita</description> | ||
|
||
<!-- Include src folder --> | ||
<file>src</file> | ||
|
||
<!-- Arguments --> | ||
<arg value="sp"/> | ||
<arg name="colors"/> | ||
|
||
<!-- PSR2 standard --> | ||
<rule ref="PSR2"/> | ||
|
||
<!-- Extra rules --> | ||
<rule ref="Generic.Arrays.ArrayIndent"/> | ||
<rule ref="Generic.Arrays.DisallowLongArraySyntax"/> | ||
<rule ref="Generic.PHP.ForbiddenFunctions"> | ||
<properties> | ||
<property name="forbiddenFunctions" type="array" value="empty=>null,isset=>null,is_null=>null"/> | ||
</properties> | ||
</rule> | ||
<rule ref="Generic.PHP.Syntax"/> | ||
<rule ref="Generic.Classes.DuplicateClassName"/> | ||
<rule ref="MySource.PHP.GetRequestData"/> | ||
<rule ref="Generic.Commenting.Fixme"/> | ||
<rule ref="Generic.Commenting.Todo"/> | ||
<rule ref="Generic.CodeAnalysis.EmptyStatement"/> | ||
<rule ref="Generic.CodeAnalysis.ForLoopShouldBeWhileLoop"/> | ||
<rule ref="Generic.CodeAnalysis.ForLoopWithTestFunctionCall"/> | ||
<rule ref="Generic.CodeAnalysis.JumbledIncrementer"/> | ||
<rule ref="Generic.CodeAnalysis.UnconditionalIfStatement"/> | ||
<rule ref="Generic.CodeAnalysis.UnnecessaryFinalModifier"/> | ||
<rule ref="Generic.CodeAnalysis.UselessOverridingMethod"/> | ||
<rule ref="Generic.Metrics.CyclomaticComplexity"> | ||
<properties> | ||
<property name="complexity" value="10"/> | ||
<property name="absoluteComplexity" value="20"/> | ||
</properties> | ||
</rule> | ||
<rule ref="PSR12.Operators.OperatorSpacing"/> | ||
|
||
<!-- 3rd party --> | ||
<rule ref="ObjectCalisthenics.Files.FunctionLength"> | ||
<properties> | ||
<property name="maxLength" value="25"/> | ||
</properties> | ||
</rule> | ||
<rule ref="ObjectCalisthenics.Metrics.MaxNestingLevel"> | ||
<properties> | ||
<property name="maxNestingLevel" value="3"/> | ||
</properties> | ||
</rule> | ||
<rule ref="ObjectCalisthenics.Metrics.MethodPerClassLimit"> | ||
<properties> | ||
<property name="maxCount" value="10"/> | ||
</properties> | ||
</rule> | ||
<rule ref="ObjectCalisthenics.Metrics.PropertyPerClassLimit"> | ||
<properties> | ||
<property name="maxCount" value="10"/> | ||
</properties> | ||
</rule> | ||
<rule ref="SlevomatCodingStandard.Classes.ClassConstantVisibility"/> | ||
<rule ref="SlevomatCodingStandard.Classes.UnusedPrivateElements"/> | ||
<rule ref="SlevomatCodingStandard.Namespaces.AlphabeticallySortedUses"/> | ||
<rule ref="SlevomatCodingStandard.Namespaces.FullyQualifiedGlobalConstants"/> | ||
<rule ref="SlevomatCodingStandard.Namespaces.FullyQualifiedGlobalFunctions"/> | ||
<rule ref="SlevomatCodingStandard.Namespaces.ReferenceUsedNamesOnly"> | ||
<properties> | ||
<property name="allowFullyQualifiedGlobalFunctions" value="true"/> | ||
<property name="allowFullyQualifiedGlobalConstants" value="true"/> | ||
<property name="searchAnnotations" value="true"/> | ||
</properties> | ||
</rule> | ||
<rule ref="SlevomatCodingStandard.Namespaces.UnusedUses"> | ||
<properties> | ||
<property name="searchAnnotations" value="true"/> | ||
</properties> | ||
</rule> | ||
<rule ref="SlevomatCodingStandard.Namespaces.UseFromSameNamespace"/> | ||
<rule ref="SlevomatCodingStandard.TypeHints.DeclareStrictTypes"> | ||
<properties> | ||
<property name="newlinesCountBetweenOpenTagAndDeclare" value="2"/> | ||
<property name="spacesCountAroundEqualsSign" value="0"/> | ||
</properties> | ||
</rule> | ||
<rule ref="SlevomatCodingStandard.TypeHints.ReturnTypeHintSpacing"/> | ||
<rule ref="SlevomatCodingStandard.TypeHints.TypeHintDeclaration.MissingParameterTypeHint"/> | ||
<rule ref="SlevomatCodingStandard.TypeHints.TypeHintDeclaration.MissingPropertyTypeHint"/> | ||
<rule ref="SlevomatCodingStandard.TypeHints.TypeHintDeclaration.MissingReturnTypeHint"/> | ||
<rule ref="SlevomatCodingStandard.TypeHints.UselessConstantTypeHint"/> | ||
<rule ref="SlevomatCodingStandard.Types.EmptyLinesAroundTypeBraces"> | ||
<properties> | ||
<property name="linesCountAfterOpeningBrace" value="0"/> | ||
<property name="linesCountBeforeClosingBrace" value="0"/> | ||
</properties> | ||
</rule> | ||
<rule ref="SlevomatCodingStandard.ControlStructures.DisallowEqualOperators"/> | ||
<rule ref="SlevomatCodingStandard.ControlStructures.DisallowYodaComparison"/> | ||
<rule ref="SlevomatCodingStandard.ControlStructures.RequireShortTernaryOperator"/> | ||
<rule ref="SlevomatCodingStandard.PHP.TypeCast"/> | ||
<rule ref="SlevomatCodingStandard.Classes.SuperfluousInterfaceNaming"/> | ||
<rule ref="Squiz.NamingConventions.ValidVariableName.NotCamelCaps"/> | ||
<rule ref="Squiz.NamingConventions.ValidVariableName.MemberNotCamelCaps"/> | ||
<rule ref="Squiz.Strings.DoubleQuoteUsage.ContainsVar"/> | ||
<rule ref="Squiz.WhiteSpace.FunctionSpacing"> | ||
<properties> | ||
<property name="spacing" value="1"/> | ||
<property name="spacingBeforeFirst" value="0"/> | ||
<property name="spacingAfterLast" value="0"/> | ||
</properties> | ||
</rule> | ||
<rule ref="Squiz.WhiteSpace.SuperfluousWhitespace"> | ||
<properties> | ||
<property name="ignoreBlankLines" value="false"/> | ||
</properties> | ||
</rule> | ||
</ruleset> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace ISAAC\Velocita\Composer\Commands; | ||
|
||
use Composer\Command\BaseCommand; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace ISAAC\Velocita\Composer\Commands; | ||
|
||
use Composer\Command\BaseCommand; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace ISAAC\Velocita\Composer\Config; | ||
|
||
class EndpointMapping | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,11 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace ISAAC\Velocita\Composer\Exceptions; | ||
|
||
class IOException extends \RuntimeException | ||
use RuntimeException; | ||
|
||
class IOException extends RuntimeException | ||
{ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace ISAAC\Velocita\Composer\Util; | ||
|
||
use Composer\Factory; | ||
|
Oops, something went wrong.