Unverified Commit 01bd426e authored by alexpott's avatar alexpott
Browse files

Issue #3088730 by Spokje, anmolgoyal74, ankithashetty, Mile23, longwave,...

Issue #3088730 by Spokje, anmolgoyal74, ankithashetty, Mile23, longwave, naresh_bavaskar, greg.1.anderson, Mixologic, klausi: Include 'composer' directory in phpcs scans
parent f8fed30d
......@@ -29,7 +29,7 @@ public function __construct() {
}
/**
* Generate Drupal's metapackages whenever composer.lock is updated
* Generate Drupal's metapackages whenever composer.lock is updated.
*
* @param \Composer\IO\IOInterface $io
* Composer IO object for interacting with the user.
......
......@@ -73,11 +73,13 @@ public function getText() {
$this->messageText[] = ' * Name: ' . $homepage;
}
break;
case 'description':
if ($homepage = $this->rootPackage->getDescription()) {
$this->messageText[] = ' * Description: ' . $homepage;
}
break;
case 'homepage':
if ($homepage = $this->rootPackage->getHomepage()) {
$this->messageText[] = ' * Homepage: ' . $homepage;
......
......@@ -6,7 +6,7 @@
use Composer\Util\ProcessExecutor;
/**
* Provide some Git utility operations
* Provide some Git utility operations.
*
* @internal
*/
......@@ -21,6 +21,8 @@ private function __construct() {
/**
* Determines whether the specified scaffold file is already ignored.
*
* @param \Composer\IO\IOInterface $io
* The Composer IO interface.
* @param string $path
* Path to scaffold file to check.
* @param string $dir
......@@ -39,6 +41,8 @@ public static function checkIgnore(IOInterface $io, $path, $dir = NULL) {
/**
* Determines whether the specified scaffold file is tracked by git.
*
* @param \Composer\IO\IOInterface $io
* The Composer IO interface.
* @param string $path
* Path to scaffold file to check.
* @param string $dir
......@@ -57,8 +61,11 @@ public static function checkTracked(IOInterface $io, $path, $dir = NULL) {
/**
* Checks to see if the project root dir is in a git repository.
*
* @param \Composer\IO\IOInterface $io
* The Composer IO interface.
* @param string $dir
* Base directory for git process.
*
* @return bool
* True if this is a repository.
*/
......
......@@ -28,6 +28,8 @@ class ManageGitIgnore {
/**
* ManageGitIgnore constructor.
*
* @param \Composer\IO\IOInterface $io
* The Composer IO interface.
* @param string $dir
* The directory where the project is located.
*/
......
......@@ -126,7 +126,6 @@ public function process(ScaffoldFilePath $destination, IOInterface $io, Scaffold
$io->write($interpolator->interpolate(" - Prepend to <info>[dest-rel-path]</info> from <info>[prepend-rel-path]</info>"));
}
// Notify that we are appending, if there is append data.
$append_contents = '';
if (!empty($this->append)) {
$this->append->addInterpolationData($interpolator, 'append');
$io->write($interpolator->interpolate(" - Append to <info>[dest-rel-path]</info> from <info>[append-rel-path]</info>"));
......@@ -187,10 +186,12 @@ public function scaffoldAtNewLocation(ScaffoldFilePath $destination) {
/**
* Check to see if the append/prepend data has already been applied.
*
* @param string $contents
* The contents of the target file.
* @param \Drupal\Composer\Plugin\Scaffold\ScaffoldFilePath $data_path
* The path to the data to append or prepend
*
* @return bool
* 'TRUE' if the append/prepend data already exists in contents.
*/
......
......@@ -25,7 +25,7 @@ class OperationData {
protected $data;
/**
* The destination path
* The destination path.
*
* @var string
*/
......@@ -34,6 +34,8 @@ class OperationData {
/**
* OperationData constructor.
*
* @param string $destination
* The destination path.
* @param mixed $data
* The raw data array to wrap.
*/
......@@ -53,7 +55,7 @@ public function destination() {
}
/**
* Gets operation mode
* Gets operation mode.
*
* @return string
* Operation mode.
......@@ -63,7 +65,7 @@ public function mode() {
}
/**
* Checks if path exists
* Checks if path exists.
*
* @return bool
* Returns true if path exists
......@@ -73,7 +75,7 @@ public function hasPath() {
}
/**
* Gets path
* Gets path.
*
* @return string
* The path.
......
......@@ -103,7 +103,7 @@ public function filterFiles(array $files_to_filter) {
* TRUE if at least one item in the list has content
*/
protected function checkListHasItemWithContent(array $scaffold_files) {
foreach ($scaffold_files as $destination_rel_path => $scaffold_file) {
foreach ($scaffold_files as $scaffold_file) {
$contents = $scaffold_file->op()->contents();
if (!empty($contents)) {
return TRUE;
......@@ -186,7 +186,7 @@ public static function process(ScaffoldFileCollection $collection, IOInterface $
*/
public function checkUnchanged() {
$results = [];
foreach ($this as $project_name => $scaffold_files) {
foreach ($this as $scaffold_files) {
foreach ($scaffold_files as $scaffold_file) {
if (!$scaffold_file->hasChanged()) {
$results[] = $scaffold_file->destination()->relativePath();
......
......@@ -117,6 +117,7 @@ public function onPostCmd(Event $event) {
* PRE_PACKAGE_INSTALL event handler.
*
* @param \Composer\Installer\PackageEvent $event
* The package event.
*/
public function onPrePackageInstall(PackageEvent $event) {
/** @var \Composer\Package\CompletePackage $package */
......@@ -128,6 +129,7 @@ public function onPrePackageInstall(PackageEvent $event) {
* PRE_PACKAGE_UPDATE event handler.
*
* @param \Composer\Installer\PackageEvent $event
* The package event.
*/
public function onPrePackageUpdate(PackageEvent $event) {
/** @var \Composer\Package\CompletePackage $package */
......@@ -139,6 +141,7 @@ public function onPrePackageUpdate(PackageEvent $event) {
* POST_PACKAGE_INSTALL event handler.
*
* @param \Composer\Installer\PackageEvent $event
* The package event.
*/
public function onPostPackageInstall(PackageEvent $event) {
$this->cleanPackage($event->getOperation()->getPackage());
......@@ -148,6 +151,7 @@ public function onPostPackageInstall(PackageEvent $event) {
* POST_PACKAGE_UPDATE event handler.
*
* @param \Composer\Installer\PackageEvent $event
* The package event.
*/
public function onPostPackageUpdate(PackageEvent $event) {
$this->cleanPackage($event->getOperation()->getTargetPackage());
......@@ -211,6 +215,7 @@ protected function findBinOverlap($binaries, $clean_paths) {
$filesystem = [];
foreach ($clean_paths as $clean_path) {
$clean_pieces = explode("/", $clean_path);
// phpcs:ignore DrupalPractice.CodeAnalysis.VariableAnalysis.UnusedVariable
$current = &$filesystem;
foreach ($clean_pieces as $clean_piece) {
$current = &$current[$clean_piece];
......
......@@ -2,6 +2,7 @@
<ruleset name="drupal_core">
<description>Default PHP CodeSniffer configuration for Drupal core.</description>
<file>.</file>
<file>../composer</file>
<file>scripts/drupal.sh</file>
<file>scripts/password-hash.sh</file>
<file>scripts/rebuild_token_calculator.sh</file>
......
Supports Markdown
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