CORE-POS/IS4C

View on GitHub
fannie/modules/plugins2.0/OverShortTools/OverShortSafecountV3.php

Summary

Maintainability
F
6 days
Test Coverage

Method displayUI has 303 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    function displayUI($dateStr, $store, $type){
        global $FANNIE_PLUGIN_SETTINGS;
        $dbc = FannieDB::get($FANNIE_PLUGIN_SETTINGS['OverShortDatabase']);

        $startDate = $dateStr;
Severity: Major
Found in fannie/modules/plugins2.0/OverShortTools/OverShortSafecountV3.php - About 1 day to fix

    Function displayUI has a Cognitive Complexity of 65 (exceeds 5 allowed). Consider refactoring.
    Open

        function displayUI($dateStr, $store, $type){
            global $FANNIE_PLUGIN_SETTINGS;
            $dbc = FannieDB::get($FANNIE_PLUGIN_SETTINGS['OverShortDatabase']);
    
            $startDate = $dateStr;
    Severity: Minor
    Found in fannie/modules/plugins2.0/OverShortTools/OverShortSafecountV3.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

    File OverShortSafecountV3.php has 498 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    /*******************************************************************************
    
        Copyright 2013 Whole Foods Co-op
    
    
    Severity: Minor
    Found in fannie/modules/plugins2.0/OverShortTools/OverShortSafecountV3.php - About 7 hrs to fix

      Method body_content has 65 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          function body_content(){
              global $FANNIE_URL, $FANNIE_PLUGIN_SETTINGS;
              $dbc = FannieDB::get($FANNIE_PLUGIN_SETTINGS['OverShortDatabase']);
              $this->addScript('js/countV3.js?date=20220927');
              $this->addScript($FANNIE_URL.'src/javascript/jquery.js');
      Severity: Major
      Found in fannie/modules/plugins2.0/OverShortTools/OverShortSafecountV3.php - About 2 hrs to fix

        Method save has 10 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            function save($dateStr,$store,$type,$changeOrder,$openSafeCount,$buyAmount,$atmAmount,$atmAmount2,$tillCount,$notes){
        Severity: Major
        Found in fannie/modules/plugins2.0/OverShortTools/OverShortSafecountV3.php - About 1 hr to fix

          Method saveInputs has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              function saveInputs($dateStr,$store,$type,$row,$data){
          Severity: Minor
          Found in fannie/modules/plugins2.0/OverShortTools/OverShortSafecountV3.php - About 35 mins to fix

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

                function saveTillCounts($dateStr, $store, $type, $data)
                {
                    global $FANNIE_PLUGIN_SETTINGS;
                    $dbc = FannieDB::get($FANNIE_PLUGIN_SETTINGS['OverShortDatabase']);
            
            
            Severity: Minor
            Found in fannie/modules/plugins2.0/OverShortTools/OverShortSafecountV3.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

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

                function saveInputs($dateStr,$store,$type,$row,$data){
                    global $FANNIE_PLUGIN_SETTINGS;
                    $dbc = FannieDB::get($FANNIE_PLUGIN_SETTINGS['OverShortDatabase']);
            
                    $model = new DailyDepositModel($dbc);
            Severity: Minor
            Found in fannie/modules/plugins2.0/OverShortTools/OverShortSafecountV3.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

            Similar blocks of code found in 3 locations. Consider refactoring.
            Open

                function body_content(){
                    global $FANNIE_URL, $FANNIE_PLUGIN_SETTINGS;
                    $dbc = FannieDB::get($FANNIE_PLUGIN_SETTINGS['OverShortDatabase']);
                    $this->addScript('js/countV3.js?date=20220927');
                    $this->addScript($FANNIE_URL.'src/javascript/jquery.js');
            fannie/modules/plugins2.0/OverShortTools/OverShortSafecountPage.php on lines 528..590
            fannie/modules/plugins2.0/OverShortTools/OverShortSafecountV2.php on lines 465..527

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 210.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Identical blocks of code found in 3 locations. Consider refactoring.
            Open

                    while($row = $dbc->fetch_row($posR)){
                        $d = $row[0]."-".str_pad($row[1],2,'0',STR_PAD_LEFT)."-".str_pad($row[2],2,'0',STR_PAD_LEFT);
                        if (!isset($dailies[$d])) $dailies[$d] = array(0,0);
                        $dailies[$d][1] = $row[3];
                    }
            fannie/modules/plugins2.0/OverShortTools/OverShortSafecountPage.php on lines 470..474
            fannie/modules/plugins2.0/OverShortTools/OverShortSafecountV2.php on lines 342..346

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 137.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Identical blocks of code found in 3 locations. Consider refactoring.
            Open

                    foreach($dailies as $k=>$v){
                        if ($num % 2 == 0){
                            if ($num != 0) $ret .= "</tr>";
                            if ($num % 4 == 0) $ret .= "<tr>";
                            else $ret .= "<tr class=\"color\">";
            fannie/modules/plugins2.0/OverShortTools/OverShortSafecountPage.php on lines 476..486
            fannie/modules/plugins2.0/OverShortTools/OverShortSafecountV2.php on lines 348..358

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 118.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Identical blocks of code found in 2 locations. Consider refactoring.
            Open

                    foreach($temp as $t){
                        $temp2 = explode(':',$t);
                        if (count($temp2) < 2) continue;
                        $rowID = $temp2[0];
                        $amt = $temp2[1];
            fannie/modules/plugins2.0/OverShortTools/OverShortSafecountV2.php on lines 120..132

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 105.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Identical blocks of code found in 3 locations. Consider refactoring.
            Open

                    if ($store == 1) {
                        $pars = array("0.01"=>60,"0.05"=>120,"0.10"=>320,"0.25"=>1200,"1.00"=>2600,"5.00"=>1000,"10.00"=>1300);
                    } else {
                        $pars = array("0.01"=>35,"0.05"=>80,"0.10"=>250,"0.25"=>800,"1.00"=>1755,"5.00"=>750,"10.00"=>830);
                    }
            fannie/modules/plugins2.0/OverShortTools/OverShortSafecountPage.php on lines 266..270
            fannie/modules/plugins2.0/OverShortTools/OverShortSafecountV2.php on lines 263..267

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 98.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Identical blocks of code found in 2 locations. Consider refactoring.
            Open

                    foreach($denoms as $d){ 
                        if ($d == 'Checks' || $d == "100.00" || $d == "50.00" || $d == "Junk") 
                            $ret .= "<td>&nbsp;</td>";
                        else{
                            $ret .= "<td><input size=4 type=text id=\"changeOrder$d\" value=".$holding['changeOrder'][$d];
            fannie/modules/plugins2.0/OverShortTools/OverShortSafecountV2.php on lines 201..209

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 98.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            There are no issues that match your filters.

            Category
            Status