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

if ($paged) {
    $url = filter_input(INPUT_SERVER, 'REQUEST_URI');
    if (!strstr($url,"page=")) {
        if (substr($url,-4)==".php") {
            $url .= "?page=".$page;
Severity: Major
Found in fannie/ordering/historical.php and 1 other location - About 5 hrs to fix
fannie/ordering/OldSpecialOrdersPage.php on lines 294..312

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

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

        foreach($hbKeys as $hbKey) {
            $hbTarget = "$hbPrefix" . ++$hbNumber;
            if (isset($hbLongMessage["$hbKey"]) && $hbLongMessage["$hbKey"] != "") {
                $anyMore = $hbMore;
                $onClick = " onclick=\"$('#{$hbTarget}').toggle();return false;\" ";
fannie/modules/plugins2.0/CoopCred/programs/CoopCredProgramEditor.php on lines 670..692

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

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

        if ($this->card_no == false) {
            $url = filter_input(INPUT_SERVER, 'REQUEST_URI');
            if (!strstr($url,"page=")) {
                if (substr($url,-4)==".php") {
                    $url .= "?page=".$page;
Severity: Major
Found in fannie/ordering/OldSpecialOrdersPage.php and 1 other location - About 5 hrs to fix
fannie/ordering/historical.php on lines 345..363

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

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 3 locations. Consider refactoring.
Open

                } elseif (strpos($row['description'], ' @ COST')) {
                    if (!isset($manuals[$row['salesCode']])) {
                        $manuals[$row['salesCode']] = array('qty'=>0.0,'ttl'=>0.0,'normalTtl'=>0.0,'costTtl'=>0.0);
                    }
                    $manuals[$row['salesCode']]['qty'] += $row['quantity'];
Severity: Major
Found in fannie/modules/plugins2.0/ShelfAudit/SaReportPage.php and 2 other locations - About 5 hrs to fix
fannie/modules/plugins2.0/ShelfAudit/SaReportPage.php on lines 371..380
fannie/modules/plugins2.0/ShelfAudit/SaReportPage.php on lines 380..389

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

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 3 locations. Consider refactoring.
Open

                } elseif (strpos($row['description'], 'ADJ SALES')) {
                    if (!isset($adjustDown[$row['salesCode']])) {
                        $adjustDown[$row['salesCode']] = array('qty'=>0.0,'ttl'=>0.0,'normalTtl'=>0.0,'costTtl'=>0.0);
                    }
                    $adjustDown[$row['salesCode']]['qty'] += $row['quantity'];
Severity: Major
Found in fannie/modules/plugins2.0/ShelfAudit/SaReportPage.php and 2 other locations - About 5 hrs to fix
fannie/modules/plugins2.0/ShelfAudit/SaReportPage.php on lines 362..371
fannie/modules/plugins2.0/ShelfAudit/SaReportPage.php on lines 380..389

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

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 3 locations. Consider refactoring.
Open

                } elseif (strpos($row['description'], ' RECV ')) {
                    if (!isset($adjustUp[$row['salesCode']])) {
                        $adjustUp[$row['salesCode']] = array('qty'=>0.0,'ttl'=>0.0,'normalTtl'=>0.0,'costTtl'=>0.0);
                    }
                    $adjustUp[$row['salesCode']]['qty'] += $row['quantity'];
Severity: Major
Found in fannie/modules/plugins2.0/ShelfAudit/SaReportPage.php and 2 other locations - About 5 hrs to fix
fannie/modules/plugins2.0/ShelfAudit/SaReportPage.php on lines 362..371
fannie/modules/plugins2.0/ShelfAudit/SaReportPage.php on lines 371..380

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

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

<?php

use COREPOS\Fannie\Plugin\IncidentTracker\notifiers\Slack;
use COREPOS\Fannie\Plugin\IncidentTracker\notifiers\Email;

Severity: Minor
Found in fannie/modules/plugins2.0/IncidentTracker/PosIncident.php - About 5 hrs to fix

    Method get_view has 141 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/batches/CAP/CoopDealsMergePage.php - About 5 hrs to fix

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

          function body_content()
          {
              global $FANNIE_AUTH_ENABLED;
              include(dirname(__FILE__) . '/../config.php'); 
      
      
      Severity: Major
      Found in fannie/install/InstallAuthenticationPage.php - About 5 hrs to fix

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

            public function run($args=[])
            {
                $config = FannieConfig::factory();
                $dbc = FannieDB::get($config->get('TRANS_DB'));
                $OP = $config->get('OP_DB') . $dbc->sep();
        Severity: Major
        Found in fannie/classlib2.0/webservices/FannieEquity.php - About 5 hrs to fix

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

                      $record = array(
                          'Total',
                          number_format($sum[1], 0),
                          number_format($dept_proj, 0),
                          number_format($dept_proj, 0), // % of store sales re-written later
          fannie/modules/plugins2.0/OpenBookFinancingV2/ObfWeeklyReportV2.php on lines 503..517

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

          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

                      $record = array(
                          'Total',
                          number_format($sum[1], 0),
                          number_format($dept_proj, 0),
                          number_format($dept_proj, 0), // % of store sales re-written later
          fannie/modules/plugins2.0/OpenBookFinancing/ObfWeeklyReport.php on lines 399..413

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

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

              public function addItem(array $row, $quantity, $priceObj)
              {
                  if ($quantity == 0) return false;
          
                  $pricing = $priceObj->priceInfo($row,$quantity);
          Severity: Major
          Found in pos/is4c-nf/lib/Scanning/PriceMethods/SplitABGroupPM.php - About 5 hrs to fix

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

                public function run()
                {
                    $sql = FannieDB::get($this->config->get('OP_DB'));
            
                    $chk_vital = array();
            Severity: Major
            Found in fannie/cron/tasks/PriceBatchTask.php - About 5 hrs to fix

              File GeneralDayReport.php has 400 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              <?php
              /*******************************************************************************
              
                  Copyright 2013 Whole Foods Co-op
              
              
              Severity: Minor
              Found in fannie/reports/GeneralDay/GeneralDayReport.php - About 5 hrs to fix

                File LikeCodeBatchSigns.php has 400 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                <?php
                
                include(dirname(__FILE__) . '/../../config.php');
                if (!class_exists('FannieAPI')) {
                    include_once(__DIR__ . '/../../classlib2.0/FannieAPI.php');
                Severity: Minor
                Found in fannie/admin/labels/LikeCodeBatchSigns.php - About 5 hrs to fix

                  Method editableItemList has 140 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      private function editableItemList($orderID)
                      {
                          $dbc = $this->connection;
                          $dbc->selectDB($this->config->get('OP_DB'));
                          $TRANS = $this->config->get('TRANS_DB') . $dbc->sep();
                  Severity: Major
                  Found in fannie/ordering/OrderViewPage.php - About 5 hrs to fix

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

                        function process_file($linedata, $indexes)
                        {
                            global $FANNIE_OP_DB;
                            $dbc = FannieDB::get($FANNIE_OP_DB);
                            $idR = $dbc->query("SELECT vendorID FROM vendors WHERE (vendorName='UNFI' OR vendorName LIKE 'UNFI %')
                    Severity: Minor
                    Found in fannie/batches/CAP/EdlpCatalogOverwrite.php - About 5 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 post_u_view has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring.
                    Open

                        protected function post_u_view()
                        {
                            $ret = '';
                            $ret .= '<form action="' . filter_input(INPUT_SERVER, 'PHP_SELF') . '" method="post" id="signform">';
                            $mods = FannieAPI::listModules('\COREPOS\Fannie\API\item\FannieSignage');
                    Severity: Minor
                    Found in fannie/admin/labels/SignFromSearch.php - About 5 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_pdf_handler has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring.
                    Open

                        protected function get_pdf_handler()
                        {
                            $store = FormLib::get('store', COREPOS\Fannie\API\lib\Store::getIdByIp());
                    
                            $ts = time();
                    Severity: Minor
                    Found in fannie/modules/plugins2.0/RP/RpDailyPage.php - About 5 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

                    Severity
                    Category
                    Status
                    Source
                    Language