CORE-POS/IS4C

View on GitHub

Showing 8,683 of 8,684 total issues

Method get_id_handler has 163 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    protected function get_id_handler()
    {
        if (!class_exists('GumCheckTemplate')) {
            echo 'Missing check template; enable plugin!';
            return false;
Severity: Major
Found in fannie/modules/plugins2.0/PIKiller/PITermCheck.php - About 6 hrs to fix

    Class JsonTextReader has 47 methods (exceeds 20 allowed). Consider refactoring.
    Open

        public class JsonTextReader : JsonReader, IJsonLineInfo
        {
            private const char UnicodeReplacementChar = '\uFFFD';
            private const int MaximumJavascriptIntegerCharacterLength = 380;
    
    

      Method get_view has 162 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          protected function get_view()
          {
              $this->addScript($this->config->get('URL') . 'src/javascript/Chart.min.js');
              $this->addScript('cwDash.js');
              $settings = $this->config->get('PLUGIN_SETTINGS');
      Severity: Major
      Found in fannie/modules/plugins2.0/CoreWarehouse/CwDashboard.php - About 6 hrs to fix

        Method preprocess has 162 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function preprocess()
            {
                $this->display_function = 'listHouseCoupons';
        
                $msgs = array();
        Severity: Major
        Found in fannie/modules/plugins2.0/HouseCoupon/HouseCouponEditor.php - About 6 hrs to fix

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

          <?php
          /*******************************************************************************
          
              Copyright 2014 Whole Foods Co-op
              Copyright 2014 West End Food Co-op, Toronto
          fannie/modules/plugins2.0/CoopCred/models/CCredHistoryModel.php on lines 1..52

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

          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

          <?php
          /*******************************************************************************
          
              Copyright 2014 Whole Foods Co-op
              Copyright 2014 West End Food Co-op, Toronto
          fannie/modules/plugins2.0/CoopCred/models/CCredHistoryBackupModel.php on lines 1..52

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

          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 javascript_content has 161 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function javascript_content()
              {
                  return <<<JAVASCRIPT
          var uniqTable = document.getElementById('uniq-table');
          var currentRow = 2;
          Severity: Major
          Found in fannie/batches/UNFI/VPBPV.php - About 6 hrs to fix

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

                public function javascript_content()
                {
                    return <<<JAVASCRIPT
            var uniqTable = document.getElementById('uniq-table');
            var currentRow = 2;
            Severity: Major
            Found in fannie/batches/UNFI/VPBPIV.php - About 6 hrs to fix

              Method post_u_view has 161 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  function post_u_view()
                  {
                      global $FANNIE_OP_DB, $FANNIE_URL;
                      $this->addScript('from-search.js');
              
              
              Severity: Major
              Found in fannie/batches/BatchFromSearch.php - About 6 hrs to fix

                File StatementsPluginEmail.php has 435 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                <?php
                
                use COREPOS\Fannie\API\data\pipes\OutgoingEmail;
                
                include_once(dirname(__FILE__) . '/../../../config.php');
                Severity: Minor
                Found in fannie/modules/plugins2.0/StatementsPlugin/StatementsPluginEmail.php - About 6 hrs to fix

                  Method fetchReportData has 161 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function fetchReportData($report_class_name, \FannieConfig $config, \SQLManager $connection)
                      {
                          $date1 = \FormLib::get_form_value('date1',date('Y-m-d'));
                          if ($date1 == date('Y-m-d')) {
                              // warehouse cannot handle current day requests

                    Function getItemData has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring.
                    Open

                        private function getItemData($arr)
                        {
                            $ret = '';
                            /**
                              Convert balance to a more useful format.
                    Severity: Minor
                    Found in pos/is4c-nf/plugins/Paycards/gui/PaycardEmvWic.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 check has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring.
                    Open

                        function check($str)
                        {
                            $myUrl = MiscLib::baseURL();
                            
                            $this->ret = $this->default_json();
                    Severity: Minor
                    Found in pos/is4c-nf/parser/parse/Steering.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 addItem has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function addItem(array $row, $quantity, $priceObj)
                        {
                            if ($quantity == 0) return false;
                    
                            $pricing = $priceObj->priceInfo($row,$quantity);
                    Severity: Minor
                    Found in pos/is4c-nf/lib/Scanning/PriceMethods/QttyEnforcedGroupPM.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 get_id_view has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function get_id_view()
                        {
                            $this->addScript($this->config->get('URL') . 'src/javascript/jquery.floatThead.min.js');
                            $this->addScript('pricing-batch.js');
                            $dbc = $this->connection;
                    Severity: Minor
                    Found in fannie/batches/UNFI/VendorPricingBatchPage.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 getTopImage has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring.
                    Open

                        private function getTopImage($item)
                        {
                            // Manual Signs Page && smartType override checked takes precedence
                            if (isset($item['smartType']) && $item['smartType'] == 'CoopDeals') {
                                return __DIR__ . '/noauto/images/codeals_top_2.png';
                    Severity: Minor
                    Found in fannie/modules/plugins2.0/CoopDealsSigns/LegacySmartSigns4UpL.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 getTopImage has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring.
                    Open

                        private function getTopImage($item)
                        {
                            // Manual Signs Page && smartType override checked takes precedence
                            if (isset($item['smartType']) && $item['smartType'] == 'CoopDeals') {
                                return __DIR__ . '/noauto/images/codeals_top_2.png';
                    Severity: Minor
                    Found in fannie/modules/plugins2.0/CoopDealsSigns/WfcSmartSigns2UpP.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 get_month_upc_view has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function get_month_upc_view($month=false)
                        {
                            global $FANNIE_OP_DB;
                            $dbc = FannieDB::get($FANNIE_OP_DB);
                            if (FormLib::get('linea') != 1) {
                    Severity: Minor
                    Found in fannie/item/CoopDealsLookupPage.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

                    Method get_id_view has 160 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function get_id_view()
                        {
                            global $FANNIE_OP_DB;
                            $ret = $this->get_view();
                            $upc = BarcodeLib::padUPC($this->id);
                    Severity: Major
                    Found in fannie/item/handheld/ItemStatusPage.php - About 6 hrs to fix

                      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_New_Produce_Mockup.php and 1 other location - About 6 hrs to fix
                      fannie/admin/labels/pdf_layouts/WFC_Produce_SmartSigns.php on lines 284..296

                      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

                      Severity
                      Category
                      Status
                      Source
                      Language