Issue #2666172 by alexpott: PHPCS configuration should include rules and not exclude them

8.1.x
Nathaniel Catchpole 2016-02-25 13:14:55 +09:00
parent c735b827d1
commit 3a18d596b9
4 changed files with 34 additions and 67 deletions

View File

@ -26,7 +26,7 @@ class RegexDirectoryIterator extends \FilterIterator {
* The path to scan. * The path to scan.
* @param string $regex * @param string $regex
* The regular expression to match, including delimiters. For example, * The regular expression to match, including delimiters. For example,
/\.yml$/ would list only files ending in .yml. * /\.yml$/ would list only files ending in .yml.
*/ */
public function __construct($path, $regex) { public function __construct($path, $regex) {
// Use FilesystemIterator to not iterate over the the . and .. directories. // Use FilesystemIterator to not iterate over the the . and .. directories.

View File

@ -10,67 +10,34 @@
<!--Exclude test files that are intentionally empty, or intentionally violate coding standards.--> <!--Exclude test files that are intentionally empty, or intentionally violate coding standards.-->
<exclude-pattern>./modules/system/tests/fixtures/HtaccessTest</exclude-pattern> <exclude-pattern>./modules/system/tests/fixtures/HtaccessTest</exclude-pattern>
<!--Blacklist of coding standard rules that are not yet fixed. Ref. https://www.drupal.org/node/2571965--> <!-- Only include specific sniffs that pass. This ensures that, if new sniffs are added, HEAD does not fail.-->
<rule ref="Drupal"> <!-- Drupal sniffs -->
<exclude name="Drupal.Array.Array"/> <rule ref="Drupal.CSS.ClassDefinitionNameSpacing"/>
<exclude name="Drupal.Classes.ClassCreateInstance"/> <rule ref="Drupal.CSS.ColourDefinition"/>
<exclude name="Drupal.Classes.ClassDeclaration"/> <rule ref="Drupal.Commenting.DocCommentStar"/>
<exclude name="Drupal.Classes.InterfaceName"/> <rule ref="Drupal.Commenting.FileComment"/>
<exclude name="Drupal.Classes.UnusedUseStatement"/> <rule ref="Drupal.ControlStructures.ElseIf"/>
<exclude name="Drupal.Commenting.ClassComment"/> <rule ref="Drupal.Files.TxtFileLineLength"/>
<exclude name="Drupal.Commenting.DocComment"/> <rule ref="Drupal.Functions.DiscouragedFunctions"/>
<exclude name="Drupal.Commenting.FunctionComment"/> <rule ref="Drupal.InfoFiles.AutoAddedKeys"/>
<exclude name="Drupal.Commenting.HookComment"/> <rule ref="Drupal.InfoFiles.ClassFiles"/>
<exclude name="Drupal.Commenting.InlineComment"/> <rule ref="Drupal.InfoFiles.DuplicateEntry"/>
<exclude name="Drupal.Commenting.PostStatementComment"/> <rule ref="Drupal.InfoFiles.Required"/>
<exclude name="Drupal.ControlStructures.ControlSignature"/> <rule ref="Drupal.Semantics.EmptyInstall"/>
<exclude name="Drupal.ControlStructures.InlineControlStructure"/> <rule ref="Drupal.Semantics.FunctionWatchdog"/>
<exclude name="Drupal.Files.EndFileNewline"/> <rule ref="Drupal.Semantics.InstallHooks"/>
<exclude name="Drupal.Files.LineLength"/> <rule ref="Drupal.Semantics.LStringTranslatable"/>
<exclude name="Drupal.Formatting.MultiLineAssignment"/> <rule ref="Drupal.Semantics.PregSecurity"/>
<exclude name="Drupal.Formatting.SpaceInlineIf"/> <rule ref="Drupal.Semantics.TInHookMenu"/>
<exclude name="Drupal.Formatting.SpaceUnaryOperator"/> <rule ref="Drupal.Semantics.TInHookSchema"/>
<exclude name="Drupal.Functions.FunctionDeclaration"/> <rule ref="Drupal.WhiteSpace.Comma"/>
<exclude name="Drupal.NamingConventions.ValidClassName"/> <rule ref="Drupal.WhiteSpace.ObjectOperatorIndent"/>
<exclude name="Drupal.NamingConventions.ValidFunctionName"/>
<exclude name="Drupal.NamingConventions.ValidGlobal"/> <!-- Generic sniffs -->
<exclude name="Drupal.NamingConventions.ValidVariableName"/> <rule ref="Generic.Files.LineEndings"/>
<exclude name="Drupal.Semantics.ConstantName"/> <rule ref="Generic.NamingConventions.UpperCaseConstantName"/>
<exclude name="Drupal.Semantics.FunctionAlias"/> <rule ref="Generic.PHP.DeprecatedFunctions"/>
<exclude name="Drupal.Semantics.FunctionT"/> <rule ref="Generic.PHP.DisallowShortOpenTag"/>
<exclude name="Drupal.Semantics.RemoteAddress"/> <rule ref="Generic.WhiteSpace.DisallowTabIndent"/>
<exclude name="Drupal.Strings.UnnecessaryStringConcat"/>
<exclude name="Drupal.WhiteSpace.CloseBracketSpacing"/>
<exclude name="Drupal.WhiteSpace.EmptyLines"/>
<exclude name="Drupal.WhiteSpace.ObjectOperatorSpacing"/>
<exclude name="Drupal.WhiteSpace.OpenBracketSpacing"/>
<exclude name="Drupal.WhiteSpace.OperatorSpacing"/>
<exclude name="Drupal.WhiteSpace.ScopeClosingBrace"/>
<exclude name="Drupal.WhiteSpace.ScopeIndent"/>
<exclude name="Generic.Formatting.SpaceAfterCast"/>
<exclude name="Generic.Functions.FunctionCallArgumentSpacing"/>
<exclude name="Generic.Functions.OpeningFunctionBraceKernighanRitchie"/>
<exclude name="Generic.NamingConventions.ConstructorName"/>
<exclude name="Generic.PHP.UpperCaseConstant"/>
<exclude name="Internal.NoCodeFound"/>
<exclude name="PEAR.Functions.FunctionCallSignature"/>
<exclude name="PEAR.Functions.ValidDefaultValue"/>
<exclude name="PSR2.Classes.PropertyDeclaration"/>
<exclude name="Squiz.Arrays.ArrayBracketSpacing"/>
<exclude name="Squiz.Arrays.ArrayDeclaration"/>
<exclude name="Squiz.Classes.LowercaseClassKeywords"/>
<exclude name="Squiz.Commenting.DocCommentAlignment"/>
<exclude name="Squiz.Commenting.PostStatementComment"/>
<exclude name="Squiz.ControlStructures.ForEachLoopDeclaration"/>
<exclude name="Squiz.ControlStructures.ForLoopDeclaration"/>
<exclude name="Squiz.ControlStructures.SwitchDeclaration"/>
<exclude name="Squiz.Functions.FunctionDeclarationArgumentSpacing"/>
<exclude name="Squiz.PHP.LowercasePHPFunctions"/>
<exclude name="Squiz.PHP.NonExecutableCode"/>
<exclude name="Squiz.Scope.MethodScope"/>
<exclude name="Squiz.Strings.ConcatenationSpacing"/>
<exclude name="Squiz.WhiteSpace.LanguageConstructSpacing"/>
<exclude name="Squiz.WhiteSpace.SemicolonSpacing"/>
<exclude name="Squiz.WhiteSpace.SuperfluousWhitespace"/>
</rule>
</ruleset> </ruleset>

View File

@ -159,7 +159,7 @@ class EntityFormTest extends UnitTestCase {
public function testGetEntityFromRouteMatchAdd() { public function testGetEntityFromRouteMatchAdd() {
$entity = $this->prophesize(EntityInterface::class)->reveal(); $entity = $this->prophesize(EntityInterface::class)->reveal();
$this->setUpStorage()->create([])->willReturn($entity); $this->setUpStorage()->create([])->willReturn($entity);
$route_match = new RouteMatch('test_route', new Route('/entity-test/add')); $route_match = new RouteMatch('test_route', new Route('/entity-test/add'));
$actual = $this->entityForm->getEntityFromRouteMatch($route_match, $this->entityType->id()); $actual = $this->entityForm->getEntityFromRouteMatch($route_match, $this->entityType->id());
$this->assertEquals($entity, $actual); $this->assertEquals($entity, $actual);
} }
@ -178,7 +178,7 @@ class EntityFormTest extends UnitTestCase {
// Test without a bundle parameter in the route. // Test without a bundle parameter in the route.
$storage->create([])->willReturn($entity); $storage->create([])->willReturn($entity);
$route_match = new RouteMatch('test_route', new Route('/entity-test/add')); $route_match = new RouteMatch('test_route', new Route('/entity-test/add'));
$actual = $this->entityForm->getEntityFromRouteMatch($route_match, $this->entityType->id()); $actual = $this->entityForm->getEntityFromRouteMatch($route_match, $this->entityType->id());
$this->assertEquals($entity, $actual); $this->assertEquals($entity, $actual);
@ -208,7 +208,7 @@ class EntityFormTest extends UnitTestCase {
// Test without a bundle parameter in the route. // Test without a bundle parameter in the route.
$storage->create([])->willReturn($entity); $storage->create([])->willReturn($entity);
$route_match = new RouteMatch('test_route', new Route('/entity-test/add')); $route_match = new RouteMatch('test_route', new Route('/entity-test/add'));
$actual = $this->entityForm->getEntityFromRouteMatch($route_match, $this->entityType->id()); $actual = $this->entityForm->getEntityFromRouteMatch($route_match, $this->entityType->id());
$this->assertEquals($entity, $actual); $this->assertEquals($entity, $actual);