CORE-POS/IS4C

View on GitHub
fannie/item/DepartmentDiscrepancyPage.php

Summary

Maintainability
F
5 days
Test Coverage
F
21%

Function get_view has a Cognitive Complexity of 61 (exceeds 5 allowed). Consider refactoring.
Open

    public function get_view()
    { 
        $dbc = $this->connection;
        $dbc->selectDB($this->config->get('OP_DB'));
        $ret = '';
Severity: Minor
Found in fannie/item/DepartmentDiscrepancyPage.php - About 1 day 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 get_dept_view has a Cognitive Complexity of 52 (exceeds 5 allowed). Consider refactoring.
Open

    public function get_dept_view()
    {
        $dbc = $this->connection;
        $dbc->selectDB($this->config->get('OP_DB'));
        $dept_no = FormLib::get('dept_no');
Severity: Minor
Found in fannie/item/DepartmentDiscrepancyPage.php - About 1 day 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_dept_view has 159 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function get_dept_view()
    {
        $dbc = $this->connection;
        $dbc->selectDB($this->config->get('OP_DB'));
        $dept_no = FormLib::get('dept_no');
Severity: Major
Found in fannie/item/DepartmentDiscrepancyPage.php - About 6 hrs to fix

    File DepartmentDiscrepancyPage.php has 414 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    /*******************************************************************************
    
        Copyright 2013 Whole Foods Co-op, Duluth, MN
    
    
    Severity: Minor
    Found in fannie/item/DepartmentDiscrepancyPage.php - About 5 hrs to fix

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

          public function get_view()
          { 
              $dbc = $this->connection;
              $dbc->selectDB($this->config->get('OP_DB'));
              $ret = '';
      Severity: Major
      Found in fannie/item/DepartmentDiscrepancyPage.php - About 3 hrs to fix

        Method getDeptDiscrepancies has 59 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            private function getDeptDiscrepancies($dbc)
            {
                $itemA = array();
                $itemB = array();
        
        
        Severity: Major
        Found in fannie/item/DepartmentDiscrepancyPage.php - About 2 hrs to fix

          Function getDeptDiscrepancies has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
          Open

              private function getDeptDiscrepancies($dbc)
              {
                  $itemA = array();
                  $itemB = array();
          
          
          Severity: Minor
          Found in fannie/item/DepartmentDiscrepancyPage.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 post_dept_update_view has 39 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function post_dept_update_view()
              {
                  $dbc = $this->connection;
                  $dbc->selectDB($this->config->get('OP_DB'));
          
          
          Severity: Minor
          Found in fannie/item/DepartmentDiscrepancyPage.php - About 1 hr to fix

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

                public function post_dept_update_view()
                {
                    $dbc = $this->connection;
                    $dbc->selectDB($this->config->get('OP_DB'));
            
            
            Severity: Minor
            Found in fannie/item/DepartmentDiscrepancyPage.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

            Consider simplifying this complex logical expression.
            Open

                            if ($i>0 && $j>0 || $j>0 && $k>0 || $i>0 && $k>0) {
                                if ($i>0) $min = $i;
                                if ($j>0 && $j<$min) $min = $j;
                                if ($k>0 && $k<$min) $min = $k;
                                if ($min == $i) {
            Severity: Major
            Found in fannie/item/DepartmentDiscrepancyPage.php - About 40 mins to fix

              There are no issues that match your filters.

              Category
              Status