Bee-Lab/bowerphp

View on GitHub

Showing 36 of 36 total issues

Function isIgnored has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring.
Open

    public function isIgnored($name, array $ignore, array $force, $dirName)
    {
        $vName = substr($name, strlen($dirName));
        if (in_array($vName, $force, true)) {
            return false;
Severity: Minor
Found in src/Bowerphp/Installer/Installer.php - About 6 hrs 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

File Bowerphp.php has 314 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

/*
 * This file is part of Bowerphp.
 *
Severity: Minor
Found in src/Bowerphp/Bowerphp.php - About 3 hrs to fix

    Function execute has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
    Open

        protected function execute(InputInterface $input, OutputInterface $output)
        {
            $this->setGithubToken($output);
            $this->config->setSaveToBowerJsonFile($input->getOption('save'));
    
    
    Severity: Minor
    Found in src/Bowerphp/Command/InstallCommand.php - About 2 hrs 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 compile has 57 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function compile($pharFile = 'bowerphp.phar')
        {
            if (file_exists($pharFile)) {
                unlink($pharFile);
            }
    Severity: Major
    Found in src/Bowerphp/Compiler.php - About 2 hrs to fix

      Function isPackageExtraneous has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
      Open

          public function isPackageExtraneous(PackageInterface $package, $checkInstall = false)
          {
              if ($checkInstall && !$this->isPackageInstalled($package)) {
                  return false;
              }
      Severity: Minor
      Found in src/Bowerphp/Bowerphp.php - About 2 hrs 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 installPackage has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
      Open

          public function installPackage(PackageInterface $package, InstallerInterface $installer, $isDependency = false)
          {
              if (false !== strpos($package->getName(), 'github')) {
                  // install from a github endpoint
                  $name = basename($package->getName(), '.git');
      Severity: Minor
      Found in src/Bowerphp/Bowerphp.php - About 2 hrs 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 isIgnored has 52 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function isIgnored($name, array $ignore, array $force, $dirName)
          {
              $vName = substr($name, strlen($dirName));
              if (in_array($vName, $force, true)) {
                  return false;
      Severity: Major
      Found in src/Bowerphp/Installer/Installer.php - About 2 hrs to fix

        Function updatePackage has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
        Open

            public function updatePackage(PackageInterface $package, InstallerInterface $installer)
            {
                if (!$this->isPackageInstalled($package)) {
                    throw new RuntimeException(sprintf('Package %s is not installed.', $package->getName()));
                }
        Severity: Minor
        Found in src/Bowerphp/Bowerphp.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 installPackage has 42 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function installPackage(PackageInterface $package, InstallerInterface $installer, $isDependency = false)
            {
                if (false !== strpos($package->getName(), 'github')) {
                    // install from a github endpoint
                    $name = basename($package->getName(), '.git');
        Severity: Minor
        Found in src/Bowerphp/Bowerphp.php - About 1 hr to fix

          Method updatePackage has 40 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function updatePackage(PackageInterface $package, InstallerInterface $installer)
              {
                  if (!$this->isPackageInstalled($package)) {
                      throw new RuntimeException(sprintf('Package %s is not installed.', $package->getName()));
                  }
          Severity: Minor
          Found in src/Bowerphp/Bowerphp.php - About 1 hr to fix

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

                protected function execute(InputInterface $input, OutputInterface $output)
                {
                    $this->setGithubToken($output);
                    $this->config->setSaveToBowerJsonFile($input->getOption('save'));
            
            
            Severity: Minor
            Found in src/Bowerphp/Command/InstallCommand.php - About 1 hr to fix

              Method findPackage has 34 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function findPackage($rawCriteria = '*')
                  {
                      list($repoUser, $repoName) = explode('/', $this->clearGitURL($this->url));
                      $paginator = new ResultPager($this->githubClient);
                      $tags = $paginator->fetchAll($this->githubClient->api('repo'), 'tags', [$repoUser, $repoName]);
              Severity: Minor
              Found in src/Bowerphp/Repository/GithubRepository.php - About 1 hr to fix

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

                    public function install(PackageInterface $package)
                    {
                        $tmpFileName = $this->config->getCacheDir() . '/tmp/' . $package->getName();
                        if (true !== $this->zipArchive->open($tmpFileName)) {
                            throw new RuntimeException(sprintf('Unable to open zip file %s.', $tmpFileName));
                Severity: Minor
                Found in src/Bowerphp/Installer/Installer.php - About 1 hr to fix

                  Method isPackageExtraneous has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function isPackageExtraneous(PackageInterface $package, $checkInstall = false)
                      {
                          if ($checkInstall && !$this->isPackageInstalled($package)) {
                              return false;
                          }
                  Severity: Minor
                  Found in src/Bowerphp/Bowerphp.php - About 1 hr to fix

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

                        protected function execute(InputInterface $input, OutputInterface $output)
                        {
                            $this->setGithubToken($output);
                    
                            $packageName = $input->getArgument('package');
                    Severity: Minor
                    Found in src/Bowerphp/Command/InfoCommand.php - About 1 hr to fix

                      Function sortTags has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                      Open

                          private function sortTags(array $tags, $excludeUnstables = true)
                          {
                              $return = [];
                      
                              // Don't include invalid tags
                      Severity: Minor
                      Found in src/Bowerphp/Repository/GithubRepository.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 getDepBowerJson has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                      Open

                          private function getDepBowerJson($version)
                          {
                              list($repoUser, $repoName) = explode('/', $this->clearGitURL($this->url));
                              $contents = $this->githubClient->api('repo')->contents();
                              if ($contents->exists($repoUser, $repoName, 'bower.json', $version)) {
                      Severity: Minor
                      Found in src/Bowerphp/Repository/GithubRepository.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 install has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public function install(PackageInterface $package)
                          {
                              $tmpFileName = $this->config->getCacheDir() . '/tmp/' . $package->getName();
                              if (true !== $this->zipArchive->open($tmpFileName)) {
                                  throw new RuntimeException(sprintf('Unable to open zip file %s.', $tmpFileName));
                      Severity: Minor
                      Found in src/Bowerphp/Installer/Installer.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 findPackage has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public function findPackage($rawCriteria = '*')
                          {
                              list($repoUser, $repoName) = explode('/', $this->clearGitURL($this->url));
                              $paginator = new ResultPager($this->githubClient);
                              $tags = $paginator->fetchAll($this->githubClient->api('repo'), 'tags', [$repoUser, $repoName]);
                      Severity: Minor
                      Found in src/Bowerphp/Repository/GithubRepository.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 __construct has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public function __construct(Filesystem $filesystem)
                          {
                              $this->filesystem = $filesystem;
                              $this->cacheDir = $this->getHomeDir() . '/.cache/bowerphp';
                              $this->installDir = getcwd() . '/bower_components';
                      Severity: Minor
                      Found in src/Bowerphp/Config/Config.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

                      Severity
                      Category
                      Status
                      Source
                      Language