Issue #3088730 by Spokje, anmolgoyal74, ankithashetty, Mile23, longwave, naresh_bavaskar, greg.1.anderson, Mixologic, klausi: Include 'composer' directory in phpcs scans
parent
f8fed30d8f
commit
01bd426e28
|
@ -29,7 +29,7 @@ class PackageGenerator {
|
|||
}
|
||||
|
||||
/**
|
||||
* 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 @@ class Message {
|
|||
$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\IO\IOInterface;
|
|||
use Composer\Util\ProcessExecutor;
|
||||
|
||||
/**
|
||||
* Provide some Git utility operations
|
||||
* Provide some Git utility operations.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
|
@ -21,6 +21,8 @@ class Git {
|
|||
/**
|
||||
* 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 @@ class Git {
|
|||
/**
|
||||
* 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 @@ class Git {
|
|||
/**
|
||||
* 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 @@ class AppendOp extends AbstractOperation {
|
|||
$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 @@ class AppendOp extends AbstractOperation {
|
|||
|
||||
/**
|
||||
* 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 @@ class OperationData {
|
|||
}
|
||||
|
||||
/**
|
||||
* Gets operation mode
|
||||
* Gets operation mode.
|
||||
*
|
||||
* @return string
|
||||
* Operation mode.
|
||||
|
@ -63,7 +65,7 @@ class OperationData {
|
|||
}
|
||||
|
||||
/**
|
||||
* Checks if path exists
|
||||
* Checks if path exists.
|
||||
*
|
||||
* @return bool
|
||||
* Returns true if path exists
|
||||
|
@ -73,7 +75,7 @@ class OperationData {
|
|||
}
|
||||
|
||||
/**
|
||||
* Gets path
|
||||
* Gets path.
|
||||
*
|
||||
* @return string
|
||||
* The path.
|
||||
|
|
|
@ -103,7 +103,7 @@ class ScaffoldFileCollection implements \IteratorAggregate {
|
|||
* 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 @@ class ScaffoldFileCollection implements \IteratorAggregate {
|
|||
*/
|
||||
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 @@ class VendorHardeningPlugin implements PluginInterface, EventSubscriberInterface
|
|||
* 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 @@ class VendorHardeningPlugin implements PluginInterface, EventSubscriberInterface
|
|||
* 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 @@ class VendorHardeningPlugin implements PluginInterface, EventSubscriberInterface
|
|||
* 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 @@ class VendorHardeningPlugin implements PluginInterface, EventSubscriberInterface
|
|||
* 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 @@ class VendorHardeningPlugin implements PluginInterface, EventSubscriberInterface
|
|||
$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>
|
||||
|
|
Loading…
Reference in New Issue