CORE-POS/IS4C

View on GitHub

Showing 8,683 of 8,684 total issues

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

    public function run()
    {
        $settings = $this->config->get('PLUGIN_SETTINGS');
        $store = $this->config->get('STORE_ID');
        $this->connection = FannieDB::get($this->config->get('OP_DB'));
Severity: Major
Found in fannie/modules/plugins2.0/USFoodsInvoiceGrabber/USFTask.php - About 5 hrs to fix

    File SaItemList.php has 380 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

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

      File CoopCredConfigEditor.php has 379 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      <?php
      /*******************************************************************************
      
          Copyright 2009,2013 Whole Foods Co-op
          Copyright 2015 West End Food Co-op, Toronto
      Severity: Minor
      Found in fannie/modules/plugins2.0/CoopCred/programs/CoopCredConfigEditor.php - About 5 hrs to fix

        File RoundingFixerTool.php has 379 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        <?php
        /*******************************************************************************
        
            Copyright 2017 Whole Foods Community Co-op
        
        
        Severity: Minor
        Found in fannie/item/RoundingFixerTool.php - About 5 hrs to fix

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

              public function form_content()
              {
                  $sql = $this->connection;
                  $sql->selectDB($this->config->get('OP_DB'));
          
          
          Severity: Major
          Found in fannie/reports/CostHistory/CostHistoryReport.php and 1 other location - About 5 hrs to fix
          fannie/reports/PriceHistory/PriceHistoryReport.php on lines 206..292

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

          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 form_content()
              {
                  $sql = $this->connection;
                  $sql->selectDB($this->config->get('OP_DB'));
          
          
          Severity: Major
          Found in fannie/reports/PriceHistory/PriceHistoryReport.php and 1 other location - About 5 hrs to fix
          fannie/reports/CostHistory/CostHistoryReport.php on lines 209..295

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

          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 prepareDataCapAuth has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
          Open

              public function prepareDataCapAuth($type, $amount, $prompt=false)
              {
                  $request = new PaycardRequest($this->refnum($this->conf->get('paycard_id')), PaycardLib::paycard_db());
                  $request->setProcessor($this->proc_name);
                  $tranCode = $amount > 0 ? 'Sale' : 'Return';
          Severity: Minor
          Found in pos/is4c-nf/plugins/Paycards/MercuryDC.php - About 5 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 wicReceiptHandler has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
          Open

              private function wicReceiptHandler($dbc, $xml, $transID)
              {
                  if ($xml->query('/RStream/TranResponse/TranCode') == 'ReverseSale') {
                      $clearP = $dbc->prepare('DELETE FROM EmvReceipt WHERE dateID=? AND empNo=? AND registerNo=? AND transNo=? AND transID=?');
                      $dbc->execute($clearP, array(
          Severity: Minor
          Found in pos/is4c-nf/plugins/Paycards/MercuryDC.php - About 5 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 plugin_transaction_reset has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
          Open

              public function plugin_transaction_reset()
              {
                  list($emp, $reg, $trans) = explode('-', ReceiptLib::mostRecentReceipt(), 3);
                  $driverClass = CoreLocal::get('RemotePrintHandler');
                  if (!class_exists($driverClass)) {
          Severity: Minor
          Found in pos/is4c-nf/plugins/RemotePrint/RemotePrint.php - About 5 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 fetch_report_data has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
          Open

              public function fetch_report_data()
              {
                  $dbc = $this->connection;
                  $dbc->selectDB($this->config->get('OP_DB'));
          
          
          Severity: Minor
          Found in fannie/reports/HourlyTrans/HourlyTransReport.php - About 5 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 WFC_Narrow has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
          Open

          function WFC_Narrow($data,$offset=0)
          {
              $pdf=new WFC_Narrow_PDF('P','mm','Letter'); //start new instance of PDF
              $pdf->Open(); //open new PDF Document
              $pdf->SetTopMargin(40);  //Set top margin of the page
          Severity: Minor
          Found in fannie/admin/labels/pdf_layouts/WFC_Narrow.php - About 5 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 GenerateInternal has a Cognitive Complexity of 49 (exceeds 20 allowed). Consider refactoring.
          Open

                  private JsonSchema GenerateInternal(Type type, Required valueRequired, bool required)
                  {
                      ValidationUtils.ArgumentNotNull(type, "type");
          
                      string resolvedId = GetTypeId(type, false);

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

              public function fetch_report_data()
              {
                  $dbc = $this->connection;
                  $dbc->selectDB($this->config->get('OP_DB'));
                  $query = '';
          Severity: Major
          Found in fannie/reports/DepartmentMovement/SmartMovementReport.php - About 5 hrs to fix

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

                protected function get_view()
                {
                    $settings = $this->config->get('PLUGIN_SETTINGS');
                    $table = $settings['IncidentDB'] . $this->connection->sep();
                    $query = "SELECT i.*, 
            Severity: Major
            Found in fannie/modules/plugins2.0/IncidentTracker/AlertIncident.php - About 5 hrs to fix

              Method normalize has 127 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function normalize($db_name, $mode=BasicModel::NORMALIZE_MODE_CHECK, $doCreate=false)
                  {
                      $config = FannieConfig::factory();
                      $FANNIE_TRANS_DB = $config->get('TRANS_DB');
                      $FANNIE_ARCHIVE_DB = $config->get('ARCHIVE_DB');
              Severity: Major
              Found in fannie/classlib2.0/data/models/trans/DTransactionsModel.php - About 5 hrs to fix

                Method TryConvertInternal has 127 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                        private static ConvertResult TryConvertInternal(object initialValue, CultureInfo culture, Type targetType, out object value)
                        {
                            if (initialValue == null)
                                throw new ArgumentNullException("initialValue");
                
                

                  File Magellan.cs has 378 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  using System;
                  using System.Threading;
                  using System.IO;
                  using System.Collections.Generic;
                  using System.Linq;
                  Severity: Minor
                  Found in pos/is4c-nf/scale-drivers/drivers/NewMagellan/Magellan.cs - About 5 hrs to fix

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

                    function deleteitem(id){
                        if (confirm("Delete this item?")){
                            saveAll();
                    
                            $.ajax({
                    Severity: Major
                    Found in fannie/modules/plugins2.0/DeliInventory/index.js and 1 other location - About 5 hrs to fix
                    fannie/modules/plugins2.0/DeliInventory/index3.js on lines 105..124

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

                    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

                    function deleteitem(id){
                        if (confirm("Delete this item?")){
                            saveAll();
                    
                            $.ajax({
                    Severity: Major
                    Found in fannie/modules/plugins2.0/DeliInventory/index3.js and 1 other location - About 5 hrs to fix
                    fannie/modules/plugins2.0/DeliInventory/index.js on lines 105..124

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

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

                    <?php
                    /*******************************************************************************
                    
                        Copyright 2013 Whole Foods Co-op
                        Copyright 2014 West End Food Co-op, Toronto
                      Severity
                      Category
                      Status
                      Source
                      Language