CORE-POS/IS4C

View on GitHub

Showing 8,683 of 8,684 total issues

Method PopulateDictionary has a Cognitive Complexity of 52 (exceeds 20 allowed). Consider refactoring.
Open

        private object PopulateDictionary(IDictionary dictionary, JsonReader reader, JsonDictionaryContract contract, JsonProperty containerProperty, string id)
        {
            IWrappedDictionary wrappedDictionary = dictionary as IWrappedDictionary;
            object underlyingDictionary = wrappedDictionary != null ? wrappedDictionary.UnderlyingDictionary : dictionary;

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

        internal unsafe bool GetInfo()
        {
            IntPtr udev = NativeMethods.udev_new();
            if (IntPtr.Zero != udev)
            {

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 ProdUserModule.php has 399 lines of code (exceeds 250 allowed). Consider refactoring.
Open

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

    Copyright 2014 Whole Foods Co-op, Duluth, MN

Severity: Minor
Found in fannie/item/modules/ProdUserModule.php - About 5 hrs to fix

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

        public function body_content()
        {
            global $FANNIE_URL;
    
            $sql = WfcHtLib::hours_dbconnect();
    Severity: Major
    Found in fannie/modules/plugins2.0/WfcHoursTracking/WfcHtViewEmpPage.php - About 5 hrs to fix

      Method csv_content has 139 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          function csv_content(){
              $ret = "UPC,Description,Vendor,Account#,Dept#,\"Dept Name\",Qty,Cost,Unit Cost Total,Normal Retail,Status,Normal Retail Total,Location\r\n";
              $totals = array();
              $vendors = array();
              $manuals = array();
      Severity: Major
      Found in fannie/modules/plugins2.0/ShelfAudit/SaReportPage.php - About 5 hrs to fix

        Method get_orderID_view has 139 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            protected function get_orderID_view()
            {
                $orderID = (int)$this->orderID;
                if ($orderID === 0) {
                    return '<div class="alert alert-danger">Invalid order. <a href="OrderViewPage.php">Create new order</a>?</div>';
        Severity: Major
        Found in fannie/ordering/OrderViewPage.php - About 5 hrs to fix

          File ESCPOSPrintHandler.php has 397 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/ESCPOSPrintHandler.php - About 5 hrs to fix

            File GumEmailPage.php has 397 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

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

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

                  public function refnum($transID)
                  {
                      $transNo   = (int)$this->conf->get("transno");
                      $cashierNo = (int)$this->conf->get("CashierNo");
                      $laneNo    = (int)$this->conf->get("laneno");    
              Severity: Major
              Found in pos/is4c-nf/plugins/Paycards/GoEMerchant.php and 1 other location - About 5 hrs to fix
              pos/is4c-nf/plugins/Paycards/FirstData.php on lines 299..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 194.

              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

                  public function refnum($transID)
                  {
                      $transNo   = (int)$this->conf->get("transno");
                      $cashierNo = (int)$this->conf->get("CashierNo");
                      $laneNo    = (int)$this->conf->get("laneno");    
              Severity: Major
              Found in pos/is4c-nf/plugins/Paycards/FirstData.php and 1 other location - About 5 hrs to fix
              pos/is4c-nf/plugins/Paycards/GoEMerchant.php on lines 562..578

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

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

                  protected virtual void HandleDeviceMessage(byte[] msg){
                      if (this.verbose_mode > 0)
                          System.Console.Write("DMSG: {0}: ",current_state);
              
                      if (msg == null) msg = new byte[0];
              Severity: Major
              Found in pos/is4c-nf/scale-drivers/drivers/NewMagellan/SPH_SignAndPay_USB.cs - About 5 hrs to fix

                File SPH_Datacap_PDCX.cs has 396 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                using System;
                using System.IO;
                using System.Threading;
                using System.Net;
                using System.Net.Sockets;
                Severity: Minor
                Found in pos/is4c-nf/scale-drivers/drivers/NewMagellan/SPH_Datacap_PDCX.cs - About 5 hrs to fix

                  Class JValue has 41 methods (exceeds 20 allowed). Consider refactoring.
                  Open

                      public class JValue : JToken, IEquatable<JValue>, IFormattable, IComparable, IComparable<JValue>
                  #if !(NETFX_CORE || PORTABLE)
                          , IConvertible
                  #endif
                      {

                    Method handleResponseDataCap has 137 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function handleResponseDataCap($xml)
                        {
                            $rawXml = $xml;
                            $ref = $this->refnum($this->conf->get('paycard_id'));
                            $transID = $this->conf->get('paycard_id');
                    Severity: Major
                    Found in pos/is4c-nf/plugins/Paycards/MercuryDC.php - About 5 hrs to fix

                      Method lookupTransaction has 137 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public function lookupTransaction($ref, $local, $mode)
                          {
                              $wsParams = array(
                                  'merchant' => $this->conf->get('MercuryE2ETerminalID'),
                                  'pw' => $this->conf->get('MercuryE2EPassword'),
                      Severity: Major
                      Found in pos/is4c-nf/plugins/Paycards/MercuryE2E.php - About 5 hrs to fix

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

                            protected function get_view()
                            {
                                $editCSS = 'collapse';
                                $includeList = false;
                                if (FannieAuth::validateUserQuiet('hr_editor') || FannieAuth::validateUserQuiet('illness_editor')) {
                        Severity: Major
                        Found in fannie/modules/plugins2.0/HrWeb/IllnessLog/IllnessLogsPage.php - About 5 hrs to fix

                          Method get_createBatchAdv_view has 137 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              function get_createBatchAdv_view()
                              {
                                  $i = FormLib::get('i');
                                  $rounder = new \COREPOS\Fannie\API\item\PriceRounder();
                                  $date1 = new DateTime();
                          Severity: Major
                          Found in fannie/item/RoundingFixerTool.php - About 5 hrs to fix

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

                            static public function get($session){
                            
                                $DESIRED_TENDERS = array("CK"=>"CHECK TENDERS",
                                             "CC"=>"CREDIT CARD TENDERS",
                                             "CA"=>"CASH TENDERS",
                            Severity: Major
                            Found in pos/is4c-nf/lib/ReceiptBuilding/TenderReports/WfcTenderReport.php - About 5 hrs to fix

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

                                  function process_file($linedata, $indexes)
                                  {
                                      global $FANNIE_OP_DB;
                                      $dbc = FannieDB::get($FANNIE_OP_DB);
                                      $VENDOR_ID = $this->getVendorID();
                              Severity: Major
                              Found in fannie/batches/UNFI/load-classes/CpwUploadPage.php - About 5 hrs to fix

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

                                    protected function get_view()
                                    {
                                        $stores = FormLib::storePicker();
                                        $months = '<option value="">Select month...</option>';
                                        for ($i=1; $i<=12; $i++) {
                                Severity: Major
                                Found in fannie/modules/plugins2.0/OverShortTools/OsMonthEndPage.php - About 5 hrs to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language