CORE-POS/IS4C

View on GitHub

Showing 8,683 of 8,684 total issues

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

    public function get_view()
    {
        global $FANNIE_OP_DB, $FANNIE_TRANS_DB;
        $dbc = FannieDB::get($FANNIE_OP_DB);
        $TRANS = $FANNIE_TRANS_DB . $dbc->sep();
Severity: Major
Found in fannie/ordering/OldSpecialOrdersPage.php - About 7 hrs to fix

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

        protected function get_id_view()
        {
            $items = array(
                293 => $this->getItems(293),
                292 => $this->getItems(292),
    Severity: Major
    Found in fannie/item/likecodes/LikeCodeSKUsPage.php - About 7 hrs to fix

      Method displayCashier has 194 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          function displayCashier($date,$empno,$mode)
          {
              global $FANNIE_PLUGIN_SETTINGS, $FANNIE_OP_DB;
              $dbc = FannieDB::get($FANNIE_PLUGIN_SETTINGS['OverShortDatabase']);
              $store = FormLib::get('store', 1);
      Severity: Major
      Found in fannie/modules/plugins2.0/OverShortTools/OverShortCashierPage.php - About 7 hrs to fix

        Function printReceipt has a Cognitive Complexity of 50 (exceeds 5 allowed). Consider refactoring.
        Open

        static public function printReceipt($arg1, $ref, $second=False, $email=False) 
        {
            if($second) $email = False; // store copy always prints
            if($arg1 != "full") $email = False;
            $reprint = $arg1 == 'reprint' ? true : false;
        Severity: Minor
        Found in pos/is4c-nf/lib/ReceiptLib.php - About 7 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 process_file has a Cognitive Complexity of 50 (exceeds 5 allowed). Consider refactoring.
        Open

            function process_file($linedata, $indexes)
            {
                global $FANNIE_OP_DB;
                $dbc = FannieDB::get($FANNIE_OP_DB);
                $VENDOR_ID = $this->getVendorID();
        Severity: Minor
        Found in fannie/batches/UNFI/load-classes/UnfiUploadPage.php - About 7 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 body_content has a Cognitive Complexity of 50 (exceeds 5 allowed). Consider refactoring.
        Open

            function body_content()
            {
                include(dirname(__FILE__) . '/../config.php'); 
                ob_start();
                ?>
        Severity: Minor
        Found in fannie/install/InstallMenuPage.php - About 7 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 SerializeNode has a Cognitive Complexity of 65 (exceeds 20 allowed). Consider refactoring.
        Open

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

        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 PopulateObject has a Cognitive Complexity of 65 (exceeds 20 allowed). Consider refactoring.
        Open

                private object PopulateObject(object newObject, JsonReader reader, JsonObjectContract contract, JsonProperty member, string id)
                {
                    OnDeserializing(reader, contract, newObject);
        
                    // only need to keep a track of properies presence if they are required or a value should be defaulted if missing

        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 ParseArrayIndexer has a Cognitive Complexity of 65 (exceeds 20 allowed). Consider refactoring.
        Open

                private PathFilter ParseArrayIndexer(char indexerCloseChar)
                {
                    int start = _currentIndex;
                    int? end = null;
                    List<int> indexes = null;

        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

        File DateTimeUtils.cs has 489 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        using System;
        using System.IO;
        using System.Xml;
        using System.Globalization;
        
        

          Method get_dealSet_cycle_view has 193 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function get_dealSet_cycle_view()
              {
                  include(__DIR__.'/../../config.php');
                  $cycle = FormLib::get('cycle');
                  $month = FormLib::get('dealSet');
          Severity: Major
          Found in fannie/batches/CAP/CoopDealsSignsPage.php - About 7 hrs to fix

            Method generateHerbNspiceLabel has 193 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function generateHerbNspiceLabel($x, $y, $guide, $width, $height, $pdf, $row, $dbc, $showPrice, $offset, $tagNo)
            {
                $x += 5;
                $pdf->SetFont('Gill','', 16);
                if (!defined('FPDF_FONTPATH')) {
            Severity: Major
            Found in fannie/admin/labels/pdf_layouts/WFC_HerbNspice_3UP.php - About 7 hrs to fix

              Method get_id_pdf_handler has 193 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function get_id_pdf_handler()
                  {
                      if (!class_exists('FPDF')) {
                          include(__DIR__ . '/../../../src/fpdf/fpdf.php');
                          define('FPDF_FONTPATH','font/');
              Severity: Major
              Found in fannie/modules/plugins2.0/GiveUsMoneyPlugin/GumPromissoryPage.php - About 7 hrs to fix

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

                    public function showEditForm($upc, $display_mode=1, $expand_mode=1)
                    {
                        $FANNIE_URL = FannieConfig::config('URL');
                        $upc = BarcodeLib::padUPC($upc);
                
                
                Severity: Major
                Found in fannie/item/modules/ProdUserModule.php - About 7 hrs to fix

                  File OverShortDayPage.php has 488 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  <?php
                  /*******************************************************************************
                  
                      Copyright 2013 Whole Foods Co-op
                  
                  
                  Severity: Minor
                  Found in fannie/modules/plugins2.0/OverShortTools/OverShortDayPage.php - About 7 hrs to fix

                    Method ajax_display_program has 192 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        private function ajax_display_program($id){
                            global $FANNIE_PLUGIN_SETTINGS, $FANNIE_URL, $FANNIE_OP_DB;
                    
                            $dbc = FannieDB::get($FANNIE_PLUGIN_SETTINGS['CoopCredDatabase']);
                    
                    
                    Severity: Major
                    Found in fannie/modules/plugins2.0/CoopCred/programs/CoopCredConfigEditor.php - About 7 hrs to fix

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

                          function body_content()
                          {
                              global $FANNIE_URL;
                              ob_start();
                              ?>
                      Severity: Major
                      Found in fannie/modules/plugins2.0/CoopCred/CoopCredSetup.php - About 7 hrs to fix

                        BasicModel has 54 functions (exceeds 20 allowed). Consider refactoring.
                        Open

                        class BasicModel 
                        {
                            /**
                              Name of the table
                            */
                        Severity: Major
                        Found in common/BasicModel.php - About 7 hrs to fix

                          File DictionaryWrapper.cs has 486 lines of code (exceeds 250 allowed). Consider refactoring.
                          Open

                          using System;
                          using System.Collections.Generic;
                          using System.Collections;
                          using System.Threading;
                          #if NET20

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

                                foreach($data as $k => $row){
                                    $upc = $row['upc'];
                                    if ($i % 14 == 0 && $i != 0) {
                                        $pdf->AddPage('L');
                                        $x = $left;
                            Severity: Major
                            Found in fannie/admin/labels/pdf_layouts/WFC_Bulk_Repack_14UP.php and 1 other location - About 7 hrs to fix
                            fannie/admin/labels/pdf_layouts/WFC_HerbNspice_Flat.php on lines 54..74

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

                            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