Commit 34bf287a authored by cilefen's avatar cilefen
Browse files

Issue #2851661 by alexpott, dawehner, xjm: Ensure that we're using the right...

Issue #2851661 by alexpott, dawehner, xjm: Ensure that we're using the right ruleset for coding standards checking
parent 3e208146
...@@ -50,8 +50,7 @@ ...@@ -50,8 +50,7 @@
"scripts": { "scripts": {
"pre-autoload-dump": "Drupal\\Core\\Composer\\Composer::preAutoloadDump", "pre-autoload-dump": "Drupal\\Core\\Composer\\Composer::preAutoloadDump",
"post-autoload-dump": [ "post-autoload-dump": [
"Drupal\\Core\\Composer\\Composer::ensureHtaccess", "Drupal\\Core\\Composer\\Composer::ensureHtaccess"
"Drupal\\Core\\Composer\\Composer::configurePhpcs"
], ],
"post-package-install": "Drupal\\Core\\Composer\\Composer::vendorTestCodeCleanup", "post-package-install": "Drupal\\Core\\Composer\\Composer::vendorTestCodeCleanup",
"post-package-update": "Drupal\\Core\\Composer\\Composer::vendorTestCodeCleanup" "post-package-update": "Drupal\\Core\\Composer\\Composer::vendorTestCodeCleanup"
......
...@@ -172,8 +172,7 @@ ...@@ -172,8 +172,7 @@
"scripts": { "scripts": {
"pre-autoload-dump": "Drupal\\Core\\Composer\\Composer::preAutoloadDump", "pre-autoload-dump": "Drupal\\Core\\Composer\\Composer::preAutoloadDump",
"post-autoload-dump": [ "post-autoload-dump": [
"Drupal\\Core\\Composer\\Composer::ensureHtaccess", "Drupal\\Core\\Composer\\Composer::ensureHtaccess"
"Drupal\\Core\\Composer\\Composer::configurePhpcs"
] ]
} }
} }
...@@ -6,7 +6,6 @@ ...@@ -6,7 +6,6 @@
use Composer\Script\Event; use Composer\Script\Event;
use Composer\Installer\PackageEvent; use Composer\Installer\PackageEvent;
use Composer\Semver\Constraint\Constraint; use Composer\Semver\Constraint\Constraint;
use PHP_CodeSniffer;
/** /**
* Provides static functions for composer script events. * Provides static functions for composer script events.
...@@ -137,28 +136,6 @@ public static function ensureHtaccess(Event $event) { ...@@ -137,28 +136,6 @@ public static function ensureHtaccess(Event $event) {
} }
} }
/**
* Configures phpcs if present.
*
* @param \Composer\Script\Event $event
*/
public static function configurePhpcs(Event $event) {
// Grab the local repo which tells us what's been installed.
$local_repository = $event->getComposer()
->getRepositoryManager()
->getLocalRepository();
// Make sure both phpcs and coder are installed.
$phpcs_package = $local_repository->findPackage('squizlabs/php_codesniffer', '*');
$coder_package = $local_repository->findPackage('drupal/coder', '*');
if (!empty($phpcs_package) && !empty($coder_package)) {
$config = $event->getComposer()->getConfig();
$vendor_dir = $config->get('vendor-dir');
// Set phpcs' installed_paths config to point to our coder_sniffer
// directory.
PHP_CodeSniffer::setConfigData('installed_paths', $vendor_dir . '/drupal/coder/coder_sniffer');
}
}
/** /**
* Remove possibly problematic test files from vendored projects. * Remove possibly problematic test files from vendored projects.
* *
......
...@@ -12,16 +12,16 @@ ...@@ -12,16 +12,16 @@
<!-- Only include specific sniffs that pass. This ensures that, if new sniffs are added, HEAD does not fail.--> <!-- Only include specific sniffs that pass. This ensures that, if new sniffs are added, HEAD does not fail.-->
<!-- Drupal sniffs --> <!-- Drupal sniffs -->
<rule ref="Drupal.Classes.ClassCreateInstance"/> <rule ref="../vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/Classes/ClassCreateInstanceSniff.php"/>
<rule ref="Drupal.Classes.ClassDeclaration"/> <rule ref="../vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/Classes/ClassDeclarationSniff.php"/>
<rule ref="Drupal.Classes.FullyQualifiedNamespace"/> <rule ref="../vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/Classes/FullyQualifiedNamespaceSniff.php"/>
<rule ref="Drupal.Classes.UnusedUseStatement"/> <rule ref="../vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/Classes/UnusedUseStatementSniff.php"/>
<rule ref="Drupal.CSS.ClassDefinitionNameSpacing"/> <rule ref="../vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/CSS/ClassDefinitionNameSpacingSniff.php"/>
<rule ref="Drupal.CSS.ColourDefinition"/> <rule ref="../vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/CSS/ColourDefinitionSniff.php"/>
<rule ref="Drupal.Commenting.ClassComment"> <rule ref="../vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/Commenting/ClassCommentSniff.php">
<exclude name="Drupal.Commenting.ClassComment.Missing"/> <exclude name="Drupal.Commenting.ClassComment.Missing"/>
</rule> </rule>
<rule ref="Drupal.Commenting.DocComment"> <rule ref="../vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/Commenting/DocCommentSniff.php">
<!-- Sniff for these errors: SpacingAfterTagGroup, WrongEnd, SpacingBetween, <!-- Sniff for these errors: SpacingAfterTagGroup, WrongEnd, SpacingBetween,
ContentAfterOpen, SpacingBeforeShort, TagValueIndent, ShortStartSpace, ContentAfterOpen, SpacingBeforeShort, TagValueIndent, ShortStartSpace,
SpacingAfter --> SpacingAfter -->
...@@ -41,9 +41,9 @@ ...@@ -41,9 +41,9 @@
<exclude name="Drupal.Commenting.DocComment.TagGroupSpacing"/> <exclude name="Drupal.Commenting.DocComment.TagGroupSpacing"/>
<exclude name="Drupal.Commenting.DocComment.MissingShort"/> <exclude name="Drupal.Commenting.DocComment.MissingShort"/>
</rule> </rule>
<rule ref="Drupal.Commenting.DocCommentStar"/> <rule ref="../vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/Commenting/DocCommentStarSniff.php"/>
<rule ref="Drupal.Commenting.FileComment"/> <rule ref="../vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/Commenting/FileCommentSniff.php"/>
<rule ref="Drupal.Commenting.FunctionComment"> <rule ref="../vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/Commenting/FunctionCommentSniff.php">
<exclude name="Drupal.Commenting.FunctionComment.IncorrectTypeHint"/> <exclude name="Drupal.Commenting.FunctionComment.IncorrectTypeHint"/>
<exclude name="Drupal.Commenting.FunctionComment.InvalidNoReturn"/> <exclude name="Drupal.Commenting.FunctionComment.InvalidNoReturn"/>
<exclude name="Drupal.Commenting.FunctionComment.InvalidReturnNotVoid"/> <exclude name="Drupal.Commenting.FunctionComment.InvalidReturnNotVoid"/>
...@@ -65,41 +65,40 @@ ...@@ -65,41 +65,40 @@
<exclude name="Drupal.Commenting.FunctionComment.ReturnTypeSpaces"/> <exclude name="Drupal.Commenting.FunctionComment.ReturnTypeSpaces"/>
<exclude name="Drupal.Commenting.FunctionComment.TypeHintMissing"/> <exclude name="Drupal.Commenting.FunctionComment.TypeHintMissing"/>
</rule> </rule>
<rule ref="Drupal.ControlStructures.ElseIf"/> <rule ref="../vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/ControlStructures/ElseIfSniff.php"/>
<rule ref="Drupal.ControlStructures.ControlSignature"/> <rule ref="../vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/ControlStructures/ControlSignatureSniff.php"/>
<rule ref="Drupal.Files.EndFileNewline"/> <rule ref="../vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/Files/EndFileNewlineSniff.php"/>
<rule ref="Drupal.Files.TxtFileLineLength"/> <rule ref="../vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/Files/TxtFileLineLengthSniff.php"/>
<rule ref="Drupal.Formatting.SpaceInlineIf"/> <rule ref="../vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/Formatting/SpaceInlineIfSniff.php"/>
<rule ref="Drupal.Formatting.SpaceUnaryOperator"/> <rule ref="../vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/Formatting/SpaceUnaryOperatorSniff.php"/>
<rule ref="Drupal.Functions.DiscouragedFunctions"/> <rule ref="../vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/Functions/DiscouragedFunctionsSniff.php"/>
<rule ref="Drupal.Functions.FunctionDeclaration.SpaceAfter"/> <rule ref="../vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/Functions/FunctionDeclarationSniff.php"/>
<rule ref="Drupal.Functions.FunctionDeclaration.SpaceBeforeParenthesis"/> <rule ref="../vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/InfoFiles/AutoAddedKeysSniff.php"/>
<rule ref="Drupal.InfoFiles.AutoAddedKeys"/> <rule ref="../vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/InfoFiles/ClassFilesSniff.php"/>
<rule ref="Drupal.InfoFiles.ClassFiles"/> <rule ref="../vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/InfoFiles/DuplicateEntrySniff.php"/>
<rule ref="Drupal.InfoFiles.DuplicateEntry"/> <rule ref="../vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/InfoFiles/RequiredSniff.php"/>
<rule ref="Drupal.InfoFiles.Required"/> <rule ref="../vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/Scope/MethodScopeSniff.php"/>
<rule ref="Drupal.Scope.MethodScope"/> <rule ref="../vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/Semantics/EmptyInstallSniff.php"/>
<rule ref="Drupal.Semantics.EmptyInstall"/> <rule ref="../vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/Semantics/FunctionTSniff.php">
<rule ref="Drupal.Semantics.FunctionT">
<exclude name="Drupal.Semantics.FunctionT.BackslashSingleQuote"/> <exclude name="Drupal.Semantics.FunctionT.BackslashSingleQuote"/>
<exclude name="Drupal.Semantics.FunctionT.NotLiteralString"/> <exclude name="Drupal.Semantics.FunctionT.NotLiteralString"/>
<exclude name="Drupal.Semantics.FunctionT.ConcatString"/> <exclude name="Drupal.Semantics.FunctionT.ConcatString"/>
</rule> </rule>
<rule ref="Drupal.Semantics.FunctionWatchdog"/> <rule ref="../vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/Semantics/FunctionWatchdogSniff.php"/>
<rule ref="Drupal.Semantics.InstallHooks"/> <rule ref="../vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/Semantics/InstallHooksSniff.php"/>
<rule ref="Drupal.Semantics.LStringTranslatable"/> <rule ref="../vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/Semantics/LStringTranslatableSniff.php"/>
<rule ref="Drupal.Semantics.PregSecurity"/> <rule ref="../vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/Semantics/PregSecuritySniff.php"/>
<rule ref="Drupal.Semantics.TInHookMenu"/> <rule ref="../vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/Semantics/TInHookMenuSniff.php"/>
<rule ref="Drupal.Semantics.TInHookSchema"/> <rule ref="../vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/Semantics/TInHookSchemaSniff.php"/>
<rule ref="Drupal.WhiteSpace.Comma"/> <rule ref="../vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/WhiteSpace/CommaSniff.php"/>
<rule ref="Drupal.WhiteSpace.ObjectOperatorIndent"/> <rule ref="../vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/WhiteSpace/ObjectOperatorIndentSniff.php"/>
<rule ref="Drupal.WhiteSpace.ObjectOperatorSpacing"/> <rule ref="../vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/WhiteSpace/ObjectOperatorSpacingSniff.php"/>
<rule ref="Drupal.WhiteSpace.OpenTagNewline"/> <rule ref="../vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/WhiteSpace/OpenTagNewlineSniff.php"/>
<rule ref="Drupal.WhiteSpace.OperatorSpacing"/> <rule ref="../vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/WhiteSpace/OperatorSpacingSniff.php"/>
<rule ref="Drupal.WhiteSpace.ScopeIndent"/> <rule ref="../vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/WhiteSpace/ScopeIndentSniff.php"/>
<!-- Drupal Practice sniffs --> <!-- Drupal Practice sniffs -->
<rule ref="DrupalPractice.Commenting.ExpectedException"/> <rule ref="../vendor/drupal/coder/coder_sniffer/DrupalPractice/Sniffs/Commenting/ExpectedExceptionSniff.php"/>
<!-- Generic sniffs --> <!-- Generic sniffs -->
<rule ref="Generic.Files.LineEndings"/> <rule ref="Generic.Files.LineEndings"/>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment