CORE-POS/IS4C

View on GitHub

Showing 8,683 of 8,684 total issues

File UpdateUploadPage.php has 350 lines of code (exceeds 250 allowed). Consider refactoring.
Open

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

    Copyright 2013 Whole Foods Co-op

Severity: Minor
Found in fannie/item/vendors/UpdateUploadPage.php - About 4 hrs to fix

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

                } else {
                    fprintf($csv, '%.2f%s', $row['special_price'], $sep);
                    fwrite($csv, date('m/d/Y', strtotime($row['start_date'])) . $sep);
                    $ts = strtotime($row['end_date']);
                    $next = mktime(0,0,0, date('n',$ts), date('j',$ts)+1, date('Y', $ts));
    Severity: Major
    Found in fannie/modules/plugins2.0/InstaCart/InstaFileV3.php and 1 other location - About 4 hrs to fix
    fannie/modules/plugins2.0/InstaCart/InstaFileV3.php on lines 236..250

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

    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 ($row['special_price'] != 0 && $row['special_price'] < $row['normal_price'] && $row['datedSigns'] && $row['specialpricemethod'] == 0 && $row['discounttype'] == 1 && $this->dbc->getValue($saleP, array($row['upc']))) {
                    fprintf($csv, '%.2f%s', $row['special_price'], $sep);
                    fwrite($csv, date('m/d/Y', strtotime($row['start_date'])) . $sep);
                    $ts = strtotime($row['end_date']);
                    $next = mktime(0,0,0, date('n',$ts), date('j',$ts)+1, date('Y', $ts));
    Severity: Major
    Found in fannie/modules/plugins2.0/InstaCart/InstaFileV3.php and 1 other location - About 4 hrs to fix
    fannie/modules/plugins2.0/InstaCart/InstaFileV3.php on lines 244..250

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

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

        public function potentialItems($wicData)
        {
            $ret = "";
            $categories = array();
            foreach ($wicData as $balanceRecord) {
    Severity: Major
    Found in pos/is4c-nf/lib/ReceiptBuilding/Messages/WicReceiptMessage.php - About 4 hrs to fix

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

          function process_file($linedata, $indexes)
          {
              $dbc = $this->connection;
              $dbc->selectDB($this->config->get('OP_DB'));
              $idP = $dbc->prepare("
      Severity: Major
      Found in fannie/batches/UNFI/load-classes/GardenOfLifeUploadPage.php - About 4 hrs to fix

        Method fetch_report_data has 109 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/ChartOfAccounts/ChartOfAccountsReport.php - About 4 hrs to fix

          Method get_data_view has 109 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function get_data_view()
              {
                  $dbc = Fanniedb::get($this->config->get('op_db'));
          
                  $storeID = FormLib::get('store', false);
          Severity: Major
          Found in fannie/admin/labels/MovementTagTracker.php - About 4 hrs to fix

            Method post_printFY_handler has 109 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                function post_printFY_handler()
                {
                    global $FANNIE_PLUGIN_SETTINGS, $FANNIE_OP_DB;
                    $dbc = FannieDB::get($FANNIE_PLUGIN_SETTINGS['GiveUsMoneyDB']);
                    if (!class_exists('FPDF')) {
            Severity: Major
            Found in fannie/modules/plugins2.0/GiveUsMoneyPlugin/GumIssueDividendPage.php - About 4 hrs to fix

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

                  function body_content(){
                      ob_start();
                      $elem = '#upc_in';
                      $this->add_onload_command('$(\'#upc_in\').focus();');
                      ?>
              Severity: Major
              Found in fannie/modules/plugins2.0/ShelfAudit/SaOrderingPage.php - About 4 hrs to fix

                File ShrinkTool.php has 347 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                <?php
                /*******************************************************************************
                
                    Copyright 2013 Whole Foods Community Co-op
                
                
                Severity: Minor
                Found in fannie/item/shrink/ShrinkTool.php - About 4 hrs to fix

                  Method prepareDataCapAuth has 108 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function prepareDataCapAuth($type, $amount, $prompt=false)
                      {
                          $request = new PaycardRequest($this->refnum($this->conf->get('paycard_id')), PaycardLib::paycard_db());
                          $request->setProcessor($this->proc_name);
                          $tranCode = $amount > 0 ? 'Sale' : 'Return';
                  Severity: Major
                  Found in pos/is4c-nf/plugins/Paycards/MercuryDC.php - About 4 hrs to fix

                    Method cleanup has 108 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function cleanup($json)
                        {
                            switch ($this->conf->get("paycard_mode")) {
                                case PaycardLib::PAYCARD_MODE_ADDVALUE:
                                case PaycardLib::PAYCARD_MODE_ACTIVATE:
                    Severity: Major
                    Found in pos/is4c-nf/plugins/Paycards/MercuryE2E.php - About 4 hrs to fix

                      Method sendVoid has 108 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          private function sendVoid($domain="w1.mercurypay.com")
                          {
                              // initialize
                              $dbTrans = Database::tDataConnect();
                              if (!$dbTrans) {
                      Severity: Major
                      Found in pos/is4c-nf/plugins/Paycards/MercuryGift.php - About 4 hrs to fix

                        Method programOK has 108 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            static public function programOK($pKey='', $conn='') 
                            {
                                global $CORE_LOCAL;
                        
                                if (!$CORE_LOCAL->get("memberID")) {
                        Severity: Major
                        Found in pos/is4c-nf/plugins/CoopCred/CoopCredLib.php - About 4 hrs to fix

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

                              function body_content()
                              {
                                  global $FANNIE_ROOT, $FANNIE_URL;
                                  $ret = '';
                          
                          
                          Severity: Major
                          Found in fannie/cron/management/CronManagementPage.php - About 4 hrs to fix

                            Method css_content has 108 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                public function css_content()
                                {
                                    return <<<HTML
                                    span.grey {
                                        color: grey;
                            Severity: Major
                            Found in fannie/batches/UNFI/VPBPIV.php - About 4 hrs to fix

                              Method css_content has 108 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  public function css_content()
                                  {
                                      return <<<HTML
                                      span.grey {
                                          color: grey;
                              Severity: Major
                              Found in fannie/batches/UNFI/VPBPIII.php - About 4 hrs to fix

                                Method WFC_Windows has 108 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                function WFC_Windows($data,$offset=0){
                                
                                $pdf=new WFC_Windows_PDF('P','mm','Letter'); //start new instance of PDF
                                $pdf->Open(); //open new PDF Document
                                $pdf->SetTopMargin(40);  //Set top margin of the page
                                Severity: Major
                                Found in fannie/admin/labels/pdf_layouts/WFC_Windows.php - About 4 hrs to fix

                                  Method ValidateCurrentToken has 108 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                          private void ValidateCurrentToken()
                                          {
                                              // first time validate has been called. build model
                                              if (_model == null)
                                              {

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

                                        if (count($lines) > 1) {
                                            $pdf->SetXY($x,$y+13);
                                            $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/New_WFC_Deli_Regular.php and 1 other location - About 4 hrs to fix
                                    fannie/admin/labels/pdf_layouts/New_WFC_Deli_Narrow.php on lines 306..314

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

                                    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