CORE-POS/IS4C

View on GitHub

Showing 8,683 of 8,684 total issues

Function normalize has a Cognitive Complexity of 54 (exceeds 5 allowed). Consider refactoring.
Open

    public function normalize($db_name, $mode=BasicModel::NORMALIZE_MODE_CHECK)
    {
        if ($mode != BasicModel::NORMALIZE_MODE_CHECK && $mode != BasicModel::NORMALIZE_MODE_APPLY) {
            echo "Error: Unknown mode ($mode)\n";
            return false;
Severity: Minor
Found in common/BasicModel.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

Method ReadThread has a Cognitive Complexity of 69 (exceeds 20 allowed). Consider refactoring.
Open

        unsafe void ReadThread()
        {
            if (!HandleAcquire()) { return; }
            
            try

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

<?php
use COREPOS\pos\lib\FormLib;
use COREPOS\pos\lib\MiscLib;
use COREPOS\pos\install\conf\Conf;
use COREPOS\pos\install\conf\FormFactory;
Severity: Major
Found in pos/is4c-nf/install/extra_config.php - About 1 day to fix

    File OverShortSafecountPage.php has 517 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

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

      Method post_id_view has 210 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          protected function post_id_view()
          {
              list($date, $tnum) = explode(':', $this->id);
              list($emp, $reg, $trans) = explode('-', $tnum);
              $storeID = FormLib::get('storeID');
      Severity: Major
      Found in fannie/modules/plugins2.0/Mercato/MercatoCorrections2.php - About 1 day to fix

        Method handleItem has 209 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            private function handleItem($upc, $row, $scaleStickerItem, $scalepriceUPC, $scalepriceEAN)
            {
                $ret = $this->default_json();
                $myUrl = MiscLib::baseURL();
                $dbc = Database::pDataConnect();
        Severity: Major
        Found in pos/is4c-nf/parser/parse/UPC.php - About 1 day to fix

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

              function preprocess() {
          
                  global $FANNIE_CORRECTION_CASHIER, $FANNIE_CORRECTION_LANE, $FANNIE_CORRECTION_DEPT;
                  global $FANNIE_PLUGIN_LIST,$FANNIE_PLUGIN_SETTINGS,$FANNIE_OP_DB;
          
          

            Method get_list_view has 208 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                function get_list_view()
                {
            
                    global $FANNIE_OP_DB;
                    $dbc = FannieDB::get($FANNIE_OP_DB);
            Severity: Major
            Found in fannie/item/ProdLocationEditor.php - About 1 day to fix

              Function load has a Cognitive Complexity of 53 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function load($filename, $filedata=null) 
                  {
                      $data = "";
                      if ($filename === true) {
                          $data = $filedata;
              Severity: Minor
              Found in pos/is4c-nf/lib/Bitmap.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

              Method ParseNumber has a Cognitive Complexity of 68 (exceeds 20 allowed). Consider refactoring.
              Open

                      private void ParseNumber()
                      {
                          ShiftBufferIfNeeded();
              
                          char firstChar = _chars[_charPos];

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

                  public function run()
                  {
              
                      $start = time();
                      $dbc = FannieDB::get($this->config->get('OP_DB'));
              Severity: Major
              Found in fannie/cron/tasks/InUseTask.php - About 1 day to fix

                Method outputPDF has 206 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    function outputPDF(){
                        global $FANNIE_PLUGIN_SETTINGS;
                        $dbc = FannieDB::get($FANNIE_PLUGIN_SETTINGS['OverShortDatabase']);
                        $start = FormLib::get_form_value('startDate');
                        $end = FormLib::get_form_value('endDate');
                Severity: Major
                Found in fannie/modules/plugins2.0/OverShortTools/OverShortDepositSlips.php - About 1 day to fix

                  Method body_content has 206 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      function body_content()
                      {
                          global $FANNIE_URL;
                  
                          /* $hb (helpbit) is an array keyed on the id= of the input being described.
                  Severity: Major
                  Found in fannie/modules/plugins2.0/CoopCred/CoopCredIndexPage.php - About 1 day to fix

                    File Database.php has 509 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    <?php
                    /*******************************************************************************
                    
                        Copyright 2012 Whole Foods Co-op
                    
                    
                    Severity: Major
                    Found in pos/is4c-nf/lib/Database.php - About 1 day to fix

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

                          protected function get_view()
                          {
                              $this->addScript('rpFloral.js?date=20200708');
                              $store = FormLib::get('store');
                              if (!$store) {
                      Severity: Major
                      Found in fannie/modules/plugins2.0/RP/RpFloralPage.php - About 1 day to fix

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

                                for ($i=0; $i<count($returnset); $i++) {
                                    if (!isset($returnset[$i]['trans_type']) || !isset($returnset[$i]['trans_status'])) {
                                        continue;
                                    }
                                    if ($returnset[$i]['trans_type'] == 'I' && $returnset[$i]['trans_status'] == 'M') {
                        fannie/modules/plugins2.0/EReceipt/EReceiptFilter.php on lines 155..177

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

                        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

                                for ($i=0; $i<count($returnset); $i++) {
                                    if (!isset($returnset[$i]['trans_type']) || !isset($returnset[$i]['trans_status'])) {
                                        continue;
                                    }
                                    if ($returnset[$i]['trans_type'] == 'I' && $returnset[$i]['trans_status'] == 'M') {
                        Severity: Major
                        Found in fannie/modules/plugins2.0/EReceipt/EReceiptFilter.php and 1 other location - About 1 day to fix
                        pos/is4c-nf/lib/ReceiptBuilding/Filter/DefaultReceiptFilter.php on lines 157..179

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

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

                        <?php
                        /*******************************************************************************
                        
                            Copyright 2001, 2004 Wedge Community Co-op
                        
                        
                        Severity: Major
                        Found in pos/is4c-nf/lib/TransRecord.php - About 1 day to fix

                          Class SPH_SignAndPay_USB has 57 methods (exceeds 20 allowed). Consider refactoring.
                          Open

                          public class SPH_SignAndPay_USB : SerialPortHandler {
                          
                              protected static String MAGELLAN_OUTPUT_DIR = "ss-output/";
                          
                              protected USBWrapper usb_port;
                          Severity: Major
                          Found in pos/is4c-nf/scale-drivers/drivers/NewMagellan/SPH_SignAndPay_USB.cs - About 1 day to fix

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

                                public function get_id_view()
                                {
                                    $id = FormLib::get('id');
                                    $listed = array();
                            
                            
                            Severity: Major
                            Found in fannie/batches/newbatch/ReviewBatchPage.php - About 1 day to fix
                              Severity
                              Category
                              Status
                              Source
                              Language