CORE-POS/IS4C

View on GitHub
fannie/item/modules/ProdUserModule.php

Summary

Maintainability
D
3 days
Test Coverage
F
46%

Method showEditForm has 193 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function showEditForm($upc, $display_mode=1, $expand_mode=1)
    {
        $FANNIE_URL = FannieConfig::config('URL');
        $upc = BarcodeLib::padUPC($upc);

Severity: Major
Found in fannie/item/modules/ProdUserModule.php - About 7 hrs to fix

    File ProdUserModule.php has 399 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

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

      Function showEditForm has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
      Open

          public function showEditForm($upc, $display_mode=1, $expand_mode=1)
          {
              $FANNIE_URL = FannieConfig::config('URL');
              $upc = BarcodeLib::padUPC($upc);
      
      
      Severity: Minor
      Found in fannie/item/modules/ProdUserModule.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 SaveFormData has 82 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          function SaveFormData($upc)
          {
              $upc = BarcodeLib::padUPC($upc);
              $brand = FormLib::get('lf_brand');
              $desc = FormLib::get('lf_desc');
      Severity: Major
      Found in fannie/item/modules/ProdUserModule.php - About 3 hrs to fix

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

            function SaveFormData($upc)
            {
                $upc = BarcodeLib::padUPC($upc);
                $brand = FormLib::get('lf_brand');
                $desc = FormLib::get('lf_desc');
        Severity: Minor
        Found in fannie/item/modules/ProdUserModule.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

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

            private function saveLocation($dbc, $upc, $floorIDs, $oldFloorIDs, $floorSubs)
            {
                $insP = $dbc->prepare('INSERT INTO FloorSectionProductMap (floorSectionID, upc) VALUES (?, ?)');
                $upP = $dbc->prepare('UPDATE FloorSectionProductMap SET floorSectionID=? WHERE floorSectionID=? AND upc=?');
                $delP = $dbc->prepare('DELETE FROM FloorSectionProductMap WHERE floorSectionID=? AND upc=?');
        Severity: Minor
        Found in fannie/item/modules/ProdUserModule.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 saveLocation has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            private function saveLocation($dbc, $upc, $floorIDs, $oldFloorIDs, $floorSubs)
        Severity: Minor
        Found in fannie/item/modules/ProdUserModule.php - About 35 mins to fix

          There are no issues that match your filters.

          Category
          Status