CORE-POS/IS4C

View on GitHub

Showing 8,295 of 8,296 total issues

Function rpOrder has a Cognitive Complexity of 180 (exceeds 5 allowed). Consider refactoring.
Open

var rpOrder = (function ($) {

    var mod = {};
    var state = {
        'retention': 60,
Severity: Minor
Found in fannie/modules/plugins2.0/RP/rpDirect.js - About 3 days 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 SPH_SignAndPay_USB.cs has 1347 lines of code (exceeds 250 allowed). Consider refactoring.
Open

using System;
using System.IO;
using System.IO.Ports;
using System.Threading;
using CustomForms;
Severity: Major
Found in pos/is4c-nf/scale-drivers/drivers/NewMagellan/SPH_SignAndPay_USB.cs - About 3 days to fix

    File JsonTextReader.cs has 1344 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    using System;
    using System.Collections.Generic;
    using System.Diagnostics;
    using System.Runtime.CompilerServices;
    using System.Text;

      File DeliCateringOrdersPageBackup0627.php has 1326 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      COPY OF DELICATERINGORDERSPAGE.PHP
      
      <?php 
      /*******************************************************************************
      
      

        File ProdReviewPage.php has 1304 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        <?php
        /*******************************************************************************
        
            Copyright 2017 Whole Foods Community Co-op
        
        
        Severity: Major
        Found in fannie/item/ProdReviewPage.php - About 3 days to fix

          File ViewPurchaseOrders.php has 1298 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          <?php
          /*******************************************************************************
          
              Copyright 2013 Whole Foods Co-op
          
          
          Severity: Major
          Found in fannie/purchasing/ViewPurchaseOrders.php - About 3 days to fix

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

                    while($row = $db->fetchRow($result)){
                        $trantype = $row['tranType'];  
                        if ($row['amount'] < 0) {
                            $amt = "-$".number_format(-1*$row['amount'],2);
                        } else {
            Severity: Major
            Found in pos/is4c-nf/plugins/CoopCred/receiptMessages/CCredSigSlip.php and 1 other location - About 3 days to fix
            pos/is4c-nf/plugins/CoopCred/receiptMessages/CCredUsedBalances.php on lines 236..293

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

            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

                    while($row = $db->fetchRow($result)){
                        $trantype = $row['tranType'];  
                        if ($row['amount'] < 0) {
                            $amt = "-$".number_format(-1*$row['amount'],2);
                        } else {
            pos/is4c-nf/plugins/CoopCred/receiptMessages/CCredSigSlip.php on lines 207..265

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

            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 displayUI has a Cognitive Complexity of 165 (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/OverShortSafecountPage.php - About 3 days 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 OrderViewPage.php has 1265 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            <?php
            /*******************************************************************************
            
                Copyright 2010 Whole Foods Co-op
            
            
            Severity: Major
            Found in fannie/ordering/OrderViewPage.php - About 3 days to fix

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

              function edititem(id){
                  if (in_queue(id)) return;
                  else queue_add(id);
              
                  var item = document.getElementById('item'+id+'col0').innerHTML;
              Severity: Major
              Found in fannie/modules/plugins2.0/DeliInventory/index.js and 1 other location - About 3 days to fix
              fannie/modules/plugins2.0/DeliInventory/index3.js on lines 31..54

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

              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 edititem(id){
                  if (in_queue(id)) return;
                  else queue_add(id);
              
                  var item = document.getElementById('item'+id+'col0').innerHTML;
              Severity: Major
              Found in fannie/modules/plugins2.0/DeliInventory/index3.js and 1 other location - About 3 days to fix
              fannie/modules/plugins2.0/DeliInventory/index.js on lines 31..54

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

              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 DeliCateringOrdersPage.php has 1245 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              <?php 
              /*******************************************************************************
              
                  Copyright 2013 Whole Foods Co-op
              
              

                File ajax-calls.php has 1211 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                <?php
                /*******************************************************************************
                
                    Copyright 2010 Whole Foods Co-op
                
                
                Severity: Major
                Found in fannie/ordering/ajax-calls.php - About 3 days to fix

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

                          if (strlen($respXML) > 0 && $resp !== false) {
                              $elapsed = microtime(true) - $startTime;
                              $pcRow[] = date('Y-m-d H:i:s');
                              $pcRow[] = $elapsed;
                              $pcRow[] = 0;
                  Severity: Major
                  Found in fannie/modules/plugins2.0/PaycardFix/PaycardFixVoid.php and 2 other locations - About 3 days to fix
                  fannie/modules/plugins2.0/PaycardFix/PaycardFixReturn.php on lines 200..246
                  fannie/modules/plugins2.0/PaycardFix/PaycardFixSale.php on lines 200..246

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

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

                          if (strlen($respXML) > 0 && $resp !== false) {
                              $elapsed = microtime(true) - $startTime;
                              $pcRow[] = date('Y-m-d H:i:s');
                              $pcRow[] = $elapsed;
                              $pcRow[] = 0;
                  Severity: Major
                  Found in fannie/modules/plugins2.0/PaycardFix/PaycardFixReturn.php and 2 other locations - About 3 days to fix
                  fannie/modules/plugins2.0/PaycardFix/PaycardFixSale.php on lines 200..246
                  fannie/modules/plugins2.0/PaycardFix/PaycardFixVoid.php on lines 190..236

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

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

                          if (strlen($respXML) > 0 && $resp !== false) {
                              $elapsed = microtime(true) - $startTime;
                              $pcRow[] = date('Y-m-d H:i:s');
                              $pcRow[] = $elapsed;
                              $pcRow[] = 0;
                  Severity: Major
                  Found in fannie/modules/plugins2.0/PaycardFix/PaycardFixSale.php and 2 other locations - About 3 days to fix
                  fannie/modules/plugins2.0/PaycardFix/PaycardFixReturn.php on lines 200..246
                  fannie/modules/plugins2.0/PaycardFix/PaycardFixVoid.php on lines 190..236

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

                  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 BaseItemModule.php has 1175 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  <?php
                  /*******************************************************************************
                  
                      Copyright 2013 Whole Foods Co-op, Duluth, MN
                  
                  
                  Severity: Major
                  Found in fannie/item/modules/BaseItemModule.php - About 3 days to fix

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

                        protected function post_view()
                        {
                            $items = array();
                            foreach (explode("\n", $this->form->in) as $line) {
                                if (preg_match('/(\d+)\](.)\[(.+){(.+)}(.+)\|(.+)_/', $line, $matches)) {
                    Severity: Major
                    Found in fannie/modules/plugins2.0/RP/RpImportCsv.php and 1 other location - About 2 days to fix
                    fannie/modules/plugins2.0/RP/RpImport.php on lines 281..350

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

                    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

                        protected function post_view()
                        {
                            $items = array();
                            foreach (explode("\n", $this->form->in) as $line) {
                                if (preg_match('/(\d+)\](.)\[(.+){(.+)}(.+)\|(.+)_/', $line, $matches)) {
                    Severity: Major
                    Found in fannie/modules/plugins2.0/RP/RpImport.php and 1 other location - About 2 days to fix
                    fannie/modules/plugins2.0/RP/RpImportCsv.php on lines 284..353

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

                    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