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

    protected $columns = array(
    'empID' => array('type'=>'INT', 'primary_key'=>true),
    'periodID' => array('type'=>'INT', 'primary_key'=>true),
    'year' => array('type'=>'SMALLINT', 'index'=>true),
    'hours' => array('type'=>'DOUBLE'),
fannie/modules/plugins2.0/CoreWarehouse/models/CashierByDayModel.php on lines 32..43

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

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['discounttype'] == 1 || $w['discounttype'] == 2) {
            $ret .= '<td id="discPercent'.$w['trans_id'].'">Sale</td>';
        } else if ($w['regPrice'] != $w['total']) {
            $ret .= sprintf('<td id="discPercent%d">%d%%</td>',$w['upc'],
                round(100*(($w['regPrice']-$w['total'])/$w['regPrice'])));
Severity: Major
Found in fannie/ordering/ajax-calls.php and 1 other location - About 2 hrs to fix
fannie/ordering/ajax-calls.php on lines 1487..1494

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

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

    protected $columns = array(
    'date_id' => array('type'=>'INT', 'primary_key'=>true),
    'emp_no' => array('type'=>'SMALLINT', 'index'=>true),
    'trans_num' => array('type'=>'VARCHAR(25)', 'primary_key'=>true),
    'startTime' => array('type'=>'DATETIME'),
fannie/modules/plugins2.0/WfcHoursTracking/models/WfcHtImportedHoursDataModel.php on lines 33..44

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

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

var stChart = (function() {
    var mod = {};

    var _fontSize = 12;

Severity: Major
Found in fannie/reports/SalesToday/stChart.js - About 2 hrs to fix

    Method head_content has 74 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        function head_content()
        {
            $url = MiscLib::baseURL();
            echo '<script type="text/javascript" src="' . $url . '/js/singleSubmit.js"></script>';
            echo '<script type="text/javascript" src="../js/emv.js?date=20210325"></script>';
    Severity: Major
    Found in pos/is4c-nf/plugins/Paycards/gui/PaycardEmvWic.php - About 2 hrs to fix

      Method sendAuth has 74 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          private function sendAuth()
          {
              $this->GATEWAY = 'https://api.payeezy.com/v1/transactions';
              $this->GATEWAY = 'https://api.globalgatewaye4.firstdata.com/transaction/v32';
              if ($this->conf->get("training") == 1) {
      Severity: Major
      Found in pos/is4c-nf/plugins/Paycards/ValueLink.php - About 2 hrs to fix

        Method doc has 74 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function doc()
            {
                return '
        Use:
        WFC runs custom barcoded coupons with
        Severity: Major
        Found in pos/is4c-nf/lib/models/op/HouseCouponsModel.php - About 2 hrs to fix

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

              function process_file($linedata, $indexes)
              {
                  $dbc = $this->connection;
                  $dbc->selectDB($this->config->get('OP_DB'));
                  $this->setupTables($dbc);
          Severity: Major
          Found in fannie/batches/CAP/CoopDealsUploadPage.php - About 2 hrs to fix

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

                public function fetch_report_data()
                {        
                    try {
                        $upc = $this->form->upc;
                    } catch (Exception $ex) {
            Severity: Major
            Found in fannie/reports/TrackChange/TrackChange.php - About 2 hrs to fix

              File AuthUsersPage.php has 290 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              <?php
              /*******************************************************************************
              
                  Copyright 2009 Whole Foods Co-op
              
              
              Severity: Minor
              Found in fannie/auth/ui/AuthUsersPage.php - About 2 hrs to fix

                Method javascriptContent has 74 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function javascriptContent()
                    {
                        return <<<JAVASCRIPT
                    $('textarea').each(function(){
                        var text = $(this).text();
                Severity: Major
                Found in fannie/admin/labels/SignFromSearch.php - About 2 hrs to fix

                  Method generateMirrorBulk_RepackTag has 74 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  function generateMirrorBulk_RepackTag($x, $y, $guide, $width, $height, $pdf, $row, $dbc)
                  {
                      $upc = isset($row['upc']) ? $row['upc'] : '';
                      $description = isset($row['description']) ? $row['description'] : '';
                      $brand = isset($row['brand']) ? $row['brand'] : '';
                  Severity: Major
                  Found in fannie/admin/labels/pdf_layouts/WFC_Bulk_Repack_14UP.php - About 2 hrs to fix

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

                        public function fetch_report_data()
                        {
                            $dbc = $this->connection;
                            $dbc->selectDB($this->config->get('OP_DB'));
                            $info = FormLib::standardItemFromWhere();
                    Severity: Major
                    Found in fannie/modules/plugins2.0/InstaCart/InstaCompareReport.php - About 2 hrs to fix

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

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

                        Method smoothDay has 74 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            private function smoothDay($date)
                            {
                                /**
                                 * Skip future dates to avoid piling on zero-sales days
                                 */
                        Severity: Major
                        Found in fannie/modules/plugins2.0/CoreWarehouse/models/SmoothedModel.php - About 2 hrs to fix

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

                              function preprocess(){
                          
                                  global $FANNIE_URL,$FANNIE_PLUGIN_LIST,$FANNIE_PLUGIN_SETTINGS;
                          
                                  if (!isset($FANNIE_PLUGIN_LIST) || !in_array('CoopCred', $FANNIE_PLUGIN_LIST)) {

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

                                function process_file($linedata, $indexes)
                                {
                                    $VENDOR_ID = $this->getVendorID();
                                    if ($VENDOR_ID === false) {
                                        $this->error_details = 'Cannot find vendor';
                            Severity: Major
                            Found in fannie/purchasing/importers/CpwInvoiceImport.php - About 2 hrs to fix

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

                                  function process_file($linedata, $indexes)
                                  {
                                      $dbc = $this->connection;
                                      $dbc->selectDB($this->config->get('OP_DB'));
                                      $VENDOR_ID = $this->getVendorID();
                              Severity: Major
                              Found in fannie/purchasing/importers/AlbertsInvoiceImport.php - About 2 hrs to fix

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

                                    public function get_id_view()
                                    {
                                        global $FANNIE_OP_DB;
                                        $dbc = FannieDB::get($FANNIE_OP_DB);
                                
                                
                                Severity: Major
                                Found in fannie/purchasing/PurchasingSearchPage.php - About 2 hrs to fix

                                  Method showEditForm has 74 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                      function showEditForm($memNum, $country="US")
                                      {
                                          $account = self::getAccount();
                                          $primary = array();
                                          foreach ($account['customers'] as $c) {
                                  Severity: Major
                                  Found in fannie/mem/modules/ContactInfo.php - About 2 hrs to fix
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language