CORE-POS/IS4C

View on GitHub

Showing 8,683 of 8,684 total issues

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

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

    Copyright 2014 Whole Foods Co-op

fannie/modules/plugins2.0/OpenBookFinancingV2/OpenBookFinancingV2.php on lines 1..68

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

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

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

    Copyright 2013 Whole Foods Co-op

Severity: Minor
Found in fannie/reports/StoreSummary/StoreSummaryReport.php - About 6 hrs to fix

    Method fetch_report_data has 170 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        function fetch_report_data()
        {
            $dbc = $this->connection;
            $dbc->setDefaultDB($this->config->get('OP_DB'));
            $d1 = $this->form->date1;
    Severity: Major
    Found in fannie/reports/GeneralRange/GeneralRangeReport.php - About 6 hrs to fix

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

          protected function get_view()
          {
              $authorized = false;
              if (FannieAuth::validateUserQuiet('ordering_edit')) {
                  $authorized = true;
      Severity: Major
      Found in fannie/modules/plugins2.0/DeliInventory/DIPage2.php - About 6 hrs to fix

        Method checkQualifications has 169 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function checkQualifications($coupID, $quiet=false)
            {
                $infoW = $this->lookupCoupon($coupID);
                if ($infoW === false) {
                    return $this->errorOrQuiet(_("coupon not found"), $quiet);
        Severity: Major
        Found in pos/is4c-nf/lib/Scanning/SpecialUPCs/HouseCoupon.php - About 6 hrs to fix

          Method body_content has 169 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              function body_content()
              {
                  global $FANNIE_OP_DB, $FANNIE_TRANS_DB, $FANNIE_COOP_ID;
                  $dbc = $this->connection;
                  $dbc->selectDB($this->config->get('OP_DB'));
          Severity: Major
          Found in fannie/reports/SalesAndTaxToday/SalesAndTaxTodayReport.php - About 6 hrs to fix

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

                public function get_id_view()
                {
                    $settings = $this->config->get('PLUGIN_SETTINGS');
                    $dbc = FannieDB::get($settings['WarehouseDatabase']);
            
            

              Function body_content has a Cognitive Complexity of 44 (exceeds 5 allowed). Consider refactoring.
              Open

                  function body_content(){
                      global $FANNIE_OP_DB, $FANNIE_PLUGIN_SETTINGS;
                      $ts_db = FannieDB::get($FANNIE_PLUGIN_SETTINGS['TimesheetDatabase']);
              
                      include('./includes/header.html');
              Severity: Minor
              Found in fannie/modules/plugins2.0/TimesheetPlugin/TsWagesReport.php - About 6 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 getTopImage has a Cognitive Complexity of 44 (exceeds 5 allowed). Consider refactoring.
              Open

                  private function getTopImage($item)
                  {
                      // Manual Signs Page && smartType override checked takes precedence
                      if (isset($item['smartType']) && $item['smartType'] == 'CoopDeals') {
                          return __DIR__ . '/noauto/images/codeals_top_12.png';
              Severity: Minor
              Found in fannie/modules/plugins2.0/CoopDealsSigns/LegacySmartSigns16UpP.php - About 6 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 drawPage has a Cognitive Complexity of 44 (exceeds 5 allowed). Consider refactoring.
              Open

                  function drawPage()
                  {
                      if (!($this->config instanceof FannieConfig)) {
                          $this->config = FannieConfig::factory();
                      }
              Severity: Minor
              Found in fannie/classlib2.0/FannieReportPage.php - About 6 hrs to fix

              Cognitive Complexity

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

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

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

              Further reading

              Method load has 168 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function load($filename, $filedata=null) 
                  {
                      $data = "";
                      if ($filename === true) {
                          $data = $filedata;
              Severity: Major
              Found in pos/is4c-nf/lib/Bitmap.php - About 6 hrs to fix

                Method run has 168 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function run($args=array())
                    {
                        global $FANNIE_URL;
                        $data = array();
                        $action = FormLib::get_form_value('action');
                Severity: Major
                Found in fannie/modules/plugins2.0/CalendarPlugin/CalendarAjax.php - About 6 hrs to fix

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

                      function preprocess(){
                  
                          global $FANNIE_CORRECTION_CASHIER, $FANNIE_CORRECTION_LANE, $FANNIE_CORRECTION_DEPT;
                          global $FANNIE_PLUGIN_LIST,$FANNIE_PLUGIN_SETTINGS,$FANNIE_OP_DB;
                  
                  
                  Severity: Major
                  Found in fannie/modules/plugins2.0/CoopCred/membership/CoopCredInputTool.php - About 6 hrs to fix

                    Method settingChange has 167 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function settingChange() {
                            global $FANNIE_PLUGIN_SETTINGS;
                    
                            $db_name = $FANNIE_PLUGIN_SETTINGS['GiveUsMoneyDB'];
                            if (empty($db_name)) return;
                    Severity: Major
                    Found in fannie/modules/plugins2.0/GiveUsMoneyPlugin/GiveUsMoneyPlugin.php - About 6 hrs to fix

                      Method addItem has 166 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public function addItem(array $row, $quantity, $priceObj)
                          {
                              if ($quantity == 0) return false;
                      
                              $pricing = $priceObj->priceInfo($row,$quantity);
                      Severity: Major
                      Found in pos/is4c-nf/lib/Scanning/PriceMethods/QttyEnforcedGroupPM.php - About 6 hrs to fix

                        File rpOrder.js has 442 lines of code (exceeds 250 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 6 hrs to fix

                          File WFC_Hybrid.php has 442 lines of code (exceeds 250 allowed). Consider refactoring.
                          Open

                          <?php
                          if (!class_exists('FpdfWithBarcode')) {
                              include(dirname(__FILE__) . '/../FpdfWithBarcode.php');
                          }
                          if (!class_exists('FpdfLib')) {
                          Severity: Minor
                          Found in fannie/admin/labels/pdf_layouts/WFC_Hybrid.php - About 6 hrs to fix

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

                                            if (isset($lines[$i+1]) && (strlen($lines[$i]) + strlen($lines[$i+1])) < 56) {
                                                // don't columnize the amount lines
                                                if (strstr($lines[$i], 'AMOUNT') || strstr($lines[$i+1], 'AMOUNT')) {
                                                    $slip .= ReceiptLib::centerString($lines[$i]) . "\n";
                                                } elseif (strstr($lines[$i], 'TOTAL') || strstr($lines[$i+1], 'TOTAL')) {
                            pos/is4c-nf/lib/ReceiptBuilding/Messages/CCReceiptMessage.php on lines 131..152

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

                            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

                                                if (isset($lines[$i+1]) && (strlen($lines[$i]) + strlen($lines[$i+1])) < 56) {
                                                    // don't columnize the amount lines
                                                    if (strstr($lines[$i], 'AMOUNT') || strstr($lines[$i+1], 'AMOUNT')) {
                                                        $slip .= ReceiptLib::centerString($lines[$i]) . "\n";
                                                    } elseif (strstr($lines[$i], 'TOTAL') || strstr($lines[$i+1], 'TOTAL')) {
                            pos/is4c-nf/lib/ReceiptBuilding/Messages/DeclineReceiptMessage.php on lines 69..86

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

                            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 reload($trans_db,$start_month,$start_year,$end_month=False,$end_year=False)
                                {
                                    if (!$end_month) {
                                        $end_month = $start_month;
                                    }
                            fannie/modules/plugins2.0/CoreWarehouse/models/SmoothedModel.php on lines 39..53
                            fannie/modules/plugins2.0/CoreWarehouse/models/WarehouseDatesModel.php on lines 48..62

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

                            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