CORE-POS/IS4C

View on GitHub

Showing 8,683 of 8,684 total issues

Function fetch_report_data has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
Open

    function fetch_report_data(){

        //global $FANNIE_TRANS_DB,
        global $FANNIE_OP_DB, $FANNIE_URL;
        global $FANNIE_PLUGIN_SETTINGS;

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 39 (exceeds 5 allowed). Consider refactoring.
Open

    public function run()
    {

        global $FANNIE_TRANS_DB, $FANNIE_SERVER_DBMS;
        global $FANNIE_PLUGIN_LIST, $FANNIE_PLUGIN_SETTINGS;
Severity: Minor
Found in fannie/modules/plugins2.0/CoopCred/tasks/CoopCredHistoryTask.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 preprocess has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
Open

    function preprocess(){
        global $FANNIE_PLUGIN_SETTINGS;
        $this->status = 'waiting - no input';

        /**
Severity: Minor
Found in fannie/modules/plugins2.0/ShelfAudit/SaScanningPage.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 body_content has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
Open

    function body_content(){
        ob_start();
        $elem = '#upc_in';
        $this->add_onload_command('$(\'#upc_in\').focus();');
        ?>
Severity: Minor
Found in fannie/modules/plugins2.0/ShelfAudit/SaOrderingPage.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 normalize has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
Open

    public function normalize($db_name, $mode=BasicModel::NORMALIZE_MODE_CHECK, $doCreate=false)
    {
        $config = FannieConfig::factory();
        $FANNIE_TRANS_DB = $config->get('TRANS_DB');
        $FANNIE_ARCHIVE_DB = $config->get('ARCHIVE_DB');
Severity: Minor
Found in fannie/classlib2.0/data/models/trans/DTransactionsModel.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

Method ReadMetadataPropertiesToken has a Cognitive Complexity of 54 (exceeds 20 allowed). Consider refactoring.
Open

        private bool ReadMetadataPropertiesToken(JTokenReader reader, ref Type objectType, ref JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, object existingValue, out object newValue, out string id)
        {
            id = null;
            newValue = null;

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

        if ($memNum != 0) {
            $namesP = $dbc->prepare("SELECT personNum,FirstName,LastName FROM custdata
                WHERE CardNo=? ORDER BY personNum");
            $namesR = $dbc->execute($namesP,array($memNum));
            while($namesW = $dbc->fetch_row($namesR)) {
Severity: Major
Found in fannie/ordering/OrderReviewPage.php and 1 other location - About 5 hrs to fix
fannie/ordering/ajax-calls.php on lines 1071..1089

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

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 ($memNum != 0) {
        $namesP = $dbc->prepare("SELECT personNum,FirstName,LastName FROM custdata
            WHERE CardNo=? ORDER BY personNum");
        $namesR = $dbc->execute($namesP,array($memNum));
        while($namesW = $dbc->fetch_row($namesR)) {
Severity: Major
Found in fannie/ordering/ajax-calls.php and 1 other location - About 5 hrs to fix
fannie/ordering/OrderReviewPage.php on lines 80..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 202.

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

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

    Copyright 2015 Whole Foods Co-op

Severity: Minor
Found in fannie/admin/labels/ManualSignsPage.php - About 5 hrs to fix

    File DeliInventoryPage.php has 412 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/modules/plugins2.0/DeliInventory/DeliInventoryPage.php - About 5 hrs to fix

      File ContributionTool.php has 412 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

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

        Method updateSalesCache has 147 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            protected function updateSalesCache($week, $num_cached, $dateInfo)
            {
                $class_lib = $this->class_lib;
                $dbc = $class_lib::getDB();
                $sales = $class_lib::getCache($dbc);
        Severity: Major
        Found in fannie/modules/plugins2.0/OpenBookFinancing/ObfWeeklyReport.php - About 5 hrs to fix

          Method preprocess has 147 lines of code (exceeds 25 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: Major
          Found in fannie/modules/plugins2.0/CoopCred/membership/CoopCredJiggerTool.php - About 5 hrs to fix

            Method preprocess has 147 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function preprocess()
                {
                    $col_select = \FormLib::get_form_value('cs','');
                    $this->finishPreviewOpts();
            
            
            Severity: Major
            Found in fannie/classlib2.0/FannieUploadPage.php - About 5 hrs to fix

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

                  public function format(array $row)
                  {
                      switch($row['upc']) {
                          case 'TOTAL':
                              $this->bold = true;
              fannie/modules/plugins2.0/EReceipt/Format/TotalEReceiptFormat.php on lines 42..64

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

              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

                  public function format(array $row)
                  {
                      switch($row['upc']) {
                          case 'TOTAL':
                              $this->bold = true;
              pos/is4c-nf/lib/ReceiptBuilding/Format/TotalReceiptFormat.php on lines 39..61

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

              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 loader(){
                  $('#display').html('');
                  var date1 = $('#startDate').val();
                  var date2 = $('#endDate').val();
                  var store = $('select[name=store]').val();
              Severity: Major
              Found in fannie/modules/plugins2.0/OverShortTools/js/countV2.js and 1 other location - About 5 hrs to fix
              fannie/modules/plugins2.0/OverShortTools/js/count.js on lines 1..14

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

              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 saveQty(new_qty,tid){
                  var oid = $('#orderID').val();
                  $.ajax({
                  url: 'ajax-calls.php',
                  type: 'post',
              Severity: Major
              Found in fannie/ordering/view.js and 1 other location - About 5 hrs to fix
              fannie/ordering/view.js on lines 165..178

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

              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 saveUnit(new_unit,tid){
                  var oid = $('#orderID').val();
                  $.ajax({
                  url: 'ajax-calls.php',
                  type: 'post',
              Severity: Major
              Found in fannie/ordering/view.js and 1 other location - About 5 hrs to fix
              fannie/ordering/view.js on lines 151..164

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

              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 loader(){
                  $('#display').html('');
                  var date1 = $('#startDate').val();
                  var date2 = $('#endDate').val();
                  var store = $('select[name=store]').val();
              Severity: Major
              Found in fannie/modules/plugins2.0/OverShortTools/js/count.js and 1 other location - About 5 hrs to fix
              fannie/modules/plugins2.0/OverShortTools/js/countV2.js on lines 1..14

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

              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