CORE-POS/IS4C

View on GitHub
fannie/ordering/clearinghouse.php

Summary

Maintainability
C
1 day
Test Coverage
F
0%

File clearinghouse.php has 365 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/*******************************************************************************

    Copyright 2010 Whole Foods Co-op

Severity: Minor
Found in fannie/ordering/clearinghouse.php - About 4 hrs to fix

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

    while($itemsW = $dbc->fetch_row($itemsR)){
        if (!isset($items[$itemsW['order_id']]))
            $items[$itemsW['order_id']] = $itemsW['description'];
        else
            $items[$itemsW['order_id']] .= "; ".$itemsW['description'];
    Severity: Major
    Found in fannie/ordering/clearinghouse.php and 1 other location - About 3 hrs to fix
    fannie/ordering/historical.php on lines 272..285

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

    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

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

    foreach($suppliers as $id=>$desc){
        if (strlen($desc) <= $lenLimit) continue;
    
        $min = substr($desc,0,$lenLimit);
        $rest = substr($desc,$lenLimit);
    Severity: Major
    Found in fannie/ordering/clearinghouse.php and 3 other locations - About 55 mins to fix
    fannie/ordering/clearinghouse.php on lines 288..298
    fannie/ordering/historical.php on lines 287..297
    fannie/ordering/historical.php on lines 299..309

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

    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

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

    foreach($items as $id=>$desc){
        if (strlen($desc) <= $lenLimit) continue;
    
        $min = substr($desc,0,$lenLimit);
        $rest = substr($desc,$lenLimit);
    Severity: Major
    Found in fannie/ordering/clearinghouse.php and 3 other locations - About 55 mins to fix
    fannie/ordering/clearinghouse.php on lines 300..310
    fannie/ordering/historical.php on lines 287..297
    fannie/ordering/historical.php on lines 299..309

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

    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

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

    if (isset($_REQUEST['card_no'])){
        printf('(<a href="clearinghouse.php?f1=%s&f2=%s&f3=%s&order=%s">Back to All Owners</a>)<br />',
            (isset($_REQUEST['f1'])?$_REQUEST['f1']:''),    
            (isset($_REQUEST['f2'])?$_REQUEST['f2']:''),    
            (isset($_REQUEST['f3'])?$_REQUEST['f3']:''),    
    Severity: Minor
    Found in fannie/ordering/clearinghouse.php and 1 other location - About 50 mins to fix
    fannie/ordering/historical.php on lines 73..80

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

    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

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

    if (file_exists("{$cachepath}{$username}.prints"))
        $prints = unserialize(file_get_contents("{$cachepath}{$username}.prints"));
    else {
        $fp = fopen("{$cachepath}{$username}.prints",'w');
        fwrite($fp,serialize($prints));
    Severity: Major
    Found in fannie/ordering/clearinghouse.php and 3 other locations - About 45 mins to fix
    fannie/ordering/NewSpecialOrdersPage.php on lines 55..61
    fannie/ordering/OrderViewPage.php on lines 568..574
    fannie/ordering/ajax-calls.php on lines 893..899

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

    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