deployphp/deployer

View on GitHub
src/Importer/Importer.php

Summary

Maintainability
D
2 days
Test Coverage

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

    protected static function tasks(array $tasks)
    {
        $buildTask = function ($name, $steps) {
            $body = function () {
            };
Severity: Minor
Found in src/Importer/Importer.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

Method tasks has 95 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    protected static function tasks(array $tasks)
    {
        $buildTask = function ($name, $steps) {
            $body = function () {
            };
Severity: Major
Found in src/Importer/Importer.php - About 3 hrs to fix

    Function import has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
    Open

        public static function import($paths)
        {
            if (!is_array($paths)) {
                $paths = [$paths];
            }
    Severity: Minor
    Found in src/Importer/Importer.php - About 3 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 import has 45 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public static function import($paths)
        {
            if (!is_array($paths)) {
                $paths = [$paths];
            }
    Severity: Minor
    Found in src/Importer/Importer.php - About 1 hr to fix

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

          protected static function before(array $before)
          {
              foreach ($before as $key => $value) {
                  if (is_array($value)) {
                      foreach (array_reverse($value) as $v) {
      Severity: Minor
      Found in src/Importer/Importer.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 after has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

          protected static function after(array $after)
          {
              foreach ($after as $key => $value) {
                  if (is_array($value)) {
                      foreach (array_reverse($value) as $v) {
      Severity: Minor
      Found in src/Importer/Importer.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 hosts has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

          protected static function hosts(array $hosts)
          {
              foreach ($hosts as $alias => $config) {
                  if ($config['local'] ?? false) {
                      $host = localhost($alias);
      Severity: Minor
      Found in src/Importer/Importer.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

      There are no issues that match your filters.

      Category
      Status