CORE-POS/IS4C

View on GitHub

Showing 8,683 of 8,684 total issues

Method process has 112 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function process($filename)
    {
        $fp = fopen($filename, 'r');
        $currentOrder = array('id' => false, 'total' => 0, 'qty' => 0, 'fees' => 0, 'card_no' => 11, 'tdate' => '', 'items' => array());
        $trans_id = 1;
Severity: Major
Found in fannie/modules/plugins2.0/Mercato/MercatoIntakeV2.php - About 4 hrs to fix

    Method GenerateInternal has 112 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

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

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

          private function cleanUPC($upc)
          {
              if (strlen($upc) == 5 && substr($upc, 0, 1) == '9' && $upc !== '99999') {
                  return BarcodeLib::padUPC(substr($upc, 1));
              }
      Severity: Major
      Found in fannie/purchasing/importers/UsFoodsInvoiceImport.php and 4 other locations - About 4 hrs to fix
      fannie/batches/UNFI/load-classes/AlbertsUploadPage.php on lines 82..96
      fannie/modules/plugins2.0/USFoodsInvoiceGrabber/USFTask.php on lines 272..286
      fannie/purchasing/importers/AlbertsInvoiceImport.php on lines 101..115
      fannie/purchasing/importers/RdwInvoiceImport.php on lines 134..148

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

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

          private function cleanUPC($upc)
          {
              if (strlen($upc) == 5 && substr($upc, 0, 1) == '9' && $upc !== '99999') {
                  return BarcodeLib::padUPC(substr($upc, 1));
              }
      Severity: Major
      Found in fannie/modules/plugins2.0/USFoodsInvoiceGrabber/USFTask.php and 4 other locations - About 4 hrs to fix
      fannie/batches/UNFI/load-classes/AlbertsUploadPage.php on lines 82..96
      fannie/purchasing/importers/AlbertsInvoiceImport.php on lines 101..115
      fannie/purchasing/importers/RdwInvoiceImport.php on lines 134..148
      fannie/purchasing/importers/UsFoodsInvoiceImport.php on lines 220..234

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

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

          private function cleanUPC($upc)
          {
              if (strlen($upc) == 5 && substr($upc, 0, 1) == '9' && $upc !== '99999') {
                  return BarcodeLib::padUPC(substr($upc, 1));
              }
      Severity: Major
      Found in fannie/batches/UNFI/load-classes/AlbertsUploadPage.php and 4 other locations - About 4 hrs to fix
      fannie/modules/plugins2.0/USFoodsInvoiceGrabber/USFTask.php on lines 272..286
      fannie/purchasing/importers/AlbertsInvoiceImport.php on lines 101..115
      fannie/purchasing/importers/RdwInvoiceImport.php on lines 134..148
      fannie/purchasing/importers/UsFoodsInvoiceImport.php on lines 220..234

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

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

          private function cleanUPC($upc)
          {
              if (strlen($upc) == 5 && substr($upc, 0, 1) == '9' && $upc !== '99999') {
                  return BarcodeLib::padUPC(substr($upc, 1));
              }
      Severity: Major
      Found in fannie/purchasing/importers/AlbertsInvoiceImport.php and 4 other locations - About 4 hrs to fix
      fannie/batches/UNFI/load-classes/AlbertsUploadPage.php on lines 82..96
      fannie/modules/plugins2.0/USFoodsInvoiceGrabber/USFTask.php on lines 272..286
      fannie/purchasing/importers/RdwInvoiceImport.php on lines 134..148
      fannie/purchasing/importers/UsFoodsInvoiceImport.php on lines 220..234

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

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

          private function cleanUPC($upc)
          {
              if (strlen($upc) == 5 && substr($upc, 0, 1) == '9' && $upc !== '99999') {
                  return BarcodeLib::padUPC(substr($upc, 1));
              }
      Severity: Major
      Found in fannie/purchasing/importers/RdwInvoiceImport.php and 4 other locations - About 4 hrs to fix
      fannie/batches/UNFI/load-classes/AlbertsUploadPage.php on lines 82..96
      fannie/modules/plugins2.0/USFoodsInvoiceGrabber/USFTask.php on lines 272..286
      fannie/purchasing/importers/AlbertsInvoiceImport.php on lines 101..115
      fannie/purchasing/importers/UsFoodsInvoiceImport.php on lines 220..234

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

      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 doCutoffs($category)
          {
              foreach (array(1, 2) as $storeID) {
                  $cutoff = 0;
                  $cutoffP = $this->connection->prepare("SELECT total
      fannie/modules/plugins2.0/CoreWarehouse/models/WfcTopDaysModel.php on lines 120..144

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

      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 doCutoffs($category)
          {
              foreach (array(1, 2) as $storeID) {
                  $cutoff = 0;
                  $cutoffP = $this->connection->prepare("SELECT total
      fannie/modules/plugins2.0/CoreWarehouse/models/WfcTopWeeksModel.php on lines 140..164

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

      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

          public function addPartition($year, $month)
          {
              $timestamp = mktime(0, 0, 0, $month, 1, $year);
              $next_month = date('Y-m-d', mktime(
                  0, 0, 0,
      Severity: Major
      Found in fannie/classlib2.0/data/models/arch/BigArchiveModel.php and 1 other location - About 4 hrs to fix
      fannie/classlib2.0/data/models/arch/BigArchiveModel.php on lines 72..91

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

      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

              while($row = $dbc->fetch_row($result)) {
                  $hour = (int)$row['hour'];
      
                  $date = '';
                  if ($weekday == 1) {
      Severity: Major
      Found in fannie/reports/HourlyTrans/HourlyTransReport.php and 1 other location - About 4 hrs to fix
      fannie/reports/HourlySales/HourlySalesReport.php on lines 244..266

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

      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

          public function initPartitions($year, $month)
          {
              $timestamp = mktime(0, 0, 0, $month, 1, $year);
              $next_month = date('Y-m-d', mktime(
                  0, 0, 0,
      Severity: Major
      Found in fannie/classlib2.0/data/models/arch/BigArchiveModel.php and 1 other location - About 4 hrs to fix
      fannie/classlib2.0/data/models/arch/BigArchiveModel.php on lines 171..190

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

      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

              while($row = $dbc->fetch_row($result)) {
                  $hour = (int)$row['hour'];
      
                  $date = '';
                  if ($weekday == 1) {
      Severity: Major
      Found in fannie/reports/HourlySales/HourlySalesReport.php and 1 other location - About 4 hrs to fix
      fannie/reports/HourlyTrans/HourlyTransReport.php on lines 241..263

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

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

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

        Method fetch_report_data has 111 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/Trends/TrendsReport.php - About 4 hrs to fix

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

              protected function get_view()
              {
                  $settings = $this->config->get('PLUGIN_SETTINGS');
                  $prefix = $settings['CommentDB'] . $this->connection->sep();
          
          
          Severity: Major
          Found in fannie/modules/plugins2.0/CommentTracker/ManageComments.php - About 4 hrs to fix

            Method get_id_handler has 111 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                protected function get_id_handler()
                {
                    $dbc = $this->connection;
                    $dbc->selectDB($this->config->get('OP_DB'));
            
            
            Severity: Major
            Found in fannie/item/likecodes/LikeCodeAjax.php - About 4 hrs to fix

              Method getNewItem has 111 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  private function getNewItem($upc)
                  {
                      $dbc = $this->db();
                      // default values for form fields
                      $rowItem = array(
              Severity: Major
              Found in fannie/item/modules/BaseItemModule.php - About 4 hrs to fix

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

                    public function normalize($db_name, $mode=BasicModel::NORMALIZE_MODE_CHECK)
                    {
                        if ($mode != BasicModel::NORMALIZE_MODE_CHECK && $mode != BasicModel::NORMALIZE_MODE_APPLY) {
                            echo "Error: Unknown mode ($mode)\n";
                            return false;
                Severity: Major
                Found in common/BasicModel.php - About 4 hrs to fix

                  File FannieAPI.php has 351 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  <?php
                  /*******************************************************************************
                  
                      Copyright 2013 Whole Foods Co-op
                  
                  
                  Severity: Minor
                  Found in fannie/classlib2.0/FannieAPI.php - About 4 hrs to fix
                    Severity
                    Category
                    Status
                    Source
                    Language