kristuff/mishell

View on GitHub

Showing 23 of 102 total issues

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

    private function findFileWithExtension($class, $ext)
    {
        // PSR-4 lookup
        $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext;

Severity: Minor
Found in vendor/composer/ClassLoader.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 ClassLoader.php has 276 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

/*
 * This file is part of Composer.
 *
Severity: Minor
Found in vendor/composer/ClassLoader.php - About 2 hrs to fix

    ClassLoader has 23 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class ClassLoader
    {
        /** @var ?string */
        private $vendorDir;
    
    
    Severity: Minor
    Found in vendor/composer/ClassLoader.php - About 2 hrs to fix

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

          private static function getInstalled()
          {
              if (null === self::$canGetVendors) {
                  self::$canGetVendors = method_exists('Composer\Autoload\ClassLoader', 'getRegisteredLoaders');
              }
      Severity: Minor
      Found in vendor/composer/InstalledVersions.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 findFileWithExtension has 48 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          private function findFileWithExtension($class, $ext)
          {
              // PSR-4 lookup
              $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext;
      
      
      Severity: Minor
      Found in vendor/composer/ClassLoader.php - About 1 hr to fix

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

            public static function getVersionRanges($packageName)
            {
                foreach (self::getInstalled() as $installed) {
                    if (!isset($installed['versions'][$packageName])) {
                        continue;
        Severity: Minor
        Found in vendor/composer/InstalledVersions.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 cmd has 34 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            protected static function cmd($command, array $args)
            {
                // ouptut string is always the first argument (if any)
                $str = !empty($args) ? $args[0] : '';
        
        
        Severity: Minor
        Found in lib/ShellColoredPrinter.php - About 1 hr to fix

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

              public static function getLoader()
              {
                  if (null !== self::$loader) {
                      return self::$loader;
                  }
          Severity: Minor
          Found in vendor/composer/autoload_real.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 add has 30 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function add($prefix, $paths, $prepend = false)
              {
                  if (!$prefix) {
                      if ($prepend) {
                          $this->fallbackDirsPsr0 = array_merge(
          Severity: Minor
          Found in vendor/composer/ClassLoader.php - About 1 hr to fix

            Method addPsr4 has 30 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function addPsr4($prefix, $paths, $prepend = false)
                {
                    if (!$prefix) {
                        // Register directories for the root namespace.
                        if ($prepend) {
            Severity: Minor
            Found in vendor/composer/ClassLoader.php - About 1 hr to fix

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

                  public function findFile($class)
                  {
                      // class map lookup
                      if (isset($this->classMap[$class])) {
                          return $this->classMap[$class];
              Severity: Minor
              Found in vendor/composer/ClassLoader.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 getLoader has 27 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public static function getLoader()
                  {
                      if (null !== self::$loader) {
                          return self::$loader;
                      }
              Severity: Minor
              Found in vendor/composer/autoload_real.php - About 1 hr to fix

                Method progressBar has 8 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                        $percent, 
                        $color, 
                        $bgcolor, 
                        $background = 'darkgray', 
                        $progressLenght = 40, 
                Severity: Major
                Found in lib/ShellColoredPrinter.php - About 1 hr to fix

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

                      public function addPsr4($prefix, $paths, $prepend = false)
                      {
                          if (!$prefix) {
                              // Register directories for the root namespace.
                              if ($prepend) {
                  Severity: Minor
                  Found in vendor/composer/ClassLoader.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 getCliString has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                  Open

                      protected static function getCliString(string $str, array $arguments = [])
                      {
                          if (empty($arguments)){
                              return $str;
                          }
                  Severity: Minor
                  Found in lib/ShellColoredPrinter.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 add has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function add($prefix, $paths, $prepend = false)
                      {
                          if (!$prefix) {
                              if ($prepend) {
                                  $this->fallbackDirsPsr0 = array_merge(
                  Severity: Minor
                  Found in vendor/composer/ClassLoader.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 getInstalledPackagesByType has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public static function getInstalledPackagesByType($type)
                      {
                          $packagesByType = array();
                  
                          foreach (self::getInstalled() as $installed) {
                  Severity: Minor
                  Found in vendor/composer/InstalledVersions.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

                  Avoid too many return statements within this method.
                  Open

                          return null;
                  Severity: Major
                  Found in lib/ShellColoredPrinter.php - About 30 mins to fix

                    Avoid too many return statements within this method.
                    Open

                                return $file;
                    Severity: Major
                    Found in vendor/composer/ClassLoader.php - About 30 mins to fix

                      Avoid too many return statements within this method.
                      Open

                              return false;
                      Severity: Major
                      Found in vendor/composer/ClassLoader.php - About 30 mins to fix
                        Severity
                        Category
                        Status
                        Source
                        Language