CORE-POS/IS4C

View on GitHub

Showing 8,683 of 8,684 total issues

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

            for ($i=1; $i<=5; $i++) {
                $date = date('Y-m-d', strtotime($i*7 . ' days ago'));
                $res = $dbc->execute($prep, array($this->store, $date . ' 00:00:00', $date . ' 23:59:59'));
                while ($row = $dbc->fetchRow($res)) {
                    if ($i == 1) {
Severity: Major
Found in fannie/reports/SalesToday/SalesTodayReport2.php and 1 other location - About 6 hrs to fix
fannie/reports/SalesToday/SalesTodayChartOnly.php on lines 109..121

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

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=1; $i<=5; $i++) {
                $date = date('Y-m-d', strtotime($i*7 . ' days ago'));
                $res = $dbc->execute($prep, array($this->store, $date . ' 00:00:00', $date . ' 23:59:59'));
                while ($row = $dbc->fetchRow($res)) {
                    if ($i == 1) {
Severity: Major
Found in fannie/reports/SalesToday/SalesTodayChartOnly.php and 1 other location - About 6 hrs to fix
fannie/reports/SalesToday/SalesTodayReport2.php on lines 120..132

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

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 edit.js has 422 lines of code (exceeds 250 allowed). Consider refactoring.
Open

var batchEdit = (function ($) {
    var mod = {};

    var alerthi = function() {
        alert('hi');
Severity: Minor
Found in fannie/batches/newbatch/edit.js - About 6 hrs to fix

    File GumTaxFormTemplate.php has 422 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    /*******************************************************************************
    
        Copyright 2014 Whole Foods Co-op
    
    
    Severity: Minor
    Found in fannie/modules/plugins2.0/GiveUsMoneyPlugin/GumTaxFormTemplate.php - About 6 hrs to fix

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

          public function run()
          {
              $dbc = FannieDB::get($this->config->get('TRANS_DB'));
      
              // build department list
      Severity: Major
      Found in fannie/cron/tasks/EquityHistoryTask.php - About 6 hrs to fix

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

            public function run()
            {
                $this->CREDENTIALS = json_decode(file_get_contents(__DIR__ . '/credentials.json'), true);
                $dbc = FannieDB::get(FannieConfig::config('TRANS_DB'));
                $payments = $this->getTransactions($dbc);
        Severity: Major
        Found in fannie/modules/plugins2.0/RecurringEquity/EqRecurTask.php - About 6 hrs to fix

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

              function body_content(){
                  ob_start();
                  $stores = FormLib::storePicker();
                  $model = new SuperDeptNamesModel($this->connection);
                  $model->whichDB($this->config->get('OP_DB'));
          Severity: Major
          Found in fannie/modules/plugins2.0/ShelfAudit/SaReportPage.php - About 6 hrs to fix

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

                public function get_view()
                {
                    $dbc = $this->connection;
                    $dbc->selectDB($this->config->get('OP_DB'));
            
            
            Severity: Major
            Found in fannie/item/FloorSections/EditLocations.php - About 6 hrs to fix

              Method get_batchLog_view has 153 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function get_batchLog_view()
                  {
                      global $FANNIE_OP_DB;
                      $dbc = FannieDB::get($FANNIE_OP_DB);
              
              
              Severity: Major
              Found in fannie/item/ProdReviewPage.php - About 6 hrs to fix

                File OrderReviewPage.php has 421 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                <?php
                /*******************************************************************************
                
                    Copyright 2010 Whole Foods Co-op
                
                
                Severity: Minor
                Found in fannie/ordering/OrderReviewPage.php - About 6 hrs to fix

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

                      public function run()
                      {
                  
                          $start = time();
                          $dbc = FannieDB::get($this->config->get('OP_DB'));
                  Severity: Minor
                  Found in fannie/cron/tasks/InUseTask.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 run has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function run()
                      {
                          $dbc = FannieDB::get($this->config->get('TRANS_DB'));
                  
                          // build department list
                  Severity: Minor
                  Found in fannie/cron/tasks/EquityHistoryTask.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 process_file has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring.
                  Open

                      function process_file($linedata, $indexes)
                      {
                          $dbc = $this->connection;
                          $dbc->selectDB($this->config->get('OP_DB'));
                          $this->setupTables($dbc);
                  Severity: Minor
                  Found in fannie/batches/CAP/CoopDealsUploadPage.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 tablify has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring.
                  Open

                  function tablify($data,$col_order,$col_headers,$formatting,$sums=-1,$sum_cols=array()){
                      $sum = 0;
                      $ret = "";
                      
                      $ret .= "<table cellspacing=0 cellpadding=4 border=1><tr>";
                  Severity: Minor
                  Found in fannie/reports/Store-Specific/WFC/EOM-Nabs/index.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 tablify has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring.
                  Open

                  function tablify($data,$col_order,$col_headers,$formatting,$sums=-1,$sum_cols=array()){
                      $sum = 0;
                      $ret = "";
                      
                      $ret .= "<table cellspacing=0 cellpadding=4 border=1><tr>";
                  Severity: Minor
                  Found in fannie/reports/Store-Specific/WFC/EOM-Nabs/anydate.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_confirm_view has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function get_id_confirm_view()
                      {
                          
                          $ret = '';
                          

                  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 updateVendors has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function updateVendors($data)
                      {
                          $vendLC = new VendorLikeCodeMapModel($this->connection);
                          $activeP = $this->connection->prepare("SELECT storeID FROM LikeCodeActiveMap WHERE inUse=1 AND likeCode=?");
                          $catP = $this->connection->prepare("
                  Severity: Minor
                  Found in fannie/modules/plugins2.0/RP/RpImportCsv.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 preprocess has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring.
                  Open

                      function preprocess(){
                          global $FANNIE_PLUGIN_LIST,$FANNIE_PLUGIN_SETTINGS,$FANNIE_OP_DB;
                          global $FANNIE_CORRECTION_CASHIER, $FANNIE_CORRECTION_LANE, $FANNIE_CORRECTION_DEPT;
                  
                          if (isset($FANNIE_CORRECTION_CASHIER)) {
                  Severity: Minor
                  Found in fannie/modules/plugins2.0/CoopCred/membership/CoopCredJiggerTool.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 body_content has 152 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      function body_content()
                      {
                          include(dirname(__FILE__) . '/../config.php');
                          ob_start();
                  
                  
                  Severity: Major
                  Found in fannie/install/InstallMembershipPage.php - About 6 hrs to fix

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

                    function updateAAVariance(){
                        var accountable = Number($('#cashInTillsTotal').html());
                        var actual = Number($('#safeCount2Total').html());
                    
                        var variance = actual - accountable;
                    Severity: Major
                    Found in fannie/modules/plugins2.0/OverShortTools/js/countV2.js and 1 other location - About 6 hrs to fix
                    fannie/modules/plugins2.0/OverShortTools/js/countV3.js on lines 149..158

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

                    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