CORE-POS/IS4C

View on GitHub

Showing 8,683 of 8,684 total issues

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

    if ($item['organicLocal']) {
        $pdf->Image(__DIR__ . '/noauto/og-loc.png', $x-2, $y, 80, 15);
        $rgb = array(151,201,61);
    } elseif ($item['organic']) {
        $pdf->Image(__DIR__ . '/noauto/og.png', $x-2, $y, 80, 15);
Severity: Major
Found in fannie/admin/labels/pdf_layouts/WFC_Produce_SmartSigns.php and 1 other location - About 6 hrs to fix
fannie/admin/labels/pdf_layouts/WFC_New_Produce_Mockup.php on lines 274..286

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

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

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

    Copyright 2013 Whole Foods Co-op

Severity: Minor
Found in fannie/cron/management/CronManagementPage.php - About 6 hrs to fix

    Method handle has 159 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function handle($upc,$json)
        {
            list($manId, $fam, $val, $manIdStart) = $this->upcToParts($upc);
    
            $valueInfo = $this->getValue($val);
    Severity: Major
    Found in pos/is4c-nf/lib/Scanning/SpecialUPCs/CouponCode.php - About 6 hrs to fix

      Method javascriptContent has 159 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function javascriptContent()
          {
              $dbc = $this->connection;
              $json = array();
              $prep = $dbc->prepare("SELECT * FROM NutriFactStd");
      Severity: Major
      Found in fannie/item/images/NutriFactEntry.php - About 6 hrs to fix

        Method get_dept_view has 159 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function get_dept_view()
            {
                $dbc = $this->connection;
                $dbc->selectDB($this->config->get('OP_DB'));
                $dept_no = FormLib::get('dept_no');
        Severity: Major
        Found in fannie/item/DepartmentDiscrepancyPage.php - About 6 hrs to fix

          ReceiptLib has 46 functions (exceeds 20 allowed). Consider refactoring.
          Open

          class ReceiptLib 
          {
              static private $PRINT;
          
              static private $EMAIL = 'COREPOS\\pos\\lib\\PrintHandlers\EmailPrintHandler';
          Severity: Minor
          Found in pos/is4c-nf/lib/ReceiptLib.php - About 6 hrs to fix

            Class JsonTextWriter has 46 methods (exceeds 20 allowed). Consider refactoring.
            Open

                public class JsonTextWriter : JsonWriter
                {
                    private readonly TextWriter _writer;
                    private Base64Encoder _base64Encoder;
                    private char _indentChar;

              Method process_file has 158 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  function process_file($linedata, $indexes)
                  {
                      global $FANNIE_OP_DB;
                      $dbc = FannieDB::get($FANNIE_OP_DB);
                      $VENDOR_ID = $this->getVendorID();
              Severity: Major
              Found in fannie/batches/UNFI/load-classes/UnfiUploadPage.php - About 6 hrs to fix

                File BatchFromSearch.php has 430 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                <?php
                /*******************************************************************************
                
                    Copyright 2013 Whole Foods Community Co-op
                
                
                Severity: Minor
                Found in fannie/batches/BatchFromSearch.php - About 6 hrs to fix

                  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

                  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/countV2.js?date=20210712');
                          $this->addScript($FANNIE_URL.'src/javascript/jquery.js');
                  fannie/modules/plugins2.0/OverShortTools/OverShortSafecountPage.php on lines 528..590
                  fannie/modules/plugins2.0/OverShortTools/OverShortSafecountV3.php on lines 500..569

                  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

                  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/count.js?date=20200622');
                          $this->addScript($FANNIE_URL.'src/javascript/jquery.js');
                  fannie/modules/plugins2.0/OverShortTools/OverShortSafecountV2.php on lines 465..527
                  fannie/modules/plugins2.0/OverShortTools/OverShortSafecountV3.php on lines 500..569

                  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

                  File MemberSummaryModel.php has 429 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  <?php
                  /*******************************************************************************
                  
                      Copyright 2015 Whole Foods Co-op
                  
                  
                  Severity: Minor
                  Found in fannie/modules/plugins2.0/CoreWarehouse/models/MemberSummaryModel.php - About 6 hrs to fix

                    Function productList has 157 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    var productList = (function($) {
                        var mod = {};
                    
                        var drawCheckbox = function(elem, cell, field) {
                            var fs = elem.find('.' + cell + ':first').html();
                    Severity: Major
                    Found in fannie/item/productList.js - About 6 hrs to fix

                      Method check has 157 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          function check($str)
                          {
                              if ($str == "TERMMANUAL") {
                                  UdpComm::udpSend("termManual");
                                  $this->session->set("paycard_keyed", true);
                      Severity: Major
                      Found in pos/is4c-nf/parser/parse/SigTermCommands.php - About 6 hrs to fix

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

                            protected function get_new_view()
                            {
                                $settings = $this->config->get('PLUGIN_SETTINGS');
                                $prefix = $settings['IncidentDB'] . $this->connection->sep();
                        
                        
                        Severity: Major
                        Found in fannie/modules/plugins2.0/IncidentTracker/AlertIncident.php and 1 other location - About 6 hrs to fix
                        fannie/modules/plugins2.0/IncidentTracker/PosIncident.php on lines 173..245

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

                        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

                            protected function get_new_view()
                            {
                                $settings = $this->config->get('PLUGIN_SETTINGS');
                                $prefix = $settings['IncidentDB'] . $this->connection->sep();
                        
                        
                        Severity: Major
                        Found in fannie/modules/plugins2.0/IncidentTracker/PosIncident.php and 1 other location - About 6 hrs to fix
                        fannie/modules/plugins2.0/IncidentTracker/AlertIncident.php on lines 650..761

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

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

                            public function checkQualifications($coupID, $quiet=false)
                            {
                                $infoW = $this->lookupCoupon($coupID);
                                if ($infoW === false) {
                                    return $this->errorOrQuiet(_("coupon not found"), $quiet);
                        Severity: Minor
                        Found in pos/is4c-nf/lib/Scanning/SpecialUPCs/HouseCoupon.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

                        Function getBatchHistory has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring.
                        Open

                            public function getBatchHistory($bid)
                            {
                                global $FANNIE_OP_DB;
                                $dbc = FannieDB::get($FANNIE_OP_DB);
                        
                        
                        Severity: Minor
                        Found in fannie/batches/batchhistory/BatchHistoryPage.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

                        Function fetch_report_data has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring.
                        Open

                            function fetch_report_data()
                            {
                                $dbc = $this->connection;
                                $dbc->selectDB($this->config->get('OP_DB'));
                                $date1 = $this->form->date1;
                        Severity: Minor
                        Found in fannie/reports/DepartmentMovement/DepartmentMovementReport.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

                        Severity
                        Category
                        Status
                        Source
                        Language