CORE-POS/IS4C

View on GitHub

Showing 8,297 of 8,298 total issues

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

        if ($quantity > 0){
            TransRecord::addRecord(array(
                'upc' => $row['upc'],
                'description' => $row['description'],
                'trans_type' => 'I',
Severity: Major
Found in pos/is4c-nf/lib/Scanning/PriceMethods/SplitABGroupPM.php and 2 other locations - About 1 day to fix
pos/is4c-nf/lib/Scanning/PriceMethods/ABGroupPM.php on lines 224..249
pos/is4c-nf/lib/Scanning/PriceMethods/QttyEnforcedGroupPM.php on lines 229..254

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

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

        if ($quantity > 0){
            TransRecord::addRecord(array(
                'upc' => $row['upc'],
                'description' => $row['description'],
                'trans_type' => 'I',
pos/is4c-nf/lib/Scanning/PriceMethods/ABGroupPM.php on lines 224..249
pos/is4c-nf/lib/Scanning/PriceMethods/SplitABGroupPM.php on lines 208..233

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

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 SPH_Datacap_EMVX.cs has 626 lines of code (exceeds 250 allowed). Consider refactoring.
Open

using System;
using System.IO;
using System.Threading;
using System.Net;
using System.Net.Sockets;
Severity: Major
Found in pos/is4c-nf/scale-drivers/drivers/NewMagellan/SPH_Datacap_EMVX.cs - About 1 day to fix

    File CoopCredTransferTool.php has 625 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    /*******************************************************************************
    
        Copyright 2010,2013 Whole Foods Co-op, Duluth, MN
        Copyright 2014 West End Food Co-op, Toronto, ON, Canada

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

      function validateAndHome(){
          var dcheck=false;
          $('select.editDept').each(function(){
              if ($(this).val() === '0'){
                  dcheck=true;
      Severity: Major
      Found in fannie/ordering/view.js and 1 other location - About 1 day to fix
      fannie/ordering/orderview.js on lines 358..391

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

      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

          mod.validateAndHome = function (){
              var dcheck=false;
              $('select.editDept').each(function(){
                  if ($(this).val() === '0'){
                      dcheck=true;
      Severity: Major
      Found in fannie/ordering/orderview.js and 1 other location - About 1 day to fix
      fannie/ordering/view.js on lines 349..382

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

      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

          public function expandUPCE($entered)
          {
              $par6 = substr($entered, -1);
              if ($par6 == 0) $entered = substr($entered, 0, 3)."00000".substr($entered, 3, 3);
              elseif ($par6 == 1) $entered = substr($entered, 0, 3)."10000".substr($entered, 3, 3);
      Severity: Major
      Found in pos/is4c-nf/parser/parse/UPC.php and 1 other location - About 1 day to fix
      fannie/classlib2.0/lib/BarcodeLib.php on lines 58..69

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

      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

          public static function expandUPCE($entered)
          {
              $par6 = substr($entered, -1);
              if ($par6 == 0) $entered = substr($entered, 0, 3)."00000".substr($entered, 3, 3);
              elseif ($par6 == 1) $entered = substr($entered, 0, 3)."10000".substr($entered, 3, 3);
      Severity: Major
      Found in fannie/classlib2.0/lib/BarcodeLib.php and 1 other location - About 1 day to fix
      pos/is4c-nf/parser/parse/UPC.php on lines 617..628

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

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

          static public function setAltMemMsg($store, $member, $row)
          {
              if ($store == 'WEFC_Toronto') {
                  $chargeOk = self::chargeOk();
                  /* Doesn't quite allow for StoreCharge/PrePay for regular members
      Severity: Minor
      Found in pos/is4c-nf/lib/MemberLib.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 69 (exceeds 5 allowed). Consider refactoring.
      Open

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

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

          mod.orderAll = function() {
              var buttons = $('button.orderAll');
              var meters = $('.progress');
              buttons.prop('disabled', true);
              meters.show();
      Severity: Major
      Found in fannie/modules/plugins2.0/RP/rpDual.js and 1 other location - About 1 day to fix
      fannie/modules/plugins2.0/RP/rpOrder.js on lines 456..474

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

      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

          mod.orderAll = function() {
              var buttons = $('button.orderAll');
              var meters = $('.progress');
              buttons.prop('disabled', true);
              meters.show();
      Severity: Major
      Found in fannie/modules/plugins2.0/RP/rpOrder.js and 1 other location - About 1 day to fix
      fannie/modules/plugins2.0/RP/rpDual.js on lines 510..528

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

      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

          $AR_EOM_Summary_Q = "
          INSERT INTO AR_EOM_Summary
          SELECT c.CardNo,"
          .$sql->concat("c.FirstName","' '","c.LastName",'')." AS memName,
      
      
      Severity: Major
      Found in fannie/cron/nightly.ar.php and 1 other location - About 1 day to fix
      fannie/cron/tasks/ArHistoryTask.php on lines 176..217

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

      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

                  $AR_EOM_Summary_Q = "
                  INSERT INTO AR_EOM_Summary
                  SELECT c.CardNo,"
                  .$dbc->concat("c.FirstName","' '","c.LastName",'')." AS memName,
      
      
      Severity: Major
      Found in fannie/cron/tasks/ArHistoryTask.php and 1 other location - About 1 day to fix
      fannie/cron/nightly.ar.php on lines 106..147

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

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

          function displayUI($dateStr, $store){
              global $FANNIE_PLUGIN_SETTINGS;
              $dbc = FannieDB::get($FANNIE_PLUGIN_SETTINGS['OverShortDatabase']);
      
              $startDate = $dateStr;
      Severity: Major
      Found in fannie/modules/plugins2.0/OverShortTools/OverShortSafecountV2.php - About 1 day to fix

        Function WEFC_No_Barcode has a Cognitive Complexity of 68 (exceeds 5 allowed). Consider refactoring.
        Open

        function WEFC_No_Barcode($data,$offset=0) {
        
            global $FANNIE_OP_DB;
            global $FANNIE_COOP_ID;
            $dbc = FannieDB::get($FANNIE_OP_DB);
        Severity: Minor
        Found in fannie/admin/labels/pdf_layouts/WEFC_No_Barcode.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 saveprice(upc){
            var srp = parseFloat($('#newprice'+upc).val());
            var cost = parseFloat($('#row'+upc).find('.adj-cost').html());
            var newmargin = (srp - cost) / srp;
            newmargin *= 100;
        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 82..98

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

        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 saveprice(upc){
            var srp = parseFloat($('#newprice'+upc).val());
            var cost = parseFloat($('#row'+upc).find('.adj-cost').html());
            var newmargin = (srp - cost) / srp;
            newmargin *= 100;
        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 80..96

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

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

            public function post_id_handler()
            {
                global $FANNIE_OP_DB, $FANNIE_TRANS_DB, $FANNIE_ARCHIVE_DB;
                $dbc = FannieDB::get($FANNIE_OP_DB);
        
        
        Severity: Major
        Found in fannie/modules/plugins2.0/StatementsPlugin/StatementsPluginEmail.php - About 1 day to fix

          Method fetch_report_data has 266 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function fetch_report_data()
              {
                  try {
                      $month = $this->form->month;
                      $year = $this->form->year;
          Severity: Major
          Found in fannie/modules/plugins2.0/CoreWarehouse/reports/EOMReport.php - About 1 day to fix
            Severity
            Category
            Status
            Source
            Language