CORE-POS/IS4C

View on GitHub

Showing 8,683 of 8,684 total issues

File OverShortSafecountV3.php has 498 lines of code (exceeds 250 allowed). Consider refactoring.
Open

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

    Copyright 2013 Whole Foods Co-op

Severity: Minor
Found in fannie/modules/plugins2.0/OverShortTools/OverShortSafecountV3.php - About 7 hrs to fix

    File MemberSummaryReport.php has 498 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

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

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

          public function get_view()
          {
              $dbc = $this->connection;
              $dbc->selectDB($this->config->get('OP_DB'));
              $TRANS = $this->config->get('TRANS_DB') . $dbc->sep();
      Severity: Major
      Found in fannie/ordering/NewSpecialOrdersPage.php - About 7 hrs to fix

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

            public function javascriptContent()
            {
                return <<<JAVASCRIPT
        $('head').append('<meta name = "viewport" content = "width=device-width, minimum-scale=1.0, maximum-scale = 1.0, user-scalable = no">');
        
        
        Severity: Major
        Found in fannie/item/FloorSections/EditLocations.php - About 7 hrs to fix

          Function run has a Cognitive Complexity of 51 (exceeds 5 allowed). Consider refactoring.
          Open

              public function run()
              {
                  $dbc = FannieDB::get($this->config->get('OP_DB'));
                  $this->freshenCache($dbc);
                  $this->forecast = $this->forecastFactor($dbc, $this->forecast/$this->multiplier, $this->vendors, $this->store);
          Severity: Minor
          Found in fannie/cron/tasks/OrderGenTask.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 getTable has a Cognitive Complexity of 51 (exceeds 5 allowed). Consider refactoring.
          Open

              public function getTable()
              {
                  $this->addScript('pricing-batch-II.js');
                  $dbc = $this->connection;
                  $dbc->selectDB($this->config->OP_DB);
          Severity: Minor
          Found in fannie/batches/UNFI/VPBPIII.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 process_file has a Cognitive Complexity of 51 (exceeds 5 allowed). Consider refactoring.
          Open

              function process_file($linedata, $indexes)
              {
                  global $FANNIE_OP_DB;
                  $dbc = FannieDB::get($FANNIE_OP_DB);
          
          
          Severity: Minor
          Found in fannie/batches/xlsbatch/XlsBatchPage.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 fetch_report_data has a Cognitive Complexity of 51 (exceeds 5 allowed). Consider refactoring.
          Open

              public function fetch_report_data()
              {
                  global $FANNIE_OP_DB, $FANNIE_TRANS_DB;
                  $dbc = $this->connection;
                  $dbc->selectDB($this->config->get('OP_DB'));
          Severity: Minor
          Found in fannie/reports/OwnerJoinLeave/OwnerJoinLeaveReport.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 run has a Cognitive Complexity of 51 (exceeds 5 allowed). Consider refactoring.
          Open

              public function run($args=array())
              {
                  global $FANNIE_URL;
                  $data = array();
                  $action = FormLib::get_form_value('action');
          Severity: Minor
          Found in fannie/modules/plugins2.0/CalendarPlugin/CalendarAjax.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 htmlLine has a Cognitive Complexity of 51 (exceeds 5 allowed). Consider refactoring.
          Open

              public function htmlLine($row, $header=False)
              {
                  $url = $this->config->get('URL');
                  $meta = 0;
                  if (isset($row['meta'])) {
          Severity: Minor
          Found in fannie/classlib2.0/FannieReportPage.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 standardItemFromWhere has a Cognitive Complexity of 51 (exceeds 5 allowed). Consider refactoring.
          Open

              static public function standardItemFromWhere()
              {
                  $op_db = FannieConfig::config('OP_DB');
                  $dbc = FannieDB::getReadOnly($op_db);
                  $start_date = self::getDate('date1', date('Y-m-d'));
          Severity: Minor
          Found in fannie/classlib2.0/lib/FormLib.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 list_content has a Cognitive Complexity of 51 (exceeds 5 allowed). Consider refactoring.
          Open

              private function list_content()
              {
                  global $FANNIE_OP_DB;
                  $dbc = FannieDB::get($FANNIE_OP_DB);
          
          
          Severity: Minor
          Found in fannie/item/ProductListPage.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

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

                  $data[] = array(
                      'Average Basket',
                      number_format($total_sales->lastYear / $total_trans->lastYear, 2),
                      number_format($total_sales->projected / $proj_trans, 2),
                      '',
          fannie/modules/plugins2.0/OpenBookFinancingV2/ObfWeeklyReportV2.php on lines 790..804

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

          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

                  $data[] = array(
                      'Average Basket',
                      number_format($total_sales->lastYear / $total_trans->lastYear, 2),
                      number_format($total_sales->projected / $proj_trans, 2),
                      '',
          fannie/modules/plugins2.0/OpenBookFinancing/ObfWeeklyReport.php on lines 779..793

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

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

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

            File OriginEditor.php has 493 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            <?php
            /*******************************************************************************
            
                Copyright 2014 Whole Foods Co-op, Duluth, MN
            
            
            Severity: Minor
            Found in fannie/item/origins/OriginEditor.php - About 7 hrs to fix

              File JsonConvert.cs has 493 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

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

                File rpDual.js has 492 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                var rpOrder = (function ($) {
                
                    var mod = {};
                    var state = {
                        'retention': 60,
                Severity: Minor
                Found in fannie/modules/plugins2.0/RP/rpDual.js - About 7 hrs to fix

                  Method monthView has 195 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public static function monthView($id,$month,$year,$uid)
                      {
                          global $FANNIE_OP_DB;
                          $DAY_NAMES = self::$DAY_NAME_MAPPING;
                  
                  
                  Severity: Major
                  Found in fannie/modules/plugins2.0/CalendarPlugin/CalendarPluginDisplayLib.php - About 7 hrs to fix

                    Method run has 195 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function run()
                        {
                            global $FANNIE_LANES;
                            global $FANNIE_PLUGIN_LIST;
                            global $FANNIE_PLUGIN_SETTINGS;
                      Severity
                      Category
                      Status
                      Source
                      Language