CORE-POS/IS4C

View on GitHub
fannie/modules/plugins2.0/CoopCred/membership/CoopCredMember.php

Summary

Maintainability
F
4 days
Test Coverage

Method ShowEditForm has 299 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    function ShowEditForm($memNum,$country="US",$inProgramID=-1)
    {
        global $FANNIE_URL;
        global $FANNIE_PLUGIN_LIST,$FANNIE_PLUGIN_SETTINGS;

Severity: Major
Found in fannie/modules/plugins2.0/CoopCred/membership/CoopCredMember.php - About 1 day to fix

    Function ShowEditForm has a Cognitive Complexity of 47 (exceeds 5 allowed). Consider refactoring.
    Open

        function ShowEditForm($memNum,$country="US",$inProgramID=-1)
        {
            global $FANNIE_URL;
            global $FANNIE_PLUGIN_LIST,$FANNIE_PLUGIN_SETTINGS;
    
    
    Severity: Minor
    Found in fannie/modules/plugins2.0/CoopCred/membership/CoopCredMember.php - About 7 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 saveFormData has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring.
    Open

        public function saveFormData($memNum, $json=array())
        {
            //$dbc = $this->db();
            global $FANNIE_URL;
            global $FANNIE_PLUGIN_LIST,$FANNIE_PLUGIN_SETTINGS;
    Severity: Minor
    Found in fannie/modules/plugins2.0/CoopCred/membership/CoopCredMember.php - About 6 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

    File CoopCredMember.php has 425 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    /*******************************************************************************
    
        Copyright 2010 Whole Foods Co-op, Duluth, MN
        Copyright 2014 West End Food Co-op, Toronto, Canada
    Severity: Minor
    Found in fannie/modules/plugins2.0/CoopCred/membership/CoopCredMember.php - About 6 hrs to fix

      Method saveFormData has 78 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function saveFormData($memNum, $json=array())
          {
              //$dbc = $this->db();
              global $FANNIE_URL;
              global $FANNIE_PLUGIN_LIST,$FANNIE_PLUGIN_SETTINGS;
      Severity: Major
      Found in fannie/modules/plugins2.0/CoopCred/membership/CoopCredMember.php - About 3 hrs to fix

        Avoid too many return statements within this method.
        Open

                return '';
        Severity: Major
        Found in fannie/modules/plugins2.0/CoopCred/membership/CoopCredMember.php - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                                  return 'Error: Problem adding Coop Cred membership data to lane.<br />';
          Severity: Major
          Found in fannie/modules/plugins2.0/CoopCred/membership/CoopCredMember.php - About 30 mins to fix

            There are no issues that match your filters.

            Category
            Status