CORE-POS/IS4C

View on GitHub

Showing 8,683 of 8,684 total issues

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

function resumInputs(rowname){
    var sum = 0;

    $('.denom').each(function(){
        denom = $(this).val();
Severity: Major
Found in fannie/modules/plugins2.0/OverShortTools/js/countV2.js and 4 other locations - About 4 hrs to fix
fannie/modules/plugins2.0/OverShortTools/js/count.js on lines 196..208
fannie/modules/plugins2.0/OverShortTools/js/countV2.js on lines 171..181
fannie/modules/plugins2.0/OverShortTools/js/countV3.js on lines 160..172
fannie/modules/plugins2.0/OverShortTools/js/countV3.js on lines 174..184

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

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

function resumRow(rowname){
    var sum = 0;
    $('.denom').each(function(){
        denom = $(this).val();
        var elem = document.getElementById(rowname+denom);
Severity: Major
Found in fannie/modules/plugins2.0/OverShortTools/js/countV2.js and 4 other locations - About 4 hrs to fix
fannie/modules/plugins2.0/OverShortTools/js/count.js on lines 196..208
fannie/modules/plugins2.0/OverShortTools/js/countV2.js on lines 157..169
fannie/modules/plugins2.0/OverShortTools/js/countV3.js on lines 160..172
fannie/modules/plugins2.0/OverShortTools/js/countV3.js on lines 174..184

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

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

function resumRow(rowname){
    var sum = 0;
    $('.denom').each(function(){
        denom = $(this).val();
        var elem = document.getElementById(rowname+denom);
Severity: Major
Found in fannie/modules/plugins2.0/OverShortTools/js/countV3.js and 4 other locations - About 4 hrs to fix
fannie/modules/plugins2.0/OverShortTools/js/count.js on lines 196..208
fannie/modules/plugins2.0/OverShortTools/js/countV2.js on lines 157..169
fannie/modules/plugins2.0/OverShortTools/js/countV2.js on lines 171..181
fannie/modules/plugins2.0/OverShortTools/js/countV3.js on lines 160..172

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

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

function resumInputs(rowname){
    var sum = 0;

    $('.denom').each(function(){
        denom = $(this).val();
Severity: Major
Found in fannie/modules/plugins2.0/OverShortTools/js/count.js and 4 other locations - About 4 hrs to fix
fannie/modules/plugins2.0/OverShortTools/js/countV2.js on lines 157..169
fannie/modules/plugins2.0/OverShortTools/js/countV2.js on lines 171..181
fannie/modules/plugins2.0/OverShortTools/js/countV3.js on lines 160..172
fannie/modules/plugins2.0/OverShortTools/js/countV3.js on lines 174..184

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

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

function resumInputs(rowname){
    var sum = 0;

    $('.denom').each(function(){
        denom = $(this).val();
Severity: Major
Found in fannie/modules/plugins2.0/OverShortTools/js/countV3.js and 4 other locations - About 4 hrs to fix
fannie/modules/plugins2.0/OverShortTools/js/count.js on lines 196..208
fannie/modules/plugins2.0/OverShortTools/js/countV2.js on lines 157..169
fannie/modules/plugins2.0/OverShortTools/js/countV2.js on lines 171..181
fannie/modules/plugins2.0/OverShortTools/js/countV3.js on lines 174..184

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

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

    while($row = $dbc->fetch_row($costsR)){
        if ($curSuper != $row[3]){
            $curSuper = $row[3];
        }
        if (!isset($supers[$curSuper]))
fannie/reports/Store-Specific/WEFC_Toronto/OntarioTaxes/index.php on lines 144..154

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

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 get_id_view()
    {
        $table = $this->getTable();
        $td = $table;
        $superID = FormLib::get('super', -1);
Severity: Major
Found in fannie/batches/UNFI/VPBPIV.php and 1 other location - About 4 hrs to fix
fannie/batches/UNFI/VPBPV.php on lines 220..441

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

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

    while($row = $dbc->fetch_row($salesR)){
        if ($curSuper != $row[3]){
            $curSuper = $row[3];
        }
        if (!isset($supers[$curSuper]))
fannie/reports/Store-Specific/WEFC_Toronto/GeneralCosts/index.php on lines 175..185

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

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 get_id_view()
    {
        $table = $this->getTable();
        $td = $table;
        $superID = FormLib::get('super', -1);
Severity: Major
Found in fannie/batches/UNFI/VPBPV.php and 1 other location - About 4 hrs to fix
fannie/batches/UNFI/VPBPIV.php on lines 213..434

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

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

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

    Copyright 2013 Whole Foods Co-op

Severity: Minor
Found in fannie/cron/tasks/ProductSummarizeLastQuarter.php - About 4 hrs to fix

    File InstallProductsPage.php has 372 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    /*******************************************************************************
    
        Copyright 2011 Whole Foods Co-op
    
    
    Severity: Minor
    Found in fannie/install/InstallProductsPage.php - About 4 hrs to fix

      File BrowseVendorItems.php has 372 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      <?php
      /*******************************************************************************
      
          Copyright 2009 Whole Foods Co-op
      
      
      Severity: Minor
      Found in fannie/item/vendors/BrowseVendorItems.php - About 4 hrs to fix

        Method parse has 123 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function parse($str)
            {
                $ret = $this->default_json();
                if ($this->conf->get("ttlflag") != 1 && substr($str, 0, 9) !== 'PVDATACAP') { // must subtotal before running card
                    $ret['output'] = PaycardLib::paycardMsgBox("No Total",
        Severity: Major
        Found in pos/is4c-nf/plugins/Paycards/lib/PaycardDatacapParser.php - About 4 hrs to fix

          Method process_file has 123 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function process_file($linedata, $indexes)
              {
                  global $FANNIE_OP_DB;
                  $dbc = FannieDB::get($FANNIE_OP_DB);
          
          
          Severity: Major
          Found in fannie/item/vendors/DefaultUploadPage.php - About 4 hrs to fix

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

                public function get_id_view()
                {
                    global $FANNIE_OP_DB;
                    $dbc = FannieDB::get($FANNIE_OP_DB);
                    $this->add_onload_command("\$('#qty-field').focus();\n");
            Severity: Major
            Found in fannie/item/shrink/ShrinkTool.php - About 4 hrs to fix

              Function updateOfficeDB has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
              Open

              function updateOfficeDB($dbtype, $dryrun)
              {
                  include_once(dirname(__FILE__) . '/../fannie/classlib2.0/FannieAPI.php');
              
                  $config = FannieConfig::factory();
              Severity: Minor
              Found in scripts/updatedb.php - About 4 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 plugin_transaction_reset has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function plugin_transaction_reset(){
                      global $CORE_LOCAL;
              
                      $dbc = CoopCredLib::ccDataConnect();
                      if ($dbc === False) {
              Severity: Minor
              Found in pos/is4c-nf/plugins/CoopCred/CoopCred.php - About 4 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 fetch_report_data has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function fetch_report_data()
                  {
                      $dbc = $this->connection;
                      $dbc->selectDB($this->config->get('OP_DB'));
                      $data = array();
              Severity: Minor
              Found in fannie/reports/LocalMix/LocalMixReport.php - About 4 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 WFC_Produce has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
              Open

              function WFC_Produce($data,$offset=0){
              
              $pdf=new WFC_Produce_PDF('P','mm','Letter'); //start new instance of PDF
              $pdf->Open(); //open new PDF Document
              $pdf->setTagDate(date("m/d/Y"));
              Severity: Minor
              Found in fannie/admin/labels/pdf_layouts/WFC_Produce.php - About 4 hrs to fix

              Cognitive Complexity

              Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

              A method's cognitive complexity is based on a few simple rules:

              • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
              • Code is considered more complex for each "break in the linear flow of the code"
              • Code is considered more complex when "flow breaking structures are nested"

              Further reading

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

                  public function run()
                  {
                      global $argv, $FANNIE_OP_DB, $FANNIE_PLUGIN_SETTINGS;
                      $dbc = FannieDB::get($FANNIE_OP_DB);
                      $dateObj = new SpinsDate($FANNIE_PLUGIN_SETTINGS['SpinsOffset']);
              Severity: Minor
              Found in fannie/modules/plugins2.0/SPINS/SpinsSubmitTask.php - About 4 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