CORE-POS/IS4C

View on GitHub

Showing 8,683 of 8,684 total issues

Function potentialItems has a Cognitive Complexity of 63 (exceeds 5 allowed). Consider refactoring.
Open

    public function potentialItems($wicData)
    {
        $ret = "";
        $categories = array();
        foreach ($wicData as $balanceRecord) {
Severity: Minor
Found in pos/is4c-nf/lib/ReceiptBuilding/Messages/WicReceiptMessage.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

Function get_view has a Cognitive Complexity of 63 (exceeds 5 allowed). Consider refactoring.
Open

    protected function get_view()
    {
        $this->addScript('rpDual.js?date=20230801');
        $this->addOnloadCommand('rpOrder.initAutoCompletes();');
        $store = FormLib::get('store');
Severity: Minor
Found in fannie/modules/plugins2.0/RP/RpDualPage.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

Function process_file has a Cognitive Complexity of 63 (exceeds 5 allowed). Consider refactoring.
Open

    public function process_file($linedata, $indexes)
    {
        global $FANNIE_OP_DB;
        $dbc = FannieDB::get($FANNIE_OP_DB);

Severity: Minor
Found in fannie/item/vendors/DefaultUploadPage.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

File CalendarPluginDisplayLib.php has 579 lines of code (exceeds 250 allowed). Consider refactoring.
Open

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

    Copyright 2013 Whole Foods Co-op

Severity: Major
Found in fannie/modules/plugins2.0/CalendarPlugin/CalendarPluginDisplayLib.php - About 1 day to fix

    Method listClasses has 247 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        private function listClasses()
        {
            $FANNIE_URL = $this->config->get('URL');
    
            $dbc = FannieDB::get($this->config->get('OP_DB'));
    Severity: Major
    Found in fannie/modules/plugins2.0/WfcClassRegistry/WfcClassRegistryPage.php - About 1 day to fix

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

      function toggleV(upc){
          var val = $('#row'+upc).find('.varp').prop('checked');
          if (val){
              $('#row'+upc).attr('class','white');
              $.ajax({
      Severity: Major
      Found in fannie/batches/UNFI/pricing-batch.js and 1 other location - About 1 day to fix
      fannie/batches/UNFI/pricing-batch-II.js on lines 45..66

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

      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 toggleV(upc){
          var val = $('#row'+upc).find('.varp').prop('checked');
          if (val){
              $('#row'+upc).attr('class','white');
              $.ajax({
      Severity: Major
      Found in fannie/batches/UNFI/pricing-batch-II.js and 1 other location - About 1 day to fix
      fannie/batches/UNFI/pricing-batch.js on lines 43..64

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

      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

          private function validateLine($data)
          {
              $ret = array('valid'=>false);
              $ret['sku'] = trim($data[8]);
              $ret['upc'] = trim($data[7]);
      Severity: Major
      Found in fannie/modules/plugins2.0/CpwPriceImport/CpwPriceTask.php and 1 other location - About 1 day to fix
      fannie/batches/UNFI/load-classes/CpwProduceUploadPage.php on lines 45..67

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

      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

          public function report_description_content()
          {
              $ts1 = strtotime(FormLib::get('date1'));
              $ts2 = strtotime(FormLib::get('date2'));
              $ret = array();
      fannie/modules/plugins2.0/CoreWarehouse/reports/YOY/YOYDailySales.php on lines 19..39

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

      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

          public function report_description_content()
          {
              $ts1 = strtotime(FormLib::get('date1'));
              $ts2 = strtotime(FormLib::get('date2'));
              $ret = array();
      fannie/modules/plugins2.0/CoreWarehouse/reports/YOY/YOYDeptSales.php on lines 19..39

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

      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

          private function validateLine($data)
          {
              $ret = array('valid'=>false);
              $ret['sku'] = trim($data[8]);
              $ret['upc'] = trim($data[7]);
      Severity: Major
      Found in fannie/batches/UNFI/load-classes/CpwProduceUploadPage.php and 1 other location - About 1 day to fix
      fannie/modules/plugins2.0/CpwPriceImport/CpwPriceTask.php on lines 26..48

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

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

      <?php
      /*******************************************************************************
      
          Copyright 2013 Whole Foods Co-op
      
      
      Severity: Major
      Found in fannie/classlib2.0/data/models/op/BatchesModel.php - About 1 day to fix

        File ProductListPage.php has 575 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        <?php
        /*******************************************************************************
        
            Copyright 2013 Whole Foods Co-op
        
        
        Severity: Major
        Found in fannie/item/ProductListPage.php - About 1 day to fix

          File VendorPricingBatchPage.php has 574 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          <?php
          /*******************************************************************************
          
              Copyright 2010 Whole Foods Co-op
          
          
          Severity: Major
          Found in fannie/batches/UNFI/VendorPricingBatchPage.php - About 1 day to fix

            Function body_content has a Cognitive Complexity of 62 (exceeds 5 allowed). Consider refactoring.
            Open

                function body_content(){
                    global $FANNIE_OP_DB, $FANNIE_PLUGIN_SETTINGS, $FANNIE_URL;
                    $ts_db = FannieDB::get($FANNIE_PLUGIN_SETTINGS['TimesheetDatabase']);
            
                    include ('./includes/header.html');
            Severity: Minor
            Found in fannie/modules/plugins2.0/TimesheetPlugin/TsStaffMemReport.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

            Function preprocess has a Cognitive Complexity of 62 (exceeds 5 allowed). Consider refactoring.
            Open

                public function preprocess()
                {
                    global $FANNIE_OP_DB;
                    $sql = FannieDB::get($FANNIE_OP_DB);
            
            
            Severity: Minor
            Found in fannie/modules/plugins2.0/DeliInventory/DeliInventoryPage.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

            Function preprocess has a Cognitive Complexity of 62 (exceeds 5 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;
            
            

            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 HandleMessageFromDevice has a Cognitive Complexity of 77 (exceeds 20 allowed). Consider refactoring.
            Open

                public void HandleMessageFromDevice(byte[] buffer)
                {
                    System.Text.ASCIIEncoding enc = new System.Text.ASCIIEncoding();
                    if (this.verbose_mode > 0) {
                        System.Console.WriteLine("Received:");

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

                function body_content()
                {
                    global $FANNIE_OP_DB, $FANNIE_PLUGIN_SETTINGS;
                    $ts_db = FannieDB::get($FANNIE_PLUGIN_SETTINGS['TimesheetDatabase']);
            
            
            Severity: Major
            Found in fannie/modules/plugins2.0/TimesheetPlugin/PayrollSummaryPage.php - About 1 day to fix

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

                  public function get_view()
                  {
                      $cache = unserialize(DataCache::getFile('monthly', 'MKSales'));
                      $this->addScript('../../../../src/javascript/Chart.min.js');
                      $this->addScript('mk.js');
                Severity
                Category
                Status
                Source
                Language