CORE-POS/IS4C

View on GitHub

Showing 8,683 of 8,684 total issues

Method getEmailSync has a Cognitive Complexity of 36 (exceeds 20 allowed). Consider refactoring.
Open

    public string getEmailSync()
    {
        string ret = "";
        try {
            initPort();
Severity: Minor
Found in pos/is4c-nf/scale-drivers/drivers/NewMagellan/RBA_Stub.cs - About 2 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

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

    private function getPO($ref, $store, $date)
    {
        $prep = $this->connection->prepare("SELECT orderID FROM PurchaseOrder
            WHERE vendorInvoiceID=? AND vendorID=136 AND storeID=?");
        $exists = $this->connection->getValue($prep, array($ref, $store));
Severity: Major
Found in fannie/purchasing/importers/RdwCreditImport.php and 1 other location - About 2 hrs to fix
fannie/item/likecodes/cool/RdwImport.php on lines 124..142

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

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

    private function getPO($ref, $store, $date)
    {
        $prep = $this->connection->prepare("SELECT orderID FROM PurchaseOrder
            WHERE vendorInvoiceID=? AND vendorID=136 AND storeID=?");
        $exists = $this->connection->getValue($prep, array($ref, $store));
Severity: Major
Found in fannie/item/likecodes/cool/RdwImport.php and 1 other location - About 2 hrs to fix
fannie/purchasing/importers/RdwCreditImport.php on lines 78..96

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

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

File PaymentPlanEditor.php has 288 lines of code (exceeds 250 allowed). Consider refactoring.
Open

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

    Copyright 2015 Whole Foods Co-op

Severity: Minor
Found in fannie/mem/PaymentPlanEditor.php - About 2 hrs to fix

    File ReprintReceiptPage.php has 287 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

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

      File MercatoCorrections2.php has 287 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      <?php
      
      include(__DIR__ . '/../../../config.php');
      if (!class_exists('FannieAPI')) {
          include(__DIR__ . '/../../../classlib2.0/FannieAPI.php');
      Severity: Minor
      Found in fannie/modules/plugins2.0/Mercato/MercatoCorrections2.php - About 2 hrs to fix

        File SuperDeptEditor.php has 287 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        <?php
        /*******************************************************************************
        
            Copyright 2009,2013 Whole Foods Co-op
        
        
        Severity: Minor
        Found in fannie/item/departments/SuperDeptEditor.php - About 2 hrs to fix

          Method handleResponseAuth has 72 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              protected function handleResponseAuth($authResult)
              {
                  $xml = new XmlData($authResult["response"]);
                  $request = $this->last_request;
                  $this->last_paycard_transaction_id = $request->last_paycard_transaction_id;
          Severity: Major
          Found in pos/is4c-nf/plugins/Paycards/Valutec.php - About 2 hrs to fix

            Method message has 72 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function message($str){
                    global $CORE_LOCAL;
            
                    $lineStart = "";
                    $lineEnd = "\n";
            Severity: Major
            Found in pos/is4c-nf/plugins/CoopCred/receiptMessages/CCredBalanceMessage.php - About 2 hrs to fix

              Method handleResponseVoid has 72 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  private function handleResponseVoid($vdResult)
                  {
                      $resp = $this->desoapify("GiftTransactionResult",
                          $vdResult["response"]);
                      $xml = new BetterXmlData($resp);
              Severity: Major
              Found in pos/is4c-nf/plugins/Paycards/MercuryGift.php - About 2 hrs to fix

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

                    function body_content(){
                        global $CORE_LOCAL;
                        $db = Database::pDataConnect();
                        /* Only tenders the member may actually use. */
                        $q = "SELECT t.TenderCode, p.tenderKeyCap, p.tenderName
                Severity: Major
                Found in pos/is4c-nf/plugins/CoopCred/tenderlist_coopCred.php - About 2 hrs to fix

                  Method receiptDetail has 72 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  static public function receiptDetail($reprint=false, $transNum='') 
                  { 
                      // put into its own function to make it easier to follow, and slightly 
                      // modified for wider-spread use of joe's "new" receipt format --- apbw 7/3/2007
                      if (CoreLocal::get("newReceipt") == 2) {
                  Severity: Major
                  Found in pos/is4c-nf/lib/ReceiptLib.php - About 2 hrs to fix

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

                        function form_content()
                        {
                            $dbc = $this->connection;
                            $dbc->selectDB($this->config->get('OP_DB'));
                    
                    
                    Severity: Major
                    Found in fannie/reports/BatchReport/BatchReport.php - About 2 hrs to fix

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

                          public function form_content()
                          {
                              global $FANNIE_URL;
                              ob_start();
                      ?>
                      Severity: Major
                      Found in fannie/reports/ManufacturerMovement/ManufacturerMovementReport.php - About 2 hrs to fix

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

                            public function fetch_report_data()
                            {
                                $dbc = $this->connection;
                                $dbc->selectDB($this->config->get('TRANS_DB'));
                                try {
                        Severity: Major
                        Found in fannie/reports/WicTenderReport/WicTenderReport.php - About 2 hrs to fix

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

                              public function fetch_report_data()
                              {
                                  $dbc = $this->connection;
                                  $dbc->selectDB($this->config->get('OP_DB'));
                                  $FANNIE_TRANS_DB = $this->config->get('TRANS_DB');
                          Severity: Major
                          Found in fannie/reports/Local/LocalMovementReport.php - About 2 hrs to fix

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

                                function fetch_report_data()
                                {
                                    global $FANNIE_OP_DB, $FANNIE_ARCHIVE_DB;
                                    $dbc = FannieDB::get($FANNIE_OP_DB);
                                    $date1 = $this->form->date1;
                            Severity: Major
                            Found in fannie/reports/NonMovement/NonMovementReport.php - About 2 hrs to fix

                              Method generateSoupTag has 72 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                              function generateSoupTag($x, $y, $guide, $width, $height, $pdf, $row, $dbc)
                              {
                                  $store = COREPOS\Fannie\API\lib\Store::getIdByIp();
                                  $upc = $row['upc'];
                                  $brand = $row['description'];
                              Severity: Major
                              Found in fannie/admin/labels/pdf_layouts/Soup_Signs_4UP.php - About 2 hrs to fix

                                Method processMail has 72 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    public function processMail($msg)
                                    {
                                        $fp = fopen('/tmp/resp.log', 'a');
                                        $info = $this->parseEmail($msg);
                                        $commentID = false;
                                Severity: Major
                                Found in fannie/modules/plugins2.0/CommentTracker/ResponsePipe.php - About 2 hrs to fix

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

                                      public function process_file($linedata, $indexes)
                                      {
                                          $getStoreP = $this->connection->prepare("SELECT posID FROM LbmxStores WHERE lbmxID=?");
                                          $getVendorP = $this->connection->prepare("SELECT vendorName FROM LbmxVendors AS l
                                              LEFT JOIN vendors AS v on l.posID=v.vendorID WHERE lbmxID=?");
                                  Severity: Major
                                  Found in fannie/modules/plugins2.0/LBMX/LbmxReformat.php - About 2 hrs to fix
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language