CORE-POS/IS4C

View on GitHub
fannie/modules/plugins2.0/ShelfAudit/SaItemList.php

Summary

Maintainability
D
2 days
Test Coverage

File SaItemList.php has 380 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/*******************************************************************************

    Copyright 2013 Whole Foods Co-op

Severity: Minor
Found in fannie/modules/plugins2.0/ShelfAudit/SaItemList.php - About 5 hrs to fix

    Method getList has 114 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        private function getList()
        {
            $settings = $this->config->get('PLUGIN_SETTINGS');
            $this->connection->selectDB($this->config->get('OP_DB'));
            $uid = FannieAuth::getUID($this->current_user);
    Severity: Major
    Found in fannie/modules/plugins2.0/ShelfAudit/SaItemList.php - About 4 hrs to fix

      Function getList has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
      Open

          private function getList()
          {
              $settings = $this->config->get('PLUGIN_SETTINGS');
              $this->connection->selectDB($this->config->get('OP_DB'));
              $uid = FannieAuth::getUID($this->current_user);
      Severity: Minor
      Found in fannie/modules/plugins2.0/ShelfAudit/SaItemList.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 get_dateID_view has 36 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          protected function get_dateID_view()
          {
              $opts = array();
              $lbls = array();
              for ($i=0; $i<12; $i++) {
      Severity: Minor
      Found in fannie/modules/plugins2.0/ShelfAudit/SaItemList.php - About 1 hr to fix

        Method exportList has 36 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            private function exportList($set=1)
            {
                $settings = $this->config->get('PLUGIN_SETTINGS');
                $this->connection->selectDB($this->config->get('OP_DB'));
                $uid = FannieAuth::getUID($this->current_user);
        Severity: Minor
        Found in fannie/modules/plugins2.0/ShelfAudit/SaItemList.php - About 1 hr to fix

          Method get_view has 27 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function get_view()
              {
                  $elem = '#upc_in';
                  if (isset($this->current_item_data['upc']) && isset($this->current_item_data['desc'])) $elem = '#cur_qty';
                  $this->addOnloadCommand('$(\'#upc_in\').focus();');
          Severity: Minor
          Found in fannie/modules/plugins2.0/ShelfAudit/SaItemList.php - About 1 hr to fix

            Method get_id_handler has 26 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                protected function get_id_handler()
                {
                    $dbc = $this->connection;
                    $settings = $this->config->get('PLUGIN_SETTINGS');
                    $uid = FannieAuth::getUID($this->current_user);
            Severity: Minor
            Found in fannie/modules/plugins2.0/ShelfAudit/SaItemList.php - About 1 hr to fix

              Function get_id_handler has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                  protected function get_id_handler()
                  {
                      $dbc = $this->connection;
                      $settings = $this->config->get('PLUGIN_SETTINGS');
                      $uid = FannieAuth::getUID($this->current_user);
              Severity: Minor
              Found in fannie/modules/plugins2.0/ShelfAudit/SaItemList.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

              There are no issues that match your filters.

              Category
              Status