CORE-POS/IS4C

View on GitHub

Showing 8,683 of 8,684 total issues

Method weightedAverages has 237 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    private function weightedAverages($dbc)
    {
        // now do weighted averages
        $this->cronMsg('Calculating weighted averages', FannieLogger::INFO);
        $dbc->query('TRUNCATE TABLE productSummaryLastQuarter');
Severity: Major
Found in fannie/cron/tasks/ProductSummarizeLastQuarter.php - About 1 day to fix

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

        static function sortProductsByPhysicalLocation($dbc, $data, $storeID)
        {
    
            $upcs = array();
            foreach ($data as $k => $row) {
    Severity: Major
    Found in fannie/admin/labels/pdf_layouts/FpdfLib.php and 1 other location - About 1 day to fix
    fannie/classlib2.0/item/FannieSignage.php on lines 1259..1307

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

    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

        static function sortProductsByPhysicalLocation($dbc, $data, $storeID)
        {
    
            $upcs = array();
            foreach ($data as $k => $row) {
    Severity: Major
    Found in fannie/classlib2.0/item/FannieSignage.php and 1 other location - About 1 day to fix
    fannie/admin/labels/pdf_layouts/FpdfLib.php on lines 107..156

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

    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

    Function get_id_view has a Cognitive Complexity of 60 (exceeds 5 allowed). Consider refactoring.
    Open

        protected function get_id_view()
        {
            global $FANNIE_OP_DB, $FANNIE_URL;
            $dbc = FannieDB::get($FANNIE_OP_DB);
            $limitedEdit = $this->auth_mode == 'Full' ? False : True;
    Severity: Minor
    Found in fannie/modules/plugins2.0/PIKiller/PIMemberPage.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

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

            foreach ($_GET as $key => $value) {
                if ($value > 0 && substr($key,0,2) === 'id') {
                    $thisUPC = substr($key,2,3);
                    $data[$key][$thisUPC] = $value;
                } elseif ($value === 'LG') {
    fannie/modules/plugins2.0/DeliCateringOrders/DeliCateringOrdersPage.php on lines 210..230

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

    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 ($_GET as $key => $value) {
                if ($value > 0 && substr($key,0,2) === 'id') {
                    $thisUPC = substr($key,2,3);
                    $data[$key][$thisUPC] = $value;
                } elseif ($value === 'LG') {
    fannie/modules/plugins2.0/DeliCateringOrders/DeliCateringOrdersPage.php on lines 1253..1273

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

    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

    File VoidCmd.php has 557 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    /*******************************************************************************
    
        Copyright 2007 Whole Foods Co-op
    
    
    Severity: Major
    Found in pos/is4c-nf/parser/parse/VoidCmd.php - About 1 day to fix

      Method javascript_content has 234 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

         public function javascript_content()
         {
          return <<<JAVASCRIPT
      var lastChecked = null;
      var i = 0;
      Severity: Major
      Found in fannie/item/ProdReviewPage.php - About 1 day to fix

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

            if ( isset($_REQUEST['other_dates']) ) {
                switch ($_REQUEST['other_dates']) {
                    case 'today':
                        $d1 = date("Y-m-d");
                        $d2 = $d1;
        fannie/reports/Store-Specific/WEFC_Toronto/GeneralCosts/index.php on lines 58..85

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

        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

            if ( isset($_REQUEST['other_dates']) ) {
                switch ($_REQUEST['other_dates']) {
                    case 'today':
                        $d1 = date("Y-m-d");
                        $d2 = $d1;
        fannie/reports/Store-Specific/WEFC_Toronto/OntarioTaxes/index.php on lines 45..72

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

        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

        Method fetch_report_data has 233 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            function fetch_report_data(){
                global $FANNIE_OP_DB, $FANNIE_COOP_ID;
                $d1 = $this->form->date1;
                $d2 = $this->form->date2;
                $dept = FormLib::get_form_value('dept',0);
        Severity: Major
        Found in fannie/reports/StoreSummary/StoreSummaryReportAlt.php - About 1 day to fix

          Method fetch_report_data has 233 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              function fetch_report_data()
              {
                  global $FANNIE_OP_DB, $FANNIE_ARCHIVE_DB, $FANNIE_EQUITY_DEPARTMENTS,
                      $FANNIE_COOP_ID;
                  $dbc = $this->connection;
          Severity: Major
          Found in fannie/reports/GeneralDay/GeneralDayReport.php - About 1 day to fix

            File PIMemberPage.php has 555 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            <?php 
            /*******************************************************************************
            
                Copyright 2013 Whole Foods Co-op
            
            
            Severity: Major
            Found in fannie/modules/plugins2.0/PIKiller/PIMemberPage.php - About 1 day to fix

              Method renderAsPDF has 233 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function renderAsPDF($pdf, $start_y)
                  {
                      $top_left_x = 6.35;
                      $top_left_y = $start_y;
                      $line_height = 5;
              Severity: Major
              Found in fannie/modules/plugins2.0/GiveUsMoneyPlugin/GumTaxFormTemplate.php - About 1 day to fix

                Function di has a Cognitive Complexity of 59 (exceeds 5 allowed). Consider refactoring.
                Open

                var di = (function ($) {
                    var mod = {};
                
                    var openInput = false;
                    var openVendor = false;
                Severity: Minor
                Found in fannie/modules/plugins2.0/DeliInventory/di.js - 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

                Function get has a Cognitive Complexity of 59 (exceeds 5 allowed). Consider refactoring.
                Open

                static public function get($session){
                    global $CORE_LOCAL;
                
                    /* First, check for anything still in
                     * . localtemptrans

                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 displayUI has a Cognitive Complexity of 59 (exceeds 5 allowed). Consider refactoring.
                Open

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

                Function run has a Cognitive Complexity of 59 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function run()
                    {
                        global $FANNIE_LANES;
                        global $FANNIE_PLUGIN_LIST;
                        global $FANNIE_PLUGIN_SETTINGS;

                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 pushTable has a Cognitive Complexity of 59 (exceeds 5 allowed). Consider refactoring.
                Open

                    static public function pushTable($table,$db='op',
                        $truncate=self::TRUNCATE_DESTINATION,$one_lane=0)
                    {
                        global $FANNIE_OP_DB, $FANNIE_TRANS_DB, $FANNIE_LANES;
                        /* Only if needed.
                Severity: Minor
                Found in fannie/modules/plugins2.0/CoopCred/sync/SyncLanesForPlugin.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

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

                        foreach ($batchNames as $k => $bName) {
                            $bidQ = $dbc->prepare("
                                SELECT batchID
                                FROM batches
                                WHERE batchName=?
                Severity: Major
                Found in fannie/batches/UNFI/VPBPV.php and 2 other locations - About 1 day to fix
                fannie/batches/UNFI/VPBPIII.php on lines 594..625
                fannie/batches/UNFI/VPBPIV.php on lines 681..712

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

                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

                Severity
                Category
                Status
                Source
                Language