CORE-POS/IS4C

View on GitHub

Showing 8,683 of 8,684 total issues

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

            if ($dbc->isConnected($lane['op'])) {
                $clearP = $dbc->prepare("DELETE FROM tenders WHERE TenderID NOT IN ({$idIn})", $lane['op']);
                $clearR = $dbc->execute($clearP, $idArgs, $lane['op']);
                $chkP = $dbc->prepare("SELECT TenderID FROM tenders WHERE TenderID=?", $lane['op']);
                $insP = $dbc->prepare("INSERT INTO tenders (TenderID, TenderCode, TenderName, TenderType,
Severity: Major
Found in fannie/classlib2.0/data/lanesync/TendersSync.php and 1 other location - About 1 day to fix
fannie/sync/special/tenders.modules.php on lines 14..32

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

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

    protected function post_id_sale_cost_handler()
    {
        $batchID = $this->getSalesID();
        if (!$batchID) {
            $model = new BatchesModel($this->connection);
Severity: Major
Found in fannie/item/likecodes/LikeCodeBatchPage.php and 1 other location - About 1 day to fix
fannie/item/likecodes/LikeCodeBatchPage.php on lines 59..88

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

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

    if ($dbc->isConnected($lane['op'])) {
        $clearP = $dbc->prepare("DELETE FROM tenders WHERE TenderID NOT IN ({$idIn})", $lane['op']);
        $clearR = $dbc->execute($clearP, $idArgs, $lane['op']);
        $chkP = $dbc->prepare("SELECT TenderID FROM tenders WHERE TenderID=?", $lane['op']);
        $insP = $dbc->prepare("INSERT INTO tenders (TenderID, TenderCode, TenderName, TenderType,
Severity: Major
Found in fannie/sync/special/tenders.modules.php and 1 other location - About 1 day to fix
fannie/classlib2.0/data/lanesync/TendersSync.php on lines 39..60

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

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

    protected function post_id_price_cost_handler()
    {
        $batchID = $this->getBatchID();
        if (!$batchID) {
            $model = new BatchesModel($this->connection);
Severity: Major
Found in fannie/item/likecodes/LikeCodeBatchPage.php and 1 other location - About 1 day to fix
fannie/item/likecodes/LikeCodeBatchPage.php on lines 104..133

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

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

Function displayUI has a Cognitive Complexity of 65 (exceeds 5 allowed). Consider refactoring.
Open

    function displayUI($dateStr, $store, $type){
        global $FANNIE_PLUGIN_SETTINGS;
        $dbc = FannieDB::get($FANNIE_PLUGIN_SETTINGS['OverShortDatabase']);

        $startDate = $dateStr;
Severity: Minor
Found in fannie/modules/plugins2.0/OverShortTools/OverShortSafecountV3.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

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

    function categorySelect(elem) {
        if (openCategory == elem) {
            return;
        }
        if (openInput) {
Severity: Major
Found in fannie/modules/plugins2.0/DeliInventory/di.js and 1 other location - About 1 day to fix
fannie/modules/plugins2.0/DeliInventory/di.js on lines 22..46

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

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 vendorSelect(elem) {
        if (openVendor == elem) {
            return;
        }
        if (openInput) {
Severity: Major
Found in fannie/modules/plugins2.0/DeliInventory/di.js and 1 other location - About 1 day to fix
fannie/modules/plugins2.0/DeliInventory/di.js on lines 63..87

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

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

<?php

namespace COREPOS\pos\lib;
use \Exception;

Severity: Major
Found in pos/is4c-nf/lib/Bitmap.php - About 1 day to fix

    PrintHandler has 69 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class PrintHandler {
    
        const BARCODE_UPCA      = 1;
        const BARCODE_UPCE      = 2;
        const BARCODE_EAN13     = 3;
    Severity: Major
    Found in pos/is4c-nf/lib/PrintHandlers/PrintHandler.php - About 1 day to fix

      File ValueLink.php has 588 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      <?php
      /*******************************************************************************
      
          Copyright 2007,2010 Whole Foods Co-op
      
      
      Severity: Major
      Found in pos/is4c-nf/plugins/Paycards/ValueLink.php - About 1 day to fix

        Function loadItems has a Cognitive Complexity of 64 (exceeds 5 allowed). Consider refactoring.
        Open

            public function loadItems()
            {
                if ($this->source == 'provided') {
                    return $this->items;
                }
        Severity: Minor
        Found in fannie/classlib2.0/item/FannieSignage.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 64 (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/likecodes/LikeCodePriceUploadPage.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 SignFromSearch.php has 586 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        <?php
        /*******************************************************************************
        
            Copyright 2014 Whole Foods Co-op
        
        
        Severity: Major
        Found in fannie/admin/labels/SignFromSearch.php - About 1 day to fix

          Method ajaxRequest has 251 lines of code (exceeds 25 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: Major
          Found in fannie/modules/plugins2.0/OverShortTools/OverShortDayPage.php - About 1 day to fix

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

                public function run($args=array())
                {
                    $ret = array();
                    if (!property_exists($args, 'field') || !property_exists($args, 'search')) {
                        // missing required arguments
            Severity: Major
            Found in fannie/classlib2.0/webservices/FannieAutoComplete.php - About 1 day to fix

              Method get_id_view has 250 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  protected function get_id_view()
                  {
                      $dbc = $this->connection;
                      $dbc->selectDB($this->config->get('OP_DB'));
              
              
              Severity: Major
              Found in fannie/purchasing/ViewPurchaseOrders.php - About 1 day to fix

                Method forceStartBatch has 250 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function forceStartBatch($id, $upc=false)
                    {
                        $b_def = $this->connection->tableDefinition($this->name);
                        $bt_def = $this->connection->tableDefinition('batchType');
                        $exit = isset($bt_def['exitInventory']) ? 'exitInventory' : '0 AS exitInventory';
                Severity: Major
                Found in fannie/classlib2.0/data/models/op/BatchesModel.php - About 1 day to fix

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

                      private function sizeItem($item, $data)
                      {
                          $item['size'] = trim($data[11]);
                          if (is_numeric($item['size'])) {
                              $item['size'] .= ' ' . trim($data[12]);
                  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 50..68

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

                  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 sizeItem($item, $data)
                      {
                          $item['size'] = trim($data[11]);
                          if (is_numeric($item['size'])) {
                              $item['size'] .= ' ' . trim($data[12]);
                  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 69..87

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

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

                  <?php
                  /*******************************************************************************
                  
                      Copyright 2013 Whole Foods Co-op
                      Based on example code from Wedge Community Co-op
                  Severity: Major
                  Found in fannie/modules/plugins2.0/ShelfAudit/SaReportPage.php - About 1 day to fix
                    Severity
                    Category
                    Status
                    Source
                    Language