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

    public function definition()
    {
        $ar_depts = FannieConfig::config('AR_DEPARTMENTS', '');
        $ret = preg_match_all('/[0-9]+/', $ar_depts, $depts);
        if ($ret == 0) {
Severity: Major
Found in fannie/classlib2.0/data/models/trans/ArHistoryTodayModel.php and 1 other location - About 5 hrs to fix
fannie/classlib2.0/data/models/trans/StockSumTodayModel.php on lines 39..63

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

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

    public function definition()
    {
        $eq_depts = FannieConfig::config('EQUITY_DEPARTMENTS', '');
        $ret = preg_match_all('/[0-9]+/', $eq_depts, $depts);
        if ($ret == 0) {
Severity: Major
Found in fannie/classlib2.0/data/models/trans/StockSumTodayModel.php and 1 other location - About 5 hrs to fix
fannie/classlib2.0/data/models/trans/ArHistoryTodayModel.php on lines 41..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 184.

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

    protected function post_u_view()
    {
        $ret = '';
        $ret .= '<form action="' . filter_input(INPUT_SERVER, 'PHP_SELF') . '" method="post" id="signform">';
        $mods = FannieAPI::listModules('\COREPOS\Fannie\API\item\FannieSignage');
Severity: Major
Found in fannie/admin/labels/SignFromSearch.php - About 5 hrs to fix

    Method show_sheet has 126 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        function show_sheet($emp_no, $periodID){
            global $FANNIE_PLUGIN_SETTINGS, $FANNIE_OP_DB;
            $ts_db = FannieDB::get($FANNIE_PLUGIN_SETTINGS['TimesheetDatabase']);
            include ('./includes/header.html');
    
    
    Severity: Major
    Found in fannie/modules/plugins2.0/TimesheetPlugin/ViewsheetPage.php - About 5 hrs to fix

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

          function fetch_report_data()
          {
              $dbc = $this->connection;
              $dbc->selectDB($this->config->get('OP_DB'));
              $d1 = FormLib::get('date1', date('Y-m-d'));
      Severity: Major
      Found in fannie/modules/plugins2.0/OverShortTools/LaneTender/LaneTender.php - About 5 hrs to fix

        Method SerializeNode has 126 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                private void SerializeNode(JsonWriter writer, IXmlNode node, XmlNamespaceManager manager, bool writePropertyName)
                {
                    switch (node.NodeType)
                    {
                        case XmlNodeType.Document:

          File index.php has 376 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          <?php
          use COREPOS\Fannie\API\item\StandardAccounting;
          include('../../../../config.php');
          include(__DIR__ . '/../../../../classlib2.0/FannieAPI.php');
          $dbc = FannieDB::get($FANNIE_OP_DB);
          Severity: Minor
          Found in fannie/reports/Store-Specific/WFC/DailyReport/index.php - About 5 hrs to fix

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

                function preprocess()
                {
                    $this->conf = new PaycardConf();
                    $choice = FormLib::get('selectlist', false);
                    if ($choice !== false) {
            Severity: Major
            Found in pos/is4c-nf/plugins/Paycards/gui/PaycardEmvMenu.php - About 5 hrs to fix

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

                  function body_content(){
                      //Should this really be done with global?
                      //global $FANNIE_URL, $FANNIE_EQUITY_DEPARTMENTS;
                      include(dirname(__FILE__) . '/../../config.php'); 
                      ob_start();
              Severity: Major
              Found in fannie/install/sample_data/InstallSampleDataPage.php - About 5 hrs to fix

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

                    protected function get_id_view()
                    {
                        $doAvg = FormLib::get('doAvg', 1);
                        $doTop = FormLib::get('doTop', 1);
                        $ids = is_array($this->id) ? $this->id : explode("\n", $this->id);
                Severity: Major
                Found in fannie/modules/plugins2.0/CoreWarehouse/reports/CWMemberProfile.php - About 5 hrs to fix

                  ViewPurchaseOrders has 38 functions (exceeds 20 allowed). Consider refactoring.
                  Open

                  class ViewPurchaseOrders extends FannieRESTfulPage 
                  {
                      protected $header = 'Purchase Orders';
                      protected $title = 'Purchase Orders';
                  
                  
                  Severity: Minor
                  Found in fannie/purchasing/ViewPurchaseOrders.php - About 5 hrs to fix

                    Method get_schedule_view has 125 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function get_schedule_view()
                        {
                            global $FANNIE_OP_DB;
                            $dbc = FannieDB::get($FANNIE_OP_DB);
                    
                    
                    Severity: Major
                    Found in fannie/item/ProdReviewPage.php - About 5 hrs to fix

                      Function superDept has 124 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      var superDept = (function($) {
                          var mod = {};
                      
                          var showAlert = function(type, msg) {
                              var alertbox = '<div class="alert alert-' + type + '" role="alert">';
                      Severity: Major
                      Found in fannie/item/departments/super.js - About 4 hrs to fix

                        Method addItem has 124 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/BogoPM.php - About 4 hrs to fix

                          Method get_id_handler has 124 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              public function get_id_handler()
                              {
                                  $emp_no = $this->id;
                                  $dbc = $this->connection;
                                  $dbc->selectDB($this->config->get('TRANS_DB'));
                          Severity: Major
                          Found in fannie/reports/cash_report/CashierBarGraphs.php - About 4 hrs to fix

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

                                public function run()
                                {
                                    $dbc = FannieDB::get($this->config->get('OP_DB'));
                                    $settings = $this->config->get('PLUGIN_SETTINGS');
                            
                            
                            Severity: Major
                            Found in fannie/modules/plugins2.0/Mercato/MercatoTask.php - About 4 hrs to fix

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

                                  protected function get_view()
                                  {
                                      $memtype = new MemtypeModel($this->connection);
                                      $memtype = $memtype->toOptions(-999);
                                      $couponR = $this->connection->query('SELECT coupID, description FROM houseCoupons ORDER BY startDate DESC');
                              Severity: Major
                              Found in fannie/mem/AdvancedMemSearch.php - About 4 hrs to fix

                                Method standardDepartmentFields has 124 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    public static function standardDepartmentFields($super='super',$multi='departments',$start='deptStart',$end='deptEnd', $subs='subdepts')
                                    {
                                        /**
                                          Precalculate options for superdept and dept selects
                                        */
                                Severity: Major
                                Found in fannie/classlib2.0/lib/FormLib.php - About 4 hrs to fix

                                  Method get_vendor_view has 124 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                      protected function get_vendor_view()
                                      {
                                          try {
                                              $store = $this->form->store;
                                          } catch (Exception $ex) {
                                  Severity: Major
                                  Found in fannie/item/inventory/InvCountPage.php - About 4 hrs to fix

                                    File DatabarCoupon.php has 373 lines of code (exceeds 250 allowed). Consider refactoring.
                                    Open

                                    <?php
                                    /*******************************************************************************
                                    
                                        Copyright 2010 Whole Foods Co-op
                                    
                                    
                                    Severity: Minor
                                    Found in pos/is4c-nf/lib/Scanning/SpecialUPCs/DatabarCoupon.php - About 4 hrs to fix
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language