vaimo/composer-patches

View on GitHub

Showing 105 of 970 total issues

Method processPatchesForPackage has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    private function processPatchesForPackage(Repository $repository, Package $package, array $patchesQueue)
    {
        $processIndentation = $this->logger->push('~');

        try {
Severity: Minor
Found in src/Repository/PatchesApplier.php - About 1 hr to fix

    Method validateOutput has 26 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        private function validateOutput($output, $operationFailures)
        {
            $pathMarker = '\|\+\+\+\s(?P<match>.*?)(\t|$)';
            $pathMatcher = sprintf('/^%s/', $pathMarker);
    
    
    Severity: Minor
    Found in src/Patch/File/Applier.php - About 1 hr to fix

      Method collectTargets has 26 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          private function collectTargets($packagesByName, $packagePatches)
          {
              $result = array();
      
              foreach ($packagePatches as $index => $info) {

        Function getNodeReferencesByPaths has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

            public function getNodeReferencesByPaths(array &$data, array $paths)
            {
                $stack = array();
        
                foreach ($paths as $path) {
        Severity: Minor
        Found in src/Utils/DataUtils.php - About 55 mins to fix

        Cognitive Complexity

        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

        A method's cognitive complexity is based on a few simple rules:

        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
        • Code is considered more complex for each "break in the linear flow of the code"
        • Code is considered more complex when "flow breaking structures are nested"

        Further reading

        Function processOperationItems has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

            private function processOperationItems($patcher, $operations, $args, $failures)
            {
                $operationResults = array_fill_keys(array_keys($operations), '');
                $result = true;
        
        
        Severity: Minor
        Found in src/Patch/File/Applier.php - About 55 mins to fix

        Cognitive Complexity

        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

        A method's cognitive complexity is based on a few simple rules:

        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
        • Code is considered more complex for each "break in the linear flow of the code"
        • Code is considered more complex when "flow breaking structures are nested"

        Further reading

        Method downloadPackage has 7 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            public function downloadPackage($downloader, $package, $source, $destDir, $errorHandler, &$patchData, &$errors)
        Severity: Major
        Found in src/Compatibility/Executor.php - About 50 mins to fix

          Function validateOutput has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              private function validateOutput($output, $operationFailures)
              {
                  $pathMarker = '\|\+\+\+\s(?P<match>.*?)(\t|$)';
                  $pathMatcher = sprintf('/^%s/', $pathMarker);
          
          
          Severity: Minor
          Found in src/Patch/File/Applier.php - About 45 mins to fix

          Cognitive Complexity

          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

          A method's cognitive complexity is based on a few simple rules:

          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
          • Code is considered more complex for each "break in the linear flow of the code"
          • Code is considered more complex when "flow breaking structures are nested"

          Further reading

          Function resolveNamesFromPaths has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              public function resolveNamesFromPaths(array $packagesByName, array $paths)
              {
                  $paths = array_unique(
                      array_map('dirname', $paths)
                  );
          Severity: Minor
          Found in src/Package/InfoResolver.php - About 45 mins to fix

          Cognitive Complexity

          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

          A method's cognitive complexity is based on a few simple rules:

          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
          • Code is considered more complex for each "break in the linear flow of the code"
          • Code is considered more complex when "flow breaking structures are nested"

          Further reading

          Function getInstallPath has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              public function getInstallPath(PackageInterface $package, $resolveMode)
              {
                  $key = $package->getName() . '|' . $resolveMode;
          
                  if (!isset($this->installPathCache[$key])) {
          Severity: Minor
          Found in src/Package/InfoResolver.php - About 45 mins to fix

          Cognitive Complexity

          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

          A method's cognitive complexity is based on a few simple rules:

          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
          • Code is considered more complex for each "break in the linear flow of the code"
          • Code is considered more complex when "flow breaking structures are nested"

          Further reading

          Method __construct has 6 arguments (exceeds 4 allowed). Consider refactoring.
          Open

                  \Composer\Composer $composer,
                  \Composer\Package\PackageInterface $ownerPackage,
                  \Composer\Downloader\FileDownloader $downloadManager,
                  \Vaimo\ComposerPatches\Console\Silencer $consoleSilencer,
                  $vendorDir,
          Severity: Minor
          Found in src/Patch/DefinitionList/LoaderComponents/DownloaderComponent.php - About 45 mins to fix

            Function create has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                public function create(array $configSources = array())
                {
                    $defaults = array_replace(
                        $this->defaultsProvider->getPatcherConfig(),
                        $this->defaults,
            Severity: Minor
            Found in src/Factories/ConfigFactory.php - About 45 mins to fix

            Cognitive Complexity

            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

            A method's cognitive complexity is based on a few simple rules:

            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
            • Code is considered more complex for each "break in the linear flow of the code"
            • Code is considered more complex when "flow breaking structures are nested"

            Further reading

            Function parseContents has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                public function parseContents($header)
                {
                    $lines = explode(PHP_EOL, $header);
            
                    $key = 'label';
            Severity: Minor
            Found in src/Patch/File/Header/Parser.php - About 45 mins to fix

            Cognitive Complexity

            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

            A method's cognitive complexity is based on a few simple rules:

            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
            • Code is considered more complex for each "break in the linear flow of the code"
            • Code is considered more complex when "flow breaking structures are nested"

            Further reading

            Function sanitize has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                public function sanitize()
                {
                    $lockData = $this->lockerManager->readLockData();
            
                    if (!$lockData) {
            Severity: Minor
            Found in src/Repository/Lock/Sanitizer.php - About 45 mins to fix

            Cognitive Complexity

            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

            A method's cognitive complexity is based on a few simple rules:

            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
            • Code is considered more complex for each "break in the linear flow of the code"
            • Code is considered more complex when "flow breaking structures are nested"

            Further reading

            Function groupItemsByTarget has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                public function groupItemsByTarget(array $patchesList)
                {
                    $result = array();
            
                    foreach ($patchesList as $origin => $group) {
            Severity: Minor
            Found in src/Patch/DefinitionList/Transformer.php - About 45 mins to fix

            Cognitive Complexity

            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

            A method's cognitive complexity is based on a few simple rules:

            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
            • Code is considered more complex for each "break in the linear flow of the code"
            • Code is considered more complex when "flow breaking structures are nested"

            Further reading

            Method composerFilteredPatchesList has 6 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                private function composerFilteredPatchesList($patches, $additions, $removals, $withAffected, $filters, $statuses)
            Severity: Minor
            Found in src/Composer/Commands/ListCommand.php - About 45 mins to fix

              Method __construct has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                      \Composer\EventDispatcher\EventDispatcher $eventDispatcher,
                      \Vaimo\ComposerPatches\Package\InfoResolver $packageInfoResolver,
                      \Vaimo\ComposerPatches\Interfaces\PatchFailureHandlerInterface $failureHandler,
                      \Vaimo\ComposerPatches\Patch\File\Applier $fileApplier,
                      \Vaimo\ComposerPatches\Logger $logger
              Severity: Minor
              Found in src/Package/PatchApplier/ItemProcessor.php - About 35 mins to fix

                Method __construct has 5 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                        \Vaimo\ComposerPatches\Composer\Context $composerContext,
                        \Composer\IO\IOInterface $appIO,
                        \Vaimo\ComposerPatches\Factories\ConfigFactory $configFactory,
                        \Vaimo\ComposerPatches\Interfaces\ListResolverInterface $listResolver = null,
                        \Vaimo\ComposerPatches\Strategies\OutputStrategy $outputStrategy = null
                Severity: Minor
                Found in src/Bootstrap.php - About 35 mins to fix

                  Function process has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function process($label, $data)
                      {
                          foreach ($this->components as $processor) {
                              if (!$processor->shouldProcess($label, $data)) {
                                  continue;
                  Severity: Minor
                  Found in src/Patch/Definition/Exploder.php - About 35 mins to fix

                  Cognitive Complexity

                  Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                  A method's cognitive complexity is based on a few simple rules:

                  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                  • Code is considered more complex for each "break in the linear flow of the code"
                  • Code is considered more complex when "flow breaking structures are nested"

                  Further reading

                  Function getClosestDirForFile has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public static function getClosestDirForFile($path, $fileName)
                      {
                          while (true) {
                              if (\is_dir($path) && \file_exists(PathUtils::composePath($path, $fileName))) {
                                  return $path;
                  Severity: Minor
                  Found in src/FileSystem/PathResolver.php - About 35 mins to fix

                  Cognitive Complexity

                  Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                  A method's cognitive complexity is based on a few simple rules:

                  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                  • Code is considered more complex for each "break in the linear flow of the code"
                  • Code is considered more complex when "flow breaking structures are nested"

                  Further reading

                  Function resolveSourceConfig has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                      private function resolveSourceConfig($patcherConfig)
                      {
                          $sourceConfig = $patcherConfig[PluginConfig::PATCHER_SOURCES];
                  
                          if (isset($sourceConfig['packages'], $sourceConfig['vendors'])) {
                  Severity: Minor
                  Found in src/Factories/SourcesResolverFactory.php - About 35 mins to fix

                  Cognitive Complexity

                  Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                  A method's cognitive complexity is based on a few simple rules:

                  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                  • Code is considered more complex for each "break in the linear flow of the code"
                  • Code is considered more complex when "flow breaking structures are nested"

                  Further reading

                  Severity
                  Category
                  Status
                  Source
                  Language