CORE-POS/IS4C

View on GitHub

Showing 8,297 of 8,298 total issues

Function preprocess has a Cognitive Complexity of 72 (exceeds 5 allowed). Consider refactoring.
Open

    function preprocess(){
        // set variable ahead of time
        // so we know if lookup found no one
        // vs. lookup didn't happen
        $this->temp_num_rows = -1;
Severity: Minor
Found in pos/is4c-nf/gui-modules/memlist_cards.php - About 1 day to fix

Cognitive Complexity

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

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

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

Further reading

Function getValue has a Cognitive Complexity of 72 (exceeds 5 allowed). Consider refactoring.
Open

    public function getValue($coupID)
    {
        $infoW = $this->lookupCoupon($coupID);
        if ($infoW === false) {
            return array('value' => 0, 'department' => 0, 'description' => '');
Severity: Minor
Found in pos/is4c-nf/lib/Scanning/SpecialUPCs/HouseCoupon.php - About 1 day to fix

Cognitive Complexity

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

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

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

Further reading

Method renderAsPDF has 284 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function renderAsPDF($pdf, $start_y)
    {
        $top_left_x = 6.35;
        $top_left_y = $start_y;
        $line_height = 5;

    Method renderAsPDF has 284 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function renderAsPDF($pdf, $start_y)
        {
            $top_left_x = 6.35;
            $top_left_y = $start_y;
            $line_height = 5;

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

          protected $columns = array(
              // FK to coop_cred.CCredPrograms
              'programID' => array('type'=>'SMALLINT(6)', 'not_null'=>True,
                  'default'=>0, 'index'=>True),
              // FK to custdata
      fannie/modules/plugins2.0/CoopCred/models/CCredMembershipsModel.php on lines 36..59

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

      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

          protected $columns = array(
              // FK to coop_cred.CCredPrograms
              'programID' => array('type'=>'SMALLINT(6)', 'not_null'=>True,
                  'default'=>0, 'index'=>True),
              // FK to custdata
      pos/is4c-nf/plugins/CoopCred/models/CCredMembershipsModel.php on lines 36..59

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

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

          public function process($filename)
          {
              $fp = fopen($filename, 'r');
              $currentOrder = array('id' => false, 'total' => 0, 'tax' => 0, 'card_no' => 11, 'memType'=>0, 'tdate' => '');
              $trans_id = 1;
      Severity: Major
      Found in fannie/modules/plugins2.0/Mercato/MercatoIntake.php - About 1 day to fix

        File OverShortMAS.php has 636 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        <?php
        /*******************************************************************************
        
            Copyright 2013 Whole Foods Co-op
        
        
        Severity: Major
        Found in fannie/modules/plugins2.0/OverShortTools/OverShortMAS.php - About 1 day to fix

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

                      $.ajax({
                          'type': 'post',
                          'data': 'id=' + id + '&qty=' + qty,
                          'dataType': 'json'
                      }).done(function (resp) {
          Severity: Major
          Found in fannie/modules/plugins2.0/RP/rpFloral.js and 1 other location - About 1 day to fix
          fannie/modules/plugins2.0/RP/rpDirect.js on lines 482..504

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

          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

                      $.ajax({
                          'type': 'post',
                          'data': 'id=' + id + '&qty=' + qty + '&farm=' + encodeURIComponent(farm),
                          'dataType': 'json'
                      }).done(function (resp) {
          Severity: Major
          Found in fannie/modules/plugins2.0/RP/rpDirect.js and 1 other location - About 1 day to fix
          fannie/modules/plugins2.0/RP/rpFloral.js on lines 285..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 260.

          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

              protected function post_view()
              {
                  $model = new RpOrderItemsModel($this->connection);
                  $model->storeID(FormLib::get('store'));
                  $model->categoryID(FormLib::get('catID'));
          Severity: Major
          Found in fannie/modules/plugins2.0/RP/RpOrderPage.php and 1 other location - About 1 day to fix
          fannie/modules/plugins2.0/RP/RpDualPage.php on lines 328..362

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

          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

              protected function post_view()
              {
                  $model = new RpOrderItemsModel($this->connection);
                  $model->storeID(FormLib::get('store'));
                  $model->categoryID(FormLib::get('catID'));
          Severity: Major
          Found in fannie/modules/plugins2.0/RP/RpDualPage.php and 1 other location - About 1 day to fix
          fannie/modules/plugins2.0/RP/RpOrderPage.php on lines 329..363

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

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

          <?php
          /*******************************************************************************
          
              Copyright 2014 Whole Foods Community Co-op
          
          
          Severity: Major
          Found in fannie/item/FloorSections/EditLocations.php - About 1 day to fix

            File JsonSerializer.cs has 633 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            using System;
            using System.Collections.Generic;
            using System.Diagnostics;
            using System.Globalization;
            using System.IO;

              Class JsonConvert has 75 methods (exceeds 20 allowed). Consider refactoring.
              Open

                  public static class JsonConvert
                  {
                      /// <summary>
                      /// Gets or sets a function that creates default <see cref="JsonSerializerSettings"/>.
                      /// Default settings are automatically used by serialization methods on <see cref="JsonConvert"/>,

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

                    protected function get_id_view()
                    {
                        $items = array(
                            293 => $this->getItems(293),
                            292 => $this->getItems(292),
                Severity: Major
                Found in fannie/item/likecodes/LikeCodeBatchPage.php - About 1 day to fix

                  Method getVendorInfo has 278 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      private function getVendorInfo($id)
                      {
                          $dbc = FannieDB::get($this->config->get('OP_DB'));
                          $ret = "";
                          $noEdit = !$this->canEdit ? 'disabled' : '';
                  Severity: Major
                  Found in fannie/item/vendors/VendorIndexPage.php - About 1 day to fix

                    Function postCustdata has a Cognitive Complexity of 70 (exceeds 5 allowed). Consider refactoring.
                    Open

                        private static function postCustdata($dbc, $id, $json)
                        {
                            $config = FannieConfig::factory();
                            $ret = array('errors' => 0, 'error-msg' => '');
                    
                    
                    Severity: Minor
                    Found in fannie/classlib2.0/member/MemberREST.php - About 1 day to fix

                    Cognitive Complexity

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

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

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

                    Further reading

                    Method ReadStringIntoBuffer has a Cognitive Complexity of 85 (exceeds 20 allowed). Consider refactoring.
                    Open

                            private void ReadStringIntoBuffer(char quote)
                            {
                                int charPos = _charPos;
                                int initialPosition = _charPos;
                                int lastWritePosition = _charPos;

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

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

                    Duplicated Code

                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                    Tuning

                    This issue has a mass of 308.

                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                    Refactorings

                    Further Reading

                    Severity
                    Category
                    Status
                    Source
                    Language