CORE-POS/IS4C

View on GitHub

Showing 8,297 of 8,298 total issues

File MemberREST.php has 1138 lines of code (exceeds 250 allowed). Consider refactoring.
Open

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

    Copyright 2010 Whole Foods Co-op, Duluth, MN

Severity: Major
Found in fannie/classlib2.0/member/MemberREST.php - About 2 days to fix

    Function rpOrder has a Cognitive Complexity of 143 (exceeds 5 allowed). Consider refactoring.
    Open

    var rpOrder = (function ($) {
    
        var mod = {};
        var state = {
            'retention': 60,
    Severity: Minor
    Found in fannie/modules/plugins2.0/RP/rpDual.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

    File FannieSignage.php has 1134 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    /*******************************************************************************
    
        Copyright 2014 Whole Foods Co-op, Duluth, MN
    
    
    Severity: Major
    Found in fannie/classlib2.0/item/FannieSignage.php - About 2 days to fix

      File SQLManager.php has 1127 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      <?php
      /*******************************************************************************
      
          Copyright 2009 Whole Foods Co-op
      
      
      Severity: Major
      Found in common/SQLManager.php - About 2 days to fix

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

            mod.placeOrder = function(elem) {
                var id = encodeURIComponent($(elem).val());
                var qty = $(elem).closest('tr').find('input.orderAmt').val();
                if ($(elem).prop('checked') && qty) {
                    $.ajax({
        Severity: Major
        Found in fannie/modules/plugins2.0/RP/rpDual.js and 1 other location - About 2 days to fix
        fannie/modules/plugins2.0/RP/rpOrder.js on lines 406..444

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

        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.placeOrder = function(elem) {
                var id = encodeURIComponent($(elem).val());
                var qty = $(elem).closest('tr').find('input.orderAmt').val();
                if ($(elem).prop('checked') && qty) {
                    $.ajax({
        Severity: Major
        Found in fannie/modules/plugins2.0/RP/rpOrder.js and 1 other location - About 2 days to fix
        fannie/modules/plugins2.0/RP/rpDual.js on lines 460..498

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

        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 ($w['store_id'] == '50' && $w['salesCode'] == '41205') {
                        $amts = array(
                            1 => 0,
                            2 => 0,
                            '??' => 0,
        Severity: Major
        Found in fannie/modules/plugins2.0/OverShortTools/OverShortMAS.php and 1 other location - About 2 days to fix
        fannie/modules/plugins2.0/OverShortTools/OverShortMAS.php on lines 341..403

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

        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 ($w['store_id'] == '50' && $w['salesCode'] == '41600') {
                        $amts = array(
                            1 => 0,
                            2 => 0,
                            '??' => 0,
        Severity: Major
        Found in fannie/modules/plugins2.0/OverShortTools/OverShortMAS.php and 1 other location - About 2 days to fix
        fannie/modules/plugins2.0/OverShortTools/OverShortMAS.php on lines 278..340

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

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

            public function preprocess()
            {
                $col_select = \FormLib::get_form_value('cs','');
                $this->finishPreviewOpts();
        
        
        Severity: Minor
        Found in fannie/classlib2.0/FannieUploadPage.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

        File BasicModel.php has 1106 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        <?php
        /*******************************************************************************
        
            Copyright 2013 Whole Foods Co-op
        
        
        Severity: Major
        Found in common/BasicModel.php - About 2 days to fix

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

                  foreach ($trans as $row) {
                      $cardNo = $row["card_no"];
          
                      if ($row["trans_type"] ==  "T"){
                          if ($row["description"] == "Change")
          Severity: Major
          Found in pos/is4c-nf/lib/Undo.php and 1 other location - About 2 days to fix
          pos/is4c-nf/gui-modules/undo.php on lines 173..212

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

          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 WFC_New_Produce_Mockup($data,$offset=0,$showPrice=0)
          {
              $dbc = FannieDB::get(FannieConfig::config('OP_DB'));
              $pdf = new WFC_New_Produce_Mockup_PDF('L','mm','Letter');
              $pdf->AddPage();
          Severity: Major
          Found in fannie/admin/labels/pdf_layouts/WFC_New_Produce_Mockup.php and 1 other location - About 2 days to fix
          fannie/admin/labels/pdf_layouts/WFC_Produce_SmartSigns.php on lines 28..80

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

          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

                      foreach ($trans as $row) {
                          $cardNo = $row["card_no"];
          
                          if ($row["trans_type"] ==  "T"){
                              if ($row["description"] == "Change")
          Severity: Major
          Found in pos/is4c-nf/gui-modules/undo.php and 1 other location - About 2 days to fix
          pos/is4c-nf/lib/Undo.php on lines 75..114

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

          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 WFC_Produce_SmartSigns($data,$offset=0,$showPrice=0)
          {
              $dbc = FannieDB::get(FannieConfig::config('OP_DB'));
              $pdf = new WFC_Produce_SmartSigns_PDF('L','mm','Letter');
              $pdf->AddPage();
          Severity: Major
          Found in fannie/admin/labels/pdf_layouts/WFC_Produce_SmartSigns.php and 1 other location - About 2 days to fix
          fannie/admin/labels/pdf_layouts/WFC_New_Produce_Mockup.php on lines 28..80

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

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

              public function __construct($custdata, $meminfo, $tax_id, $tax_year, $fields, $account_number='')
              {
                  global $FANNIE_PLUGIN_SETTINGS;
                  $dbc = FannieDB::get($FANNIE_PLUGIN_SETTINGS['GiveUsMoneyDB']);
                  $settings = new GumSettingsModel($dbc);
          fannie/modules/plugins2.0/GiveUsMoneyPlugin/GumTaxDividendFormTemplate.php on lines 37..96
          fannie/modules/plugins2.0/GiveUsMoneyPlugin/GumTaxFormTemplate.php on lines 37..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 540.

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

              public function __construct($custdata, $meminfo, $tax_id, $tax_year, $fields, $account_number='')
              {
                  global $FANNIE_PLUGIN_SETTINGS;
                  $dbc = FannieDB::get($FANNIE_PLUGIN_SETTINGS['GiveUsMoneyDB']);
                  $settings = new GumSettingsModel($dbc);
          fannie/modules/plugins2.0/GiveUsMoneyPlugin/GumTaxDividendFormTemplate.php on lines 37..96
          fannie/modules/plugins2.0/GiveUsMoneyPlugin/GumTaxMiscFormTemplate.php on lines 37..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 540.

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

              public function __construct($custdata, $meminfo, $tax_id, $tax_year, $fields, $account_number='')
              {
                  global $FANNIE_PLUGIN_SETTINGS;
                  $dbc = FannieDB::get($FANNIE_PLUGIN_SETTINGS['GiveUsMoneyDB']);
                  $settings = new GumSettingsModel($dbc);
          fannie/modules/plugins2.0/GiveUsMoneyPlugin/GumTaxFormTemplate.php on lines 37..96
          fannie/modules/plugins2.0/GiveUsMoneyPlugin/GumTaxMiscFormTemplate.php on lines 37..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 540.

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

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

            Function get_id_view has a Cognitive Complexity of 136 (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 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_HFM_12UP.php and 3 other locations - About 2 days to fix
            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
            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

            Severity
            Category
            Status
            Source
            Language