CORE-POS/IS4C

View on GitHub
fannie/item/shrink/ShrinkTool.php

Summary

Maintainability
D
1 day
Test Coverage
F
23%

Method get_id_view has 123 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function get_id_view()
    {
        global $FANNIE_OP_DB;
        $dbc = FannieDB::get($FANNIE_OP_DB);
        $this->add_onload_command("\$('#qty-field').focus();\n");
Severity: Major
Found in fannie/item/shrink/ShrinkTool.php - About 4 hrs to fix

    File ShrinkTool.php has 347 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    /*******************************************************************************
    
        Copyright 2013 Whole Foods Community Co-op
    
    
    Severity: Minor
    Found in fannie/item/shrink/ShrinkTool.php - About 4 hrs to fix

      Method post_upc_description_department_cost_price_qty_reason_handler has 40 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function post_upc_description_department_cost_price_qty_reason_handler()
          {
              $recordReason = $this->reason;
              $newReason = FormLib::get('reason-other-text');
              if ($this->reason == 9 && $newReason != '') {
      Severity: Minor
      Found in fannie/item/shrink/ShrinkTool.php - About 1 hr to fix

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

            public function get_id_handler()
            {
                global $FANNIE_OP_DB;
                $dbc = FannieDB::get($FANNIE_OP_DB);
                $upc = BarcodeLib::padUPC($this->id);
        Severity: Minor
        Found in fannie/item/shrink/ShrinkTool.php - About 1 hr to fix

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

              public function get_id_handler()
              {
                  global $FANNIE_OP_DB;
                  $dbc = FannieDB::get($FANNIE_OP_DB);
                  $upc = BarcodeLib::padUPC($this->id);
          Severity: Minor
          Found in fannie/item/shrink/ShrinkTool.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

          Function getLossContribute has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

              private function getLossContribute($dbc)
              {
                  $deptP = $dbc->prepare("SELECT lossContribute FROM ShrinkDefaults WHERE deptID=?");
                  $dDefault = $dbc->getValue($deptP, array($this->department));
                  if ($dDefault && $dDefault == 'L') {
          Severity: Minor
          Found in fannie/item/shrink/ShrinkTool.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

          Avoid too many return statements within this method.
          Open

                  return array('', 'selected', '');
          Severity: Major
          Found in fannie/item/shrink/ShrinkTool.php - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                        return array('', '', 'selected');
            Severity: Major
            Found in fannie/item/shrink/ShrinkTool.php - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

                          return array('selected', '', '');
              Severity: Major
              Found in fannie/item/shrink/ShrinkTool.php - About 30 mins to fix

                There are no issues that match your filters.

                Category
                Status