Oefenweb/cakephp-queue

View on GitHub
Console/Command/QueueShell.php

Summary

Maintainability
D
2 days
Test Coverage

Function runworker has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
Open

    public function runworker() {
        // Enable garbage collector (PHP >= 5.3)
        if (function_exists('gc_enable')) {
            gc_enable();
        }
Severity: Minor
Found in Console/Command/QueueShell.php - About 4 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 runworker has 70 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function runworker() {
        // Enable garbage collector (PHP >= 5.3)
        if (function_exists('gc_enable')) {
            gc_enable();
        }
Severity: Major
Found in Console/Command/QueueShell.php - About 2 hrs to fix

    File QueueShell.php has 281 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    App::uses('Folder', 'Utility');
    App::uses('QueuedTask', 'Model');
    App::uses('AppShell', 'Console/Command');
    App::uses('CakeText', 'Utility');
    Severity: Minor
    Found in Console/Command/QueueShell.php - About 2 hrs to fix

      Method getOptionParser has 49 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function getOptionParser() {
              $parser = parent::getOptionParser();
              $parser->addSubcommand('add', [
                  'help' => __d('queue', 'Tries to call the cli `add()` function on a task.'),
                  'parser' => [
      Severity: Minor
      Found in Console/Command/QueueShell.php - About 1 hr to fix

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

            protected function _getTaskConf() {
                if (!is_array($this->_taskConf)) {
                    $this->_taskConf = [];
                    foreach ($this->tasks as $task) {
                        list($pluginName, $taskName) = pluginSplit($task);
        Severity: Minor
        Found in Console/Command/QueueShell.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 initialize has 41 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function initialize() {
                // Check for tasks inside plugins and application
                $paths = App::path('Console/Command/Task');
        
                foreach ($paths as $path) {
        Severity: Minor
        Found in Console/Command/QueueShell.php - About 1 hr to fix

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

              public function initialize() {
                  // Check for tasks inside plugins and application
                  $paths = App::path('Console/Command/Task');
          
                  foreach ($paths as $path) {
          Severity: Minor
          Found in Console/Command/QueueShell.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

          There are no issues that match your filters.

          Category
          Status