CORE-POS/IS4C

View on GitHub
fannie/reports/Store-Specific/WFC/EOM-Nabs/anydate.php

Summary

Maintainability
F
6 days
Test Coverage

Function tablify has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring.
Open

function tablify($data,$col_order,$col_headers,$formatting,$sums=-1,$sum_cols=array()){
    $sum = 0;
    $ret = "";
    
    $ret .= "<table cellspacing=0 cellpadding=4 border=1><tr>";
Severity: Minor
Found in fannie/reports/Store-Specific/WFC/EOM-Nabs/anydate.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 anydate.php has 264 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
use COREPOS\Fannie\API\item\StandardAccounting;
if (basename(__FILE__) != basename($_SERVER['PHP_SELF'])) {
    return;
}
Severity: Minor
Found in fannie/reports/Store-Specific/WFC/EOM-Nabs/anydate.php - About 2 hrs to fix

    Method tablify has 51 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function tablify($data,$col_order,$col_headers,$formatting,$sums=-1,$sum_cols=array()){
        $sum = 0;
        $ret = "";
        
        $ret .= "<table cellspacing=0 cellpadding=4 border=1><tr>";
    Severity: Major
    Found in fannie/reports/Store-Specific/WFC/EOM-Nabs/anydate.php - About 2 hrs to fix

      Method tablify has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      function tablify($data,$col_order,$col_headers,$formatting,$sums=-1,$sum_cols=array()){
      Severity: Minor
      Found in fannie/reports/Store-Specific/WFC/EOM-Nabs/anydate.php - About 45 mins to fix

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

        function tablify($data,$col_order,$col_headers,$formatting,$sums=-1,$sum_cols=array()){
            $sum = 0;
            $ret = "";
            
            $ret .= "<table cellspacing=0 cellpadding=4 border=1><tr>";
        Severity: Major
        Found in fannie/reports/Store-Specific/WFC/EOM-Nabs/anydate.php and 1 other location - About 2 days to fix
        fannie/reports/Store-Specific/WFC/EOM-Nabs/index.php on lines 248..307

        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 522.

        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 ($accounts as $account){
                echo "<br /><b>Total for $account</b>";
                $totalR = $dbc->execute($totalQ,array($account,$span[0],$span[1],$store));
                $data = array();
                while ($totalW=$dbc->fetch_row($totalR)){
        Severity: Major
        Found in fannie/reports/Store-Specific/WFC/EOM-Nabs/anydate.php and 1 other location - About 1 day to fix
        fannie/reports/Store-Specific/WFC/EOM-Nabs/index.php on lines 220..239

        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 325.

        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

        function cellify($data,$formatting){
            $ALIGN_RIGHT = 1;
            $ALIGN_LEFT = 2;
            $ALIGN_CENTER = 4;
            $TYPE_MONEY = 8;
        Severity: Major
        Found in fannie/reports/Store-Specific/WFC/EOM-Nabs/anydate.php and 1 other location - About 2 hrs to fix
        fannie/reports/Store-Specific/WFC/EOM-Nabs/index.php on lines 309..325

        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 139.

        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

            while ($totalW=$dbc->fetch_row($totalR)){
                if (!isset($data["$totalW[0]"])){
                    $data["$totalW[0]"] = array($totalW[1],$totalW[2]);
                }
                else {
        Severity: Major
        Found in fannie/reports/Store-Specific/WFC/EOM-Nabs/anydate.php and 1 other location - About 1 hr to fix
        fannie/reports/Store-Specific/WFC/EOM-Nabs/index.php on lines 127..135

        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

            while ($totalW=$dbc->fetch_row($totalR)){
                $code = StandardAccounting::extend($totalW['salesCode'], $totalW['store_id']);
                if (empty($data[$code])){
                    $data[$code] = array($totalW[1],$totalW[2]);
                }
        Severity: Major
        Found in fannie/reports/Store-Specific/WFC/EOM-Nabs/anydate.php and 1 other location - About 1 hr to fix
        fannie/reports/Store-Specific/WFC/EOM-Nabs/index.php on lines 157..166

        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 117.

        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 5 locations. Consider refactoring.
        Open

        if ($store === false) {
            $clientIP = filter_input(INPUT_SERVER, 'REMOTE_ADDR');
            foreach ($FANNIE_STORE_NETS as $storeID => $range) {
                if (
                    class_exists('\\Symfony\\Component\\HttpFoundation\\IpUtils')
        Severity: Major
        Found in fannie/reports/Store-Specific/WFC/EOM-Nabs/anydate.php and 4 other locations - About 35 mins to fix
        fannie/reports/Store-Specific/WFC/DailyReport/index.php on lines 64..77
        fannie/reports/Store-Specific/WFC/EOM-Nabs/index.php on lines 29..42
        fannie/reports/Store-Specific/WFC/EOMreport/index.php on lines 27..40
        fannie/reports/Store-Specific/WFC/EOMreport/taxonly.php on lines 27..40

        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 92.

        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