CORE-POS/IS4C

View on GitHub

Showing 8,297 of 8,298 total issues

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

    if ($lineCount == 2) {
        $pdf->SetXY($x,$y+12);
        $pdf->Cell($width, 5, $lines[0], 0, 1, 'C', true); 
        $pdf->SetXY($x, $y+19);
        $pdf->Cell($width, 5, $lines[1], 0, 1, 'C', true); 
Severity: Major
Found in fannie/admin/labels/pdf_layouts/WFC_Dark_ServiceCase_12UP.php and 3 other locations - About 2 days to fix
fannie/admin/labels/pdf_layouts/WFC_Dark_HFM_12UP.php on lines 230..254
fannie/admin/labels/pdf_layouts/WFC_Dark_ServiceCase_12UP.php on lines 178..202
fannie/admin/labels/pdf_layouts/WFC_Dark_Simple_24UP.php on lines 231..255

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

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

    if ($lineCount == 2) {
        $pdf->SetXY($x,$y+12);
        $pdf->Cell($width, 5, $lines[0], 0, 1, 'C', true); 
        $pdf->SetXY($x, $y+19);
        $pdf->Cell($width, 5, $lines[1], 0, 1, 'C', true); 
Severity: Major
Found in fannie/admin/labels/pdf_layouts/WFC_Dark_ServiceCase_12UP.php and 3 other locations - About 2 days to fix
fannie/admin/labels/pdf_layouts/WFC_Dark_HFM_12UP.php on lines 230..254
fannie/admin/labels/pdf_layouts/WFC_Dark_ServiceCase_12UP.php on lines 276..300
fannie/admin/labels/pdf_layouts/WFC_Dark_Simple_24UP.php on lines 231..255

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

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

    if ($lineCount == 2) {
        $pdf->SetXY($x,$y+12);
        $pdf->Cell($width, 5, $lines[0], 0, 1, 'C', true); 
        $pdf->SetXY($x, $y+19);
        $pdf->Cell($width, 5, $lines[1], 0, 1, 'C', true); 
Severity: Major
Found in fannie/admin/labels/pdf_layouts/WFC_Dark_Simple_24UP.php and 3 other locations - About 2 days to fix
fannie/admin/labels/pdf_layouts/WFC_Dark_HFM_12UP.php on lines 230..254
fannie/admin/labels/pdf_layouts/WFC_Dark_ServiceCase_12UP.php on lines 178..202
fannie/admin/labels/pdf_layouts/WFC_Dark_ServiceCase_12UP.php on lines 276..300

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

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

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

    Copyright 2014 Whole Foods Co-op

Severity: Major
Found in fannie/modules/plugins2.0/OpenBookFinancing/ObfWeeklyReport.php - About 2 days to fix

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

        private function prepsTable($store)
        {
            $res = $this->connection->query("
                SELECT *
                FROM RpPreps AS g
    Severity: Major
    Found in fannie/modules/plugins2.0/RP/RpDailyPage.php and 1 other location - About 2 days to fix
    fannie/modules/plugins2.0/RP/RpDailyPage.php on lines 326..390

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

    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

        private function greensTable($store)
        {
            $res = $this->connection->query("
                SELECT *
                FROM RpGreens AS g
    Severity: Major
    Found in fannie/modules/plugins2.0/RP/RpDailyPage.php and 1 other location - About 2 days to fix
    fannie/modules/plugins2.0/RP/RpDailyPage.php on lines 392..456

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

    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

    function tablify($data,$col_order,$col_headers,$formatting,$sums=-1,$sum_cols=array()){
        $sum = 0;
        $ret = "";
        
        $ret .= "<table cellspacing=0 cellpadding=4 border=1><tr>";
    Severity: Major
    Found in fannie/reports/Store-Specific/WFC/EOM-Nabs/anydate.php and 1 other location - About 2 days to fix
    fannie/reports/Store-Specific/WFC/EOM-Nabs/index.php on lines 248..307

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

    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

    function tablify($data,$col_order,$col_headers,$formatting,$sums=-1,$sum_cols=array()){
        $sum = 0;
        $ret = "";
        
        $ret .= "<table cellspacing=0 cellpadding=4 border=1><tr>";
    Severity: Major
    Found in fannie/reports/Store-Specific/WFC/EOM-Nabs/index.php and 1 other location - About 2 days to fix
    fannie/reports/Store-Specific/WFC/EOM-Nabs/anydate.php on lines 214..273

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

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

        function get_data(){
            global $FANNIE_OP_DB;
            $dlog = DTransactionsModel::selectDlog($this->startDate, $this->endDate);
            $dtrans = DTransactionsModel::selectDtrans($this->startDate, $this->endDate);
            $mc = FormLib::get('mercato');
    Severity: Major
    Found in fannie/modules/plugins2.0/OverShortTools/OverShortMAS.php - About 2 days to fix

      File JsonWriter.cs has 1038 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      using System;
      using System.Collections.Generic;
      using System.IO;
      #if !(NET20 || NET35 || PORTABLE40 || PORTABLE)
      using System.Numerics;

        Method get_view has 520 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            protected function get_view()
            {
                $this->addScript('rpDual.js?date=20230801');
                $this->addOnloadCommand('rpOrder.initAutoCompletes();');
                $store = FormLib::get('store');
        Severity: Major
        Found in fannie/modules/plugins2.0/RP/RpDualPage.php - About 2 days to fix

          File CoopCredProgramEditor.php has 1033 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          <?php
          /*******************************************************************************
          
              Copyright 2009,2013 Whole Foods Co-op
              Copyright 2014 West End Food Co-op, Toronto
          Severity: Major
          Found in fannie/modules/plugins2.0/CoopCred/programs/CoopCredProgramEditor.php - About 2 days to fix

            Function rpOrder has 518 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            var rpOrder = (function ($) {
            
                var mod = {};
                var state = {
                    'retention': 60,
            Severity: Major
            Found in fannie/modules/plugins2.0/RP/rpDirect.js - About 2 days to fix

              Function get_id_view has a Cognitive Complexity of 127 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function get_id_view()
                  {
                      $ret = '';
                      $ret .= '
              
              

              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

                  public function entered($validate,$json)
                  {
                      try {
                          $this->dialogs->enabledCheck();
              
              
              Severity: Major
              Found in pos/is4c-nf/plugins/Paycards/ValueLink.php and 1 other location - About 2 days to fix
              pos/is4c-nf/plugins/Paycards/MercuryGift.php on lines 76..136

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

              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 entered($validate,$json)
                  {
                      try {
                          $this->dialogs->enabledCheck();
              
              
              Severity: Major
              Found in pos/is4c-nf/plugins/Paycards/MercuryGift.php and 1 other location - About 2 days to fix
              pos/is4c-nf/plugins/Paycards/ValueLink.php on lines 69..129

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

              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

              <?php
              
              include(__DIR__ . '/../../../../../config.php');
              if (!class_exists('FannieAPI')) {
                  include(dirname(__FILE__).'/../../../../../classlib2.0/FannieAPI.php');
              fannie/modules/plugins2.0/CoreWarehouse/reports/EOMLayers/EOMCountLayer.php on lines 1..66

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

              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

              <?php
              
              include(__DIR__ . '/../../../../../config.php');
              if (!class_exists('FannieAPI')) {
                  include(dirname(__FILE__).'/../../../../../classlib2.0/FannieAPI.php');
              fannie/modules/plugins2.0/CoreWarehouse/reports/EOMLayers/EOMDiscountLayer.php on lines 1..66

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

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

              var rpOrder = (function ($) {
              
                  var mod = {};
                  var state = {
                      'retention': 60,
              Severity: Minor
              Found in fannie/modules/plugins2.0/RP/rpOrder.js - About 2 days 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_Hybrid has a Cognitive Complexity of 123 (exceeds 5 allowed). Consider refactoring.
              Open

              function WFC_Hybrid($data,$offset=0){
              
              $pdf=new WFC_Hybrid_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_Hybrid.php - About 2 days 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