CORE-POS/IS4C

View on GitHub

Showing 8,683 of 8,684 total issues

Function processMail has a Cognitive Complexity of 48 (exceeds 5 allowed). Consider refactoring.
Open

    public function processMail($msg)
    {
        $info = $this->parseEmail($msg);
        $boundary = $this->hasAttachments($info['headers']);
        $dbc = \FannieDB::get(\FannieConfig::config('OP_DB'));
Severity: Minor
Found in fannie/modules/plugins2.0/AlbertsInvoiceImport/AiiDeliMailPipe.php - About 7 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 ajaxRequest has a Cognitive Complexity of 48 (exceeds 5 allowed). Consider refactoring.
Open

    function ajaxRequest($action){
        global $FANNIE_OP_DB, $FANNIE_PLUGIN_SETTINGS;
        $dbc = FannieDB::get($FANNIE_PLUGIN_SETTINGS['OverShortDatabase']);
        switch($action){
        case 'save':
Severity: Minor
Found in fannie/modules/plugins2.0/OverShortTools/OverShortDayPage.php - About 7 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

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

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

    Copyright 2015 Whole Foods Co-op

Severity: Major
Found in fannie/purchasing/exporters/MyUnfi7DigitCsvExport.php and 1 other location - About 7 hrs to fix
fannie/purchasing/exporters/Unfi7DigitCsvExport.php on lines 1..62

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

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 2015 Whole Foods Co-op

Severity: Major
Found in fannie/purchasing/exporters/Unfi7DigitCsvExport.php and 1 other location - About 7 hrs to fix
fannie/purchasing/exporters/MyUnfi7DigitCsvExport.php on lines 1..62

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

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

<?php
use COREPOS\pos\lib\FormLib;
use COREPOS\pos\install\conf\Conf;
use COREPOS\pos\install\conf\FormFactory;
use COREPOS\pos\install\InstallUtilities;
Severity: Minor
Found in pos/is4c-nf/install/scanning.php - About 7 hrs to fix

    Method dateRangePicker has 185 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public static function dateRangePicker($one='date1',$two='date2',$week_start=1)
        {
        /**
          Get a fieldset to select certain date ranges
          Requires JQquery
    Severity: Major
    Found in fannie/classlib2.0/lib/FormLib.php - About 7 hrs to fix

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

          mod.swapQualifierToDiscount = function(elem, upc)
          {
              var tr = $(elem).closest('tr');
              $.ajax({
                  type: 'post',
      Severity: Major
      Found in fannie/batches/newbatch/edit.js and 1 other location - About 7 hrs to fix
      fannie/batches/newbatch/edit.js on lines 251..267

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

      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

      function saveCat(id){
          var newcat = document.getElementById('catSelect'+id).value;
          var clearName =  newcat.replace(/_/,' ');
          $.ajax({
              url: 'DeliInventoryPage.php',
      Severity: Major
      Found in fannie/modules/plugins2.0/DeliInventory/index.js and 1 other location - About 7 hrs to fix
      fannie/modules/plugins2.0/DeliInventory/index3.js on lines 159..173

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

      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

          mod.swapDiscountToQualifier = function(elem, upc)
          {
              var tr = $(elem).closest('tr');
              $.ajax({
                  type: 'post',
      Severity: Major
      Found in fannie/batches/newbatch/edit.js and 1 other location - About 7 hrs to fix
      fannie/batches/newbatch/edit.js on lines 269..285

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

      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

      function saveCat(id){
          var newcat = document.getElementById('catSelect'+id).value;
          var clearName =  newcat.replace(/_/,' ');
          $.ajax({
              url: 'DeliInventoryPage2.php',
      Severity: Major
      Found in fannie/modules/plugins2.0/DeliInventory/index3.js and 1 other location - About 7 hrs to fix
      fannie/modules/plugins2.0/DeliInventory/index.js on lines 159..173

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

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

          function check($str)
          {
              $myUrl = MiscLib::baseURL();
              
              $this->ret = $this->default_json();
      Severity: Major
      Found in pos/is4c-nf/parser/parse/Steering.php - About 7 hrs to fix

        File GumTaxMiscFormTemplate.php has 473 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

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

          File GumTaxDividendFormTemplate.php has 473 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

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

            File DIPage2.php has 473 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            <?php
            
            use COREPOS\Fannie\API\lib\Store;
            use COREPOS\Fannie\API\lib\FannieUI;
            
            
            Severity: Minor
            Found in fannie/modules/plugins2.0/DeliInventory/DIPage2.php - About 7 hrs to fix

              File AdvancedMemSearch.php has 472 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              <?php
              
              include(__DIR__ . '/../config.php');
              if (!class_exists('FannieAPI')) {
                  include(__DIR__ . '/../classlib2.0/FannieAPI.php');
              Severity: Minor
              Found in fannie/mem/AdvancedMemSearch.php - About 7 hrs to fix

                File JsonTextWriter.cs has 472 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                using System;
                using System.Collections.Generic;
                using System.Globalization;
                #if !(NET20 || NET35 || PORTABLE40 || PORTABLE)
                using System.Numerics;

                  File TypeExtensions.cs has 472 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  using System;
                  using System.Collections.Generic;
                  using System.Reflection;
                  #if NET20
                  using Newtonsoft.Json.Utilities.LinqBridge;

                    Method queueableItemFromWhere has 183 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        static public function queueableItemFromWhere($form)
                        {
                            $op_db = FannieConfig::config('OP_DB');
                            $dbc = FannieDB::getReadOnly($op_db);
                            try {
                    Severity: Major
                    Found in fannie/classlib2.0/lib/FormLib.php - About 7 hrs to fix

                      Method WEFC_No_Barcode has 182 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      function WEFC_No_Barcode($data,$offset=0) {
                      
                          global $FANNIE_OP_DB;
                          global $FANNIE_COOP_ID;
                          $dbc = FannieDB::get($FANNIE_OP_DB);
                      Severity: Major
                      Found in fannie/admin/labels/pdf_layouts/WEFC_No_Barcode.php - About 7 hrs to fix

                        File RpDailyPage.php has 470 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        <?php
                        
                        use COREPOS\Fannie\API\lib\Operators as Op;
                        use COREPOS\Fannie\API\data\DataConvert; 
                        
                        
                        Severity: Minor
                        Found in fannie/modules/plugins2.0/RP/RpDailyPage.php - About 7 hrs to fix
                          Severity
                          Category
                          Status
                          Source
                          Language