CORE-POS/IS4C

View on GitHub

Showing 8,683 of 8,684 total issues

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

    public function reload($trans_db,$start_month,$start_year,$end_month=False,$end_year=False)
    {
        if (!$end_month) {
            $end_month = $start_month;
        }
fannie/modules/plugins2.0/CoreWarehouse/models/SuperWeeklySalesModel.php on lines 41..55
fannie/modules/plugins2.0/CoreWarehouse/models/WarehouseDatesModel.php on lines 48..62

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

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

    public function reload($trans_db,$start_month,$start_year,$end_month=False,$end_year=False)
    {
        if (!$end_month) {
            $end_month = $start_month;
        }
fannie/modules/plugins2.0/CoreWarehouse/models/SmoothedModel.php on lines 39..53
fannie/modules/plugins2.0/CoreWarehouse/models/SuperWeeklySalesModel.php on lines 41..55

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

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 RpImportCsv.php has 441 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/RP/RpImportCsv.php - About 6 hrs to fix

    File DIPage.php has 441 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    
    use COREPOS\Fannie\API\lib\Store;
    use COREPOS\Fannie\API\lib\FannieUI;
    
    
    Severity: Minor
    Found in fannie/modules/plugins2.0/DeliInventory/DIPage.php - About 6 hrs to fix

      File NewSpecialOrdersPage.php has 441 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      <?php
      /*******************************************************************************
      
          Copyright 2010 Whole Foods Co-op
      
      
      Severity: Minor
      Found in fannie/ordering/NewSpecialOrdersPage.php - About 6 hrs to fix

        File CoopDealsLookupPage.php has 441 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

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

          Function run has a Cognitive Complexity of 43 (exceeds 5 allowed). Consider refactoring.
          Open

              public function run()
              {
                  $dbc = FannieDB::get($this->config->get('OP_DB'));
          
                  $equityP = $dbc->prepare('
          Severity: Minor
          Found in fannie/cron/tasks/SetMemDatesTask.php - About 6 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 body_content has a Cognitive Complexity of 43 (exceeds 5 allowed). Consider refactoring.
          Open

              function body_content()
              {
                  include(dirname(__FILE__) . '/../config.php');
                  // set a default if needed
                  if (!isset($FANNIE_PRODUCT_MODULES) || !is_array($FANNIE_PRODUCT_MODULES) || count($FANNIE_PRODUCT_MODULES) === 0) {
          Severity: Minor
          Found in fannie/install/InstallProductsPage.php - About 6 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 get_id_view has a Cognitive Complexity of 43 (exceeds 5 allowed). Consider refactoring.
          Open

              protected function get_id_view()
              {
                  $settings = $this->config->get('PLUGIN_SETTINGS');
                  $prefix = $settings['ObfDatabaseV2'] . $this->connection->sep();
                  $store = FormLib::get('store', 0);
          Severity: Minor
          Found in fannie/modules/plugins2.0/OpenBookFinancingV2/ObfBigBoardReport.php - About 6 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 body_content has a Cognitive Complexity of 43 (exceeds 5 allowed). Consider refactoring.
          Open

              function body_content(){
                  global $FANNIE_OP_DB, $FANNIE_PLUGIN_SETTINGS;
                  $ts_db = FannieDB::get($FANNIE_PLUGIN_SETTINGS['TimesheetDatabase']);
          
                  include('./includes/header.html');
          Severity: Minor
          Found in fannie/modules/plugins2.0/TimesheetPlugin/TsEmployeesReport.php - About 6 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 getTopImage has a Cognitive Complexity of 43 (exceeds 5 allowed). Consider refactoring.
          Open

              private function getTopImage($item)
              {
                  // Manual Signs Page && smartType override checked takes precedence
                  if (isset($item['smartType']) && $item['smartType'] == 'CoopDeals') {
                      return __DIR__ . '/noauto/images/codeals_top_2.png';
          Severity: Minor
          Found in fannie/modules/plugins2.0/CoopDealsSigns/WfcSmartSigns4UpP.php - About 6 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 getTopImage has a Cognitive Complexity of 43 (exceeds 5 allowed). Consider refactoring.
          Open

              private function getTopImage($item)
              {
                  // Manual Signs Page && smartType override checked takes precedence
                  if (isset($item['smartType']) && $item['smartType'] == 'CoopDeals') {
                      return __DIR__ . '/noauto/images/codeals_top_12.png';
          Severity: Minor
          Found in fannie/modules/plugins2.0/CoopDealsSigns/WfcSmartSigns16UpP.php - About 6 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 getTopImage has a Cognitive Complexity of 43 (exceeds 5 allowed). Consider refactoring.
          Open

              private function getTopImage($item)
              {
                  // Manual Signs Page && smartType override checked takes precedence
                  if (isset($item['smartType']) && $item['smartType'] == 'CoopDeals') {
                      return __DIR__ . '/noauto/images/codeals_top_12.png';
          Severity: Minor
          Found in fannie/modules/plugins2.0/CoopDealsSigns/WfcSmartSigns12UpP.php - About 6 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 getTopImage has a Cognitive Complexity of 43 (exceeds 5 allowed). Consider refactoring.
          Open

              private function getTopImage($item)
              {
                  // Manual Signs Page && smartType override checked takes precedence
                  if (isset($item['smartType']) && $item['smartType'] == 'CoopDeals') {
                      return __DIR__ . '/noauto/images/codeals_top_12.png';
          Severity: Minor
          Found in fannie/modules/plugins2.0/CoopDealsSigns/LegacySmartSigns12UpP.php - About 6 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 editableItemList has a Cognitive Complexity of 43 (exceeds 5 allowed). Consider refactoring.
          Open

              private function editableItemList($orderID)
              {
                  $dbc = $this->connection;
                  $dbc->selectDB($this->config->get('OP_DB'));
                  $TRANS = $this->config->get('TRANS_DB') . $dbc->sep();
          Severity: Minor
          Found in fannie/ordering/OrderViewPage.php - About 6 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 get_id_view has a Cognitive Complexity of 43 (exceeds 5 allowed). Consider refactoring.
          Open

              protected function get_id_view()
              {
                  $items = array(
                      293 => $this->getItems(293),
                      292 => $this->getItems(292),
          Severity: Minor
          Found in fannie/item/likecodes/LikeCodeSKUsPage.php - About 6 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 saveFormData has a Cognitive Complexity of 43 (exceeds 5 allowed). Consider refactoring.
          Open

              function saveFormData($upc)
              {
                  $FANNIE_PRODUCT_MODULES = FannieConfig::config('PRODUCT_MODULES', array());
                  $upc = BarcodeLib::padUPC($upc);
                  $dbc = $this->db();
          Severity: Minor
          Found in fannie/item/modules/BaseItemModule.php - About 6 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

          File Valutec.php has 440 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          <?php
          /*******************************************************************************
          
              Copyright 2007,2010 Whole Foods Co-op
          
          
          Severity: Minor
          Found in pos/is4c-nf/plugins/Paycards/Valutec.php - About 6 hrs to fix

            Method post_id_handler has 164 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                function post_id_handler()
                {
                    global $FANNIE_OP_DB;
                    if (!FannieAuth::validateUserQuiet('editmembers') && !FannieAuth::validateUserQuiet('editmembers_csc'))
                        return $this->unknown_request_handler();
            Severity: Major
            Found in fannie/modules/plugins2.0/PIKiller/PISuspensionPage.php - About 6 hrs to fix

              Method get_upc_view has 164 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function get_upc_view()
                  {
                      /*
                          Handheld scanner view
                      */
              Severity: Major
              Found in fannie/item/FloorSections/EditLocations.php - About 6 hrs to fix
                Severity
                Category
                Status
                Source
                Language