CORE-POS/IS4C

View on GitHub

Showing 8,683 of 8,684 total issues

Function get_batchLog_view has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
Open

    public function get_batchLog_view()
    {
        global $FANNIE_OP_DB;
        $dbc = FannieDB::get($FANNIE_OP_DB);

Severity: Minor
Found in fannie/item/ProdReviewPage.php - About 4 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 fetch_report_data has 114 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function fetch_report_data()
    {
        global $FANNIE_OP_DB;
        /* provide a department range and date range to
           get history for all products in those departments
Severity: Major
Found in fannie/reports/CostHistory/CostHistoryReport.php - About 4 hrs to fix

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

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

      Method WFC_Produce has 114 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function WFC_Produce($data,$offset=0){
      
      $pdf=new WFC_Produce_PDF('P','mm','Letter'); //start new instance of PDF
      $pdf->Open(); //open new PDF Document
      $pdf->setTagDate(date("m/d/Y"));
      Severity: Major
      Found in fannie/admin/labels/pdf_layouts/WFC_Produce.php - About 4 hrs to fix

        Method post_view has 114 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            protected function post_view()
            {
                $empID = FormLib::get('lookup', -1);
                $dbc = FannieDB::get($this->config->get('OP_DB'));
        
        
        Severity: Major
        Found in fannie/modules/plugins2.0/HrWeb/Screening/ScreeningPage.php - About 4 hrs to fix

          Method getList has 114 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              private function getList()
              {
                  $settings = $this->config->get('PLUGIN_SETTINGS');
                  $this->connection->selectDB($this->config->get('OP_DB'));
                  $uid = FannieAuth::getUID($this->current_user);
          Severity: Major
          Found in fannie/modules/plugins2.0/ShelfAudit/SaItemList.php - About 4 hrs to fix

            Method getAllCustdata has 114 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                private static function getAllCustdata($dbc)
                {
                    // grab supplementary data from new tables if present
                    $new_available = false;
                    if ($dbc->tableExists('CustomerAccounts') && $dbc->tableExists('Customers')) {
            Severity: Major
            Found in fannie/classlib2.0/member/MemberREST.php - About 4 hrs to fix

              Method post_u_view has 114 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  function post_u_view()
                  {
                      global $FANNIE_OP_DB, $FANNIE_URL;
                      $ret = '';
              
              
              Severity: Major
              Found in fannie/item/EditItemsFromSearch.php - About 4 hrs to fix

                Method WriteTokenInternal has 114 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                        private void WriteTokenInternal(BsonToken t)
                        {
                            switch (t.Type)
                            {
                                case BsonType.Object:

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

                                  if ($priceType == 'LB') {
                                      $size = '#';
                                      $units = str_replace(' LBA', '', $sizeInfo);
                                      $mult = 1;
                                      if (strstr($units, '/')) {
                  Severity: Major
                  Found in fannie/purchasing/importers/UsFoodsInvoiceImport.php and 1 other location - About 4 hrs to fix
                  fannie/modules/plugins2.0/USFoodsInvoiceGrabber/USFTask.php on lines 77..103

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

                  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

                                      if (is_array($form->tryGet('departments')) && count($form->tryGet('departments')) > 0) {
                                          $query .= ' AND t.department IN (';
                                          foreach ($form->tryGet('departments') as $d) {
                                              $query .= '?,';
                                              $args[] = $d;
                  Severity: Major
                  Found in fannie/classlib2.0/lib/FormLib.php and 1 other location - About 4 hrs to fix
                  fannie/classlib2.0/lib/FormLib.php on lines 952..963

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

                  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

                                      if (is_array($form->tryGet('departments')) && count($form->tryGet('departments')) > 0) {
                                          $query .= ' AND t.department IN (';
                                          foreach ($form->tryGet('departments') as $d) {
                                              $query .= '?,';
                                              $args[] = $d;
                  Severity: Major
                  Found in fannie/classlib2.0/lib/FormLib.php and 1 other location - About 4 hrs to fix
                  fannie/classlib2.0/lib/FormLib.php on lines 966..977

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

                  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

                                  if ($priceType == 'LB') {
                                      $size = '#';
                                      $units = str_replace(' LBA', '', $sizeInfo);
                                      $mult = 1;
                                      if (strstr($units, '/')) {
                  Severity: Major
                  Found in fannie/modules/plugins2.0/USFoodsInvoiceGrabber/USFTask.php and 1 other location - About 4 hrs to fix
                  fannie/purchasing/importers/UsFoodsInvoiceImport.php on lines 82..108

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

                  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 3 locations. Consider refactoring.
                  Open

                              if ($row['discounttype'] == 1 || $row['discounttype'] == 2){
                                  $pdf->Cell(100,9,'Sale Price',0,1,'C');
                                  $pdf->SetX($posX);
                  
                              } elseif ($row['regPrice']-$row['total'] > 0){
                  Severity: Major
                  Found in fannie/ordering/SpecialOrderTags.php and 2 other locations - About 4 hrs to fix
                  fannie/ordering/SpecialOrderTags.php on lines 304..313
                  fannie/ordering/tagpdf.php on lines 117..127

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

                  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 3 locations. Consider refactoring.
                  Open

                              if ($row['discounttype'] == 1 || $row['discounttype'] == 2){
                                  $pdf->Cell(100,9,'Sale Price',0,1,'C');
                                  $pdf->SetX($posX);
                  
                              } elseif ($row['regPrice']-$row['total'] > 0){
                  Severity: Major
                  Found in fannie/ordering/SpecialOrderTags.php and 2 other locations - About 4 hrs to fix
                  fannie/ordering/SpecialOrderTags.php on lines 135..144
                  fannie/ordering/tagpdf.php on lines 117..127

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

                  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 3 locations. Consider refactoring.
                  Open

                          if ($w['discounttype'] == 1 || $w['discounttype'] == 2){
                              $pdf->Cell(100,9,'Sale Price',0,1,'C');
                              $pdf->SetX($x);
                  
                          }
                  Severity: Major
                  Found in fannie/ordering/tagpdf.php and 2 other locations - About 4 hrs to fix
                  fannie/ordering/SpecialOrderTags.php on lines 135..144
                  fannie/ordering/SpecialOrderTags.php on lines 304..313

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

                  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

                  <?php
                  /*******************************************************************************
                  
                      Copyright 2012 Whole Foods Co-op.
                  
                  
                  Severity: Major
                  Found in fannie/modules/plugins2.0/EReceipt/EReceiptTag.php and 1 other location - About 4 hrs to fix
                  pos/is4c-nf/lib/ReceiptBuilding/Tag/DefaultReceiptTag.php on lines 24..67

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

                  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

                              if (!isset($this->sCache)) {
                                  $this->sCache = array();
                                  $cutoff = date('Y-m-d', strtotime($sold . ' days ago'));
                                  $prep = $this->dbc->prepare('SELECT upc
                                      FROM ' . FannieDB::fqn('products', 'op') . '
                  Severity: Major
                  Found in fannie/modules/plugins2.0/InstaCart/InstaFileV3.php and 1 other location - About 4 hrs to fix
                  fannie/modules/plugins2.0/InstaCart/InstaFileV3.php on lines 345..358

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

                  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

                  namespace COREPOS\pos\lib\ReceiptBuilding\Tag;
                  
                  /**
                    @class DefaultReceiptTag
                    Module for marking receipt records
                  Severity: Major
                  Found in pos/is4c-nf/lib/ReceiptBuilding/Tag/DefaultReceiptTag.php and 1 other location - About 4 hrs to fix
                  fannie/modules/plugins2.0/EReceipt/EReceiptTag.php on lines 1..66

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

                  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

                              if (!isset($this->cCache)) {
                                  $this->cCache = array();
                                  $cutoff = date('Y-m-d', strtotime($created . ' days ago'));
                                  $prep = $this->dbc->prepare("SELECT upc
                                      FROM " . FannieDB::fqn('products', 'op') . "
                  Severity: Major
                  Found in fannie/modules/plugins2.0/InstaCart/InstaFileV3.php and 1 other location - About 4 hrs to fix
                  fannie/modules/plugins2.0/InstaCart/InstaFileV3.php on lines 380..393

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

                  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