kristuff/mishell

View on GitHub

Showing 102 of 102 total issues

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

Missing class import via use statement (line '307', column '27').
Open

                throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
Severity: Minor
Found in vendor/composer/ClassLoader.php by phpmd

MissingImport

Since: 2.7.0

Importing all external classes in a file through use statements makes them clearly visible.

Example

function make() {
    return new \stdClass();
}

Source http://phpmd.org/rules/cleancode.html#MissingImport

The method register has a boolean flag argument $prepend, which is a certain sign of a Single Responsibility Principle violation.
Open

    public function register($prepend = false)
Severity: Minor
Found in vendor/composer/ClassLoader.php by phpmd

BooleanArgumentFlag

Since: 1.4.0

A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

Example

class Foo {
    public function bar($flag = true) {
    }
}

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

The method isInstalled has a boolean flag argument $includeDevRequirements, which is a certain sign of a Single Responsibility Principle violation.
Open

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

BooleanArgumentFlag

Since: 1.4.0

A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

Example

class Foo {
    public function bar($flag = true) {
    }
}

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

Missing class import via use statement (line '159', column '19').
Open

        throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
Severity: Minor
Found in vendor/composer/InstalledVersions.php by phpmd

MissingImport

Since: 2.7.0

Importing all external classes in a file through use statements makes them clearly visible.

Example

function make() {
    return new \stdClass();
}

Source http://phpmd.org/rules/cleancode.html#MissingImport

Avoid too many return statements within this method.
Open

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

    The method add has a boolean flag argument $prepend, which is a certain sign of a Single Responsibility Principle violation.
    Open

        public function add($prefix, $paths, $prepend = false)
    Severity: Minor
    Found in vendor/composer/ClassLoader.php by phpmd

    BooleanArgumentFlag

    Since: 1.4.0

    A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

    Example

    class Foo {
        public function bar($flag = true) {
        }
    }

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

    Missing class import via use statement (line '201', column '19').
    Open

            throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
    Severity: Minor
    Found in vendor/composer/InstalledVersions.php by phpmd

    MissingImport

    Since: 2.7.0

    Importing all external classes in a file through use statements makes them clearly visible.

    Example

    function make() {
        return new \stdClass();
    }

    Source http://phpmd.org/rules/cleancode.html#MissingImport

    Missing class import via use statement (line '239', column '19').
    Open

            throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
    Severity: Minor
    Found in vendor/composer/InstalledVersions.php by phpmd

    MissingImport

    Since: 2.7.0

    Importing all external classes in a file through use statements makes them clearly visible.

    Example

    function make() {
        return new \stdClass();
    }

    Source http://phpmd.org/rules/cleancode.html#MissingImport

    Missing class import via use statement (line '222', column '19').
    Open

            throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
    Severity: Minor
    Found in vendor/composer/InstalledVersions.php by phpmd

    MissingImport

    Since: 2.7.0

    Importing all external classes in a file through use statements makes them clearly visible.

    Example

    function make() {
        return new \stdClass();
    }

    Source http://phpmd.org/rules/cleancode.html#MissingImport

    Avoid too many return statements within this method.
    Open

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

      The method addPsr4 has a boolean flag argument $prepend, which is a certain sign of a Single Responsibility Principle violation.
      Open

          public function addPsr4($prefix, $paths, $prepend = false)
      Severity: Minor
      Found in vendor/composer/ClassLoader.php by phpmd

      BooleanArgumentFlag

      Since: 1.4.0

      A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

      Example

      class Foo {
          public function bar($flag = true) {
          }
      }

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

      Missing class import via use statement (line '180', column '19').
      Open

              throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
      Severity: Minor
      Found in vendor/composer/InstalledVersions.php by phpmd

      MissingImport

      Since: 2.7.0

      Importing all external classes in a file through use statements makes them clearly visible.

      Example

      function make() {
          return new \stdClass();
      }

      Source http://phpmd.org/rules/cleancode.html#MissingImport

      Avoid too many return statements within this method.
      Open

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

        Missing class import via use statement (line '252', column '27').
        Open

                        throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
        Severity: Minor
        Found in vendor/composer/ClassLoader.php by phpmd

        MissingImport

        Since: 2.7.0

        Importing all external classes in a file through use statements makes them clearly visible.

        Example

        function make() {
            return new \stdClass();
        }

        Source http://phpmd.org/rules/cleancode.html#MissingImport

        Remove error control operator '@' on line 262.
        Open

            public static function getRawData()
            {
                @trigger_error('getRawData only returns the first dataset loaded, which may not be what you expect. Use getAllRawData() instead which returns all datasets for all autoloaders present in the process.', E_USER_DEPRECATED);
        
                if (null === self::$installed) {
        Severity: Minor
        Found in vendor/composer/InstalledVersions.php by phpmd

        ErrorControlOperator

        Error suppression should be avoided if possible as it doesn't just suppress the error, that you are trying to stop, but will also suppress errors that you didn't predict would ever occur. Consider changing error_reporting() level and/or setting up your own error handler.

        Example

        function foo($filePath) {
            $file = @fopen($filPath); // hides exceptions
            $key = @$array[$notExistingKey]; // assigns null to $key
        }

        Source http://phpmd.org/rules/cleancode.html#errorcontroloperator

        Missing class import via use statement (line '28', column '39').
        Open

                self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__)));
        Severity: Minor
        Found in vendor/composer/autoload_real.php by phpmd

        MissingImport

        Since: 2.7.0

        Importing all external classes in a file through use statements makes them clearly visible.

        Example

        function make() {
            return new \stdClass();
        }

        Source http://phpmd.org/rules/cleancode.html#MissingImport

        The method progressBar has a boolean flag argument $withPurcent, which is a certain sign of a Single Responsibility Principle violation.
        Open

                $withPurcent = true
        Severity: Minor
        Found in lib/ShellColoredPrinter.php by phpmd

        BooleanArgumentFlag

        Since: 1.4.0

        A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

        Example

        class Foo {
            public function bar($flag = true) {
            }
        }

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

        Function getReference has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            public static function getReference($packageName)
            {
                foreach (self::getInstalled() as $installed) {
                    if (!isset($installed['versions'][$packageName])) {
                        continue;
        Severity: Minor
        Found in vendor/composer/InstalledVersions.php - About 25 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 getVersion has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            public static function getVersion($packageName)
            {
                foreach (self::getInstalled() as $installed) {
                    if (!isset($installed['versions'][$packageName])) {
                        continue;
        Severity: Minor
        Found in vendor/composer/InstalledVersions.php - About 25 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