vaimo/composer-patches

View on GitHub

Showing 105 of 970 total issues

Function apply has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    public function apply(Repository $repository, array $patches)
    {
        $packages = $this->packageCollector->collect($repository);
        $packagesUpdated = false;
        $repositoryState = $this->repoStateGenerator->generate($repository);
Severity: Minor
Found in src/Repository/PatchesApplier.php - About 1 hr 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 resolveInitialState has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    public function resolveInitialState(array $patches, array $state)
    {
        $patchesByTarget = $this->patchListTransformer->groupItemsByTarget($patches);
        $unpackedState = $this->patchListTransformer->createDetailedList($state);

Severity: Minor
Found in src/Repository/PatchesApplier/ListResolvers/ChangesListResolver.php - About 1 hr 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 getPackageMap has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    private function getPackageMap()
    {
        if ($this->packages === null) {
            $result = array();

Severity: Minor
Found in src/Composer/Context.php - About 1 hr 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 scanOutputForFailures has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    public function scanOutputForFailures($output, $separatorMatcher, array $failureMessages)
    {
        $patternsWithResults = array_filter($failureMessages, function ($pattern) use ($output) {
            return $pattern && preg_match($pattern, $output);
        });
Severity: Minor
Found in src/Console/OutputAnalyser.php - About 1 hr 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 collectPatchFilesFromPackages has 40 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    private function collectPatchFilesFromPackages(array $matches, Config $pluginConfig)
    {
        $composer = $this->getComposer();
        $composerConfig = $composer->getConfig();

Severity: Minor
Found in src/Composer/Commands/ValidateCommand.php - About 1 hr to fix

    Method createDefinitionItem has 38 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        private function createDefinitionItem($contents, array $values = array())
        {
            $header = $this->fileAnalyser->getHeader($contents);
    
            $data = $this->applyAliases(
    Severity: Minor
    Found in src/Patch/SourceLoaders/PatchesSearch.php - About 1 hr to fix

      Method execute has 36 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          protected function execute(InputInterface $input, OutputInterface $output)
          {
              $output->writeln('<info>Scanning packages for orphan patches</info>');
      
              $composer = $this->getComposer();
      Severity: Minor
      Found in src/Composer/Commands/ValidateCommand.php - About 1 hr to fix

        Method resolveComparisonResults has 36 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            private function resolveComparisonResults(array $patchConstraints, array $packages, array $rootRequires)
            {
                $comparisonResults = array();
        
                foreach ($patchConstraints as $constraintTarget => $version) {
        Severity: Minor
        Found in src/Patch/DefinitionList/LoaderComponents/ConstraintsComponent.php - About 1 hr to fix

          Function mergeAppliers has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
          Open

              private function mergeAppliers(array $config, array $updates)
              {
                  foreach ($config[Config::PATCHER_APPLIERS] as $code => $operations) {
                      if (!isset($updates[Config::PATCHER_APPLIERS][$code])) {
                          continue;
          Severity: Minor
          Found in src/Utils/ConfigUtils.php - About 1 hr 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 collectTargets has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
          Open

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

          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 createOutputRows has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
          Open

              private function createOutputRows(array $errors)
              {
                  $lines = array();
          
                  foreach ($errors as $type => $groups) {
          Severity: Minor
          Found in src/Console/OutputGenerator.php - About 1 hr 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 create has 35 lines of code (exceeds 25 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 1 hr to fix

            Method composerFilteredPatchesList has 33 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                private function composerFilteredPatchesList($patches, $additions, $removals, $withAffected, $filters, $statuses)
                {
                    $hasFilers = (bool)array_filter($filters);
            
                    $listResolver = new ListResolvers\FilteredListResolver($filters);
            Severity: Minor
            Found in src/Composer/Commands/ListCommand.php - About 1 hr to fix

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

                  public function process(array $patches, array $packagesByName)
                  {
                      $rootPackages = array_filter(
                          $packagesByName,
                          function ($package) {
              Severity: Minor
              Found in src/Patch/DefinitionList/LoaderComponents/ConstraintsComponent.php - About 1 hr 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 applyPatches has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function applyPatches(PackageInterface $package, array $patchesQueue)
                  {
                      $appliedPatches = array();
              
                      foreach ($patchesQueue as $source => $info) {
              Severity: Minor
              Found in src/Package/PatchApplier.php - About 1 hr 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 applyDefinitionKeyValueFilter has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function applyDefinitionKeyValueFilter(array $patches, $filter, $key)
                  {
                      foreach ($patches as &$packagePatches) {
                          foreach ($packagePatches as &$patchInfo) {
                              if (!isset($patchInfo[$key])) {
              Severity: Minor
              Found in src/Utils/PatchListUtils.php - About 1 hr 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 process has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function process(array $patches, array $packagesByName)
                  {
                      /** @var \Composer\Package\CompletePackageInterface $rootPackage */
                      $packages = $this->constraintPackages;
              
              
              Severity: Minor
              Found in src/Patch/DefinitionList/LoaderComponents/PlatformComponent.php - About 1 hr 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 process has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function process(array $patches, array $packagesByName)
                  {
                      foreach ($patches as &$packagePatches) {
                          foreach ($packagePatches as &$data) {
                              if ($data[PatchDefinition::URL]) {

              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 process has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function process(array $patches, array $packagesByName)
                  {
                      $ownerName = $this->ownerPackage->getName();
                      $relativePath = PathUtils::composePath($ownerName, 'downloads');
                      $absolutePath = PathUtils::composePath($this->vendorDir, $relativePath);
              Severity: Minor
              Found in src/Patch/DefinitionList/LoaderComponents/DownloaderComponent.php - About 1 hr 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 updateStatusMarkers has 31 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  private function updateStatusMarkers($patches, $repositoryState)
                  {
                      $patchesByTarget = $this->patchListTransformer->createTargetsList(array_map('array_filter', $patches));
                      $patchFootprints = $this->patchListTransformer->createSimplifiedList($patchesByTarget);
              
              
              Severity: Minor
              Found in src/Repository/PatchesApplier/QueueGenerator.php - About 1 hr to fix
                Severity
                Category
                Status
                Source
                Language