kristuff/mishell

View on GitHub

Showing 102 of 102 total issues

Avoid excessively long variable names like $includeDevRequirements. Keep variable name length under 20.
Open

    public static function isInstalled($packageName, $includeDevRequirements = true)
Severity: Minor
Found in vendor/composer/InstalledVersions.php by phpmd

LongVariable

Since: 0.2

Detects when a field, formal or local variable is declared with a long name.

Example

class Something {
    protected $reallyLongIntName = -3; // VIOLATION - Field
    public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
        $otherReallyLongName = -5; // VIOLATION - Local
        for ($interestingIntIndex = 0; // VIOLATION - For
             $interestingIntIndex < 10;
             $interestingIntIndex++ ) {
        }
    }
}

Source https://phpmd.org/rules/naming.html#longvariable

Avoid excessively long variable names like $defaultHorizontalSign. Keep variable name length under 20.
Open

    protected static $defaultHorizontalSign = '-';
Severity: Minor
Found in lib/TableStyle.php by phpmd

LongVariable

Since: 0.2

Detects when a field, formal or local variable is declared with a long name.

Example

class Something {
    protected $reallyLongIntName = -3; // VIOLATION - Field
    public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
        $otherReallyLongName = -5; // VIOLATION - Local
        for ($interestingIntIndex = 0; // VIOLATION - For
             $interestingIntIndex < 10;
             $interestingIntIndex++ ) {
        }
    }
}

Source https://phpmd.org/rules/naming.html#longvariable

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

        Avoid using undefined variables such as '$hit' which will lead to PHP notices.
        Open

                    $file = apcu_fetch($this->apcuPrefix.$class, $hit);
        Severity: Minor
        Found in vendor/composer/ClassLoader.php by phpmd

        UndefinedVariable

        Since: 2.8.0

        Detects when a variable is used that has not been defined before.

        Example

        class Foo
        {
            private function bar()
            {
                // $message is undefined
                echo $message;
            }
        }

        Source https://phpmd.org/rules/cleancode.html#undefinedvariable

        Avoid using undefined variables such as '$hit' which will lead to PHP notices.
        Open

                    if ($hit) {
        Severity: Minor
        Found in vendor/composer/ClassLoader.php by phpmd

        UndefinedVariable

        Since: 2.8.0

        Detects when a variable is used that has not been defined before.

        Example

        class Foo
        {
            private function bar()
            {
                // $message is undefined
                echo $message;
            }
        }

        Source https://phpmd.org/rules/cleancode.html#undefinedvariable

        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

            Similar blocks of code found in 3 locations. Consider refactoring.
            Open

                public static function getVersion($packageName)
                {
                    foreach (self::getInstalled() as $installed) {
                        if (!isset($installed['versions'][$packageName])) {
                            continue;
            Severity: Major
            Found in vendor/composer/InstalledVersions.php and 2 other locations - About 45 mins to fix
            vendor/composer/InstalledVersions.php on lines 187..202
            vendor/composer/InstalledVersions.php on lines 208..223

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 96.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 3 locations. Consider refactoring.
            Open

                public static function getPrettyVersion($packageName)
                {
                    foreach (self::getInstalled() as $installed) {
                        if (!isset($installed['versions'][$packageName])) {
                            continue;
            Severity: Major
            Found in vendor/composer/InstalledVersions.php and 2 other locations - About 45 mins to fix
            vendor/composer/InstalledVersions.php on lines 166..181
            vendor/composer/InstalledVersions.php on lines 208..223

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 96.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 3 locations. Consider refactoring.
            Open

                public static function getReference($packageName)
                {
                    foreach (self::getInstalled() as $installed) {
                        if (!isset($installed['versions'][$packageName])) {
                            continue;
            Severity: Major
            Found in vendor/composer/InstalledVersions.php and 2 other locations - About 45 mins to fix
            vendor/composer/InstalledVersions.php on lines 166..181
            vendor/composer/InstalledVersions.php on lines 187..202

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 96.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            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

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

                protected static $foregroundColors = array(
                    'black'        => '30', 
                    'red'          => '31', 
                    'green'        => '32', 
                    'yellow'       => '33',
            Severity: Minor
            Found in lib/ShellColoredPrinter.php and 1 other location - About 35 mins to fix
            lib/ShellColoredPrinter.php on lines 56..74

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 92.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

                protected static $backgroundColors = array(
                    'black'        => '40',   
                    'red'          => '41',
                    'green'        => '42',   
                    'yellow'       => '43',
            Severity: Minor
            Found in lib/ShellColoredPrinter.php and 1 other location - About 35 mins to fix
            lib/ShellColoredPrinter.php on lines 29..47

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 92.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            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

            Severity
            Category
            Status
            Source
            Language