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

    private function rtfToHtml($rtf)
    {
        $temp = tempnam(sys_get_temp_dir(), 'rtf');
        file_put_contents($temp, $rtf);
        exec("unrtf {$temp}", $output);
Severity: Major
Found in fannie/modules/plugins2.0/ChefTec/CTRecipes.php and 1 other location - About 3 hrs to fix
fannie/admin/labels/pdf_layouts/Cheftec_Signs_4UP.php on lines 149..166

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

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

var mk = (function ($) {
    var mod = {};
    
    var lineGraph = function(elem, name, labels, data1, data2) {
        var ctx = document.getElementById(elem);
Severity: Major
Found in fannie/modules/plugins2.0/CoreWarehouse/reports/mk.js - About 3 hrs to fix

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

        function head_content()
        {
            ?>
            <script type="text/javascript" >
            var prevKey = -1;
    Severity: Major
    Found in pos/is4c-nf/plugins/QuickKeys/QKDisplay.php - About 3 hrs to fix

      Method get has 91 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      static public function get($session)
      {
          $shiftCutoff = date('Y-m-d 00:00:00');
          $excl = " AND emp_no <> 9999 ";
      
      
      Severity: Major
      Found in pos/is4c-nf/lib/ReceiptBuilding/TenderReports/YPSITenderReport.php - About 3 hrs to fix

        Method fetch_report_data has 91 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/reports/AutoPars/AutoParsReport.php - About 3 hrs to fix

          Method generateNewMeat_24UPTag has 91 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function generateNewMeat_24UPTag($x, $y, $guide, $width, $height, $pdf, $row, $dbc, $showPrice, $offset, $tagNo)
          {
              $upc = $row['upc'];
              //$brand = strToUpper($row['brand']);
              $brand = $row['brand'];
          Severity: Major
          Found in fannie/admin/labels/pdf_layouts/WFC_New_MEAT_14UP.php - About 3 hrs to fix

            Method generateMeat_24UPTag has 91 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function generateMeat_24UPTag($x, $y, $guide, $width, $height, $pdf, $row, $dbc, $showPrice, $offset, $tagNo)
            {
                $upc = $row['upc'];
                $brand = strToUpper($row['brand']);
                $price = $row['normal_price'];
            Severity: Major
            Found in fannie/admin/labels/pdf_layouts/WFC_MEAT_14UP.php - About 3 hrs to fix

              Method No_Barcode has 91 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function No_Barcode($data,$offset=0)
              {
              
              $pdf=new No_Barcode_PDF('P','mm','Letter'); //start new instance of PDF
              $pdf->Open(); //open new PDF Document
              Severity: Major
              Found in fannie/admin/labels/pdf_layouts/No_Barcode.php - About 3 hrs to fix

                Method generateMeat_SN_24UPTag has 91 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                function generateMeat_SN_24UPTag($x, $y, $guide, $width, $height, $pdf, $row, $dbc, $showPrice, $offset, $tagNo)
                {
                    $upc = $row['upc'];
                    $brand = strToUpper($row['brand']);
                    $price = $row['normal_price'];
                Severity: Major
                Found in fannie/admin/labels/pdf_layouts/WFC_MEAT_SN_14UP.php - About 3 hrs to fix

                  Method post_date_trans_store_handler has 91 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      function post_date_trans_store_handler()
                      {
                          global $FANNIE_OP_DB, $FANNIE_TRANS_DB, $FANNIE_PLUGIN_SETTINGS;
                          $dbc = FannieDB::get($FANNIE_OP_DB);
                          $dlog = DTransactionsModel::selectDtrans($this->date);
                  Severity: Major
                  Found in fannie/modules/plugins2.0/ReverseTransaction/ReverseTransPage.php - About 3 hrs to fix

                    Method updateVendors has 91 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function updateVendors($data)
                        {
                            $vendLC = new VendorLikeCodeMapModel($this->connection);
                            $activeP = $this->connection->prepare("SELECT storeID FROM LikeCodeActiveMap WHERE inUse=1 AND likeCode=?");
                            $catP = $this->connection->prepare("
                    Severity: Major
                    Found in fannie/modules/plugins2.0/RP/RpImport.php - About 3 hrs to fix

                      Method ReadContentFrom has 91 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                              internal void ReadContentFrom(JsonReader r)
                              {
                                  ValidationUtils.ArgumentNotNull(r, "r");
                                  IJsonLineInfo lineInfo = r as IJsonLineInfo;
                      
                      

                        File login.php has 318 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

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

                          File PrintHandler.php has 317 lines of code (exceeds 250 allowed). Consider refactoring.
                          Open

                          <?php
                          
                          namespace COREPOS\pos\lib\PrintHandlers;
                          use COREPOS\pos\lib\Bitmap;
                          use COREPOS\pos\lib\ReceiptLib;
                          Severity: Minor
                          Found in pos/is4c-nf/lib/PrintHandlers/PrintHandler.php - About 3 hrs to fix

                            File OrderGuidePage.php has 317 lines of code (exceeds 250 allowed). Consider refactoring.
                            Open

                            <?php
                            
                            include(dirname(__FILE__) . '/../config.php');
                            if (!class_exists('FannieAPI')) {
                                include_once(__DIR__ . '/../classlib2.0/FannieAPI.php');
                            Severity: Minor
                            Found in fannie/purchasing/OrderGuidePage.php - About 3 hrs to fix

                              Method Fannie_Standard has 90 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                function Fannie_Standard($data,$offset=0){
                                  $hspace = 0.79375;
                                  $h = 29.36875;
                                  $top = 12.7 + 2.5;
                                  $left = 4.85 + 1.25;
                              Severity: Major
                              Found in fannie/admin/labels/pdf_layouts/Fannie_Standard.php - About 3 hrs to fix

                                Method getView has 90 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    public function getView()
                                    {
                                        $dbc = FannieDB::get(FannieConfig::config('OP_DB'));
                                
                                        return <<<HTML
                                Severity: Major
                                Found in fannie/admin/PosKeyboards/KeyboardView.php - About 3 hrs to fix

                                  Method form_content has 90 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                      function form_content(){
                                  
                                          global $FANNIE_PLUGIN_SETTINGS;
                                  
                                          $dbc = FannieDB::get($FANNIE_PLUGIN_SETTINGS['CoopCredDatabase']);

                                    Method form_content has 90 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                        function form_content(){
                                    
                                            global $FANNIE_PLUGIN_SETTINGS;
                                    
                                            $dbc = FannieDB::get($FANNIE_PLUGIN_SETTINGS['CoopCredDatabase']);

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

                                          protected function get_view()
                                          {
                                              $today = date('Y-m-d');
                                              $orders = $this->getOrders();
                                              $jsonData = json_encode($orders['json']);
                                      Severity: Major
                                      Found in fannie/modules/plugins2.0/Mercato/MercatoTags.php - About 3 hrs to fix
                                        Severity
                                        Category
                                        Status
                                        Source
                                        Language