Skip to content
Snippets Groups Projects
Commit aaf99e1e authored by Alex Pott's avatar Alex Pott
Browse files

Issue #2744463 by Mile23, dawehner, pfrenssen, joelpittet, tstoeckler,...

Issue #2744463 by Mile23, dawehner, pfrenssen, joelpittet, tstoeckler, alexpott, klausi: Add phpcs, coder 8.2.8 as --dev requirements for drupal/core
parent 2572749d
No related branches found
No related tags found
2 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
...@@ -44,7 +44,10 @@ ...@@ -44,7 +44,10 @@
}, },
"scripts": { "scripts": {
"pre-autoload-dump": "Drupal\\Core\\Composer\\Composer::preAutoloadDump", "pre-autoload-dump": "Drupal\\Core\\Composer\\Composer::preAutoloadDump",
"post-autoload-dump": "Drupal\\Core\\Composer\\Composer::ensureHtaccess", "post-autoload-dump": [
"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"
} }
......
...@@ -3041,6 +3041,42 @@ ...@@ -3041,6 +3041,42 @@
], ],
"time": "2015-06-14T21:17:01+00:00" "time": "2015-06-14T21:17:01+00:00"
}, },
{
"name": "drupal/coder",
"version": "8.2.8",
"source": {
"type": "git",
"url": "https://github.com/klausi/coder.git",
"reference": "6d717e1a5a5dd592ebbeaafad11746849fb52532"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/klausi/coder/zipball/6d717e1a5a5dd592ebbeaafad11746849fb52532",
"reference": "6d717e1a5a5dd592ebbeaafad11746849fb52532",
"shasum": ""
},
"require": {
"php": ">=5.4.0",
"squizlabs/php_codesniffer": ">=2.5.1",
"symfony/yaml": ">=2.0.0"
},
"require-dev": {
"phpunit/phpunit": ">=3.7"
},
"type": "library",
"notification-url": "https://packagist.org/downloads/",
"license": [
"GPL-2.0+"
],
"description": "Coder is a library to review Drupal code.",
"homepage": "https://www.drupal.org/project/coder",
"keywords": [
"code review",
"phpcs",
"standards"
],
"time": "2016-07-05T20:48:03+00:00"
},
{ {
"name": "fabpot/goutte", "name": "fabpot/goutte",
"version": "v3.1.2", "version": "v3.1.2",
...@@ -4102,6 +4138,84 @@ ...@@ -4102,6 +4138,84 @@
"homepage": "https://github.com/sebastianbergmann/version", "homepage": "https://github.com/sebastianbergmann/version",
"time": "2015-06-21T13:59:46+00:00" "time": "2015-06-21T13:59:46+00:00"
}, },
{
"name": "squizlabs/php_codesniffer",
"version": "2.7.1",
"source": {
"type": "git",
"url": "https://github.com/squizlabs/PHP_CodeSniffer.git",
"reference": "9b324f3a1132459a7274a0ace2e1b766ba80930f"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/9b324f3a1132459a7274a0ace2e1b766ba80930f",
"reference": "9b324f3a1132459a7274a0ace2e1b766ba80930f",
"shasum": ""
},
"require": {
"ext-simplexml": "*",
"ext-tokenizer": "*",
"ext-xmlwriter": "*",
"php": ">=5.1.2"
},
"require-dev": {
"phpunit/phpunit": "~4.0"
},
"bin": [
"scripts/phpcs",
"scripts/phpcbf"
],
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.x-dev"
}
},
"autoload": {
"classmap": [
"CodeSniffer.php",
"CodeSniffer/CLI.php",
"CodeSniffer/Exception.php",
"CodeSniffer/File.php",
"CodeSniffer/Fixer.php",
"CodeSniffer/Report.php",
"CodeSniffer/Reporting.php",
"CodeSniffer/Sniff.php",
"CodeSniffer/Tokens.php",
"CodeSniffer/Reports/",
"CodeSniffer/Tokenizers/",
"CodeSniffer/DocGenerators/",
"CodeSniffer/Standards/AbstractPatternSniff.php",
"CodeSniffer/Standards/AbstractScopeSniff.php",
"CodeSniffer/Standards/AbstractVariableSniff.php",
"CodeSniffer/Standards/IncorrectPatternException.php",
"CodeSniffer/Standards/Generic/Sniffs/",
"CodeSniffer/Standards/MySource/Sniffs/",
"CodeSniffer/Standards/PEAR/Sniffs/",
"CodeSniffer/Standards/PSR1/Sniffs/",
"CodeSniffer/Standards/PSR2/Sniffs/",
"CodeSniffer/Standards/Squiz/Sniffs/",
"CodeSniffer/Standards/Zend/Sniffs/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Greg Sherwood",
"role": "lead"
}
],
"description": "PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.",
"homepage": "http://www.squizlabs.com/php-codesniffer",
"keywords": [
"phpcs",
"standards"
],
"time": "2016-11-30T04:02:31+00:00"
},
{ {
"name": "symfony/browser-kit", "name": "symfony/browser-kit",
"version": "v2.8.16", "version": "v2.8.16",
......
...@@ -38,6 +38,7 @@ ...@@ -38,6 +38,7 @@
"require-dev": { "require-dev": {
"behat/mink": "1.7.x-dev", "behat/mink": "1.7.x-dev",
"behat/mink-goutte-driver": "~1.2", "behat/mink-goutte-driver": "~1.2",
"drupal/coder": "8.2.8",
"jcalderonzumba/gastonjs": "~1.0.2", "jcalderonzumba/gastonjs": "~1.0.2",
"jcalderonzumba/mink-phantomjs-driver": "~0.3.1", "jcalderonzumba/mink-phantomjs-driver": "~0.3.1",
"mikey179/vfsStream": "~1.2", "mikey179/vfsStream": "~1.2",
...@@ -170,6 +171,9 @@ ...@@ -170,6 +171,9 @@
}, },
"scripts": { "scripts": {
"pre-autoload-dump": "Drupal\\Core\\Composer\\Composer::preAutoloadDump", "pre-autoload-dump": "Drupal\\Core\\Composer\\Composer::preAutoloadDump",
"post-autoload-dump": "Drupal\\Core\\Composer\\Composer::ensureHtaccess" "post-autoload-dump": [
"Drupal\\Core\\Composer\\Composer::ensureHtaccess",
"Drupal\\Core\\Composer\\Composer::configurePhpcs"
]
} }
} }
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
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.
...@@ -18,6 +19,7 @@ class Composer { ...@@ -18,6 +19,7 @@ class Composer {
'behat/mink' => ['tests', 'driver-testsuite'], 'behat/mink' => ['tests', 'driver-testsuite'],
'behat/mink-browserkit-driver' => ['tests'], 'behat/mink-browserkit-driver' => ['tests'],
'behat/mink-goutte-driver' => ['tests'], 'behat/mink-goutte-driver' => ['tests'],
'drupal/coder' => ['coder_sniffer/Drupal/Test', 'coder_sniffer/DrupalPractice/Test'],
'doctrine/cache' => ['tests'], 'doctrine/cache' => ['tests'],
'doctrine/collections' => ['tests'], 'doctrine/collections' => ['tests'],
'doctrine/common' => ['tests'], 'doctrine/common' => ['tests'],
...@@ -135,6 +137,28 @@ public static function ensureHtaccess(Event $event) { ...@@ -135,6 +137,28 @@ 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.
* *
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment