CORE-POS/IS4C

View on GitHub

Showing 8,683 of 8,684 total issues

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

    protected function listFromUpcomingSale($dbc)
    {
        $ids = '';
        $args = array();
        $s_def = $dbc->tableDefinition('SignProperties');
Severity: Major
Found in fannie/classlib2.0/item/FannieSignage.php and 1 other location - About 1 day to fix
fannie/classlib2.0/item/FannieSignage.php on lines 510..564

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

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

    protected function listFromUpcomingRetail($dbc)
    {
        $ids = '';
        $args = array();
        $s_def = $dbc->tableDefinition('SignProperties');
Severity: Major
Found in fannie/classlib2.0/item/FannieSignage.php and 1 other location - About 1 day to fix
fannie/classlib2.0/item/FannieSignage.php on lines 632..698

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

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($_REQUEST['submit'])){

    $d1 = $_REQUEST['date1'];
    $d2 = $_REQUEST['date2'];
    $dept = $_REQUEST['dept'];
fannie/reports/Store-Specific/WFC/LocalSales/index.php on lines 28..171

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

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($_REQUEST['submit'])){
    $d1 = $_REQUEST['date1'];
    $d2 = $_REQUEST['date2'];

    $dlog = DTransactionsModel::selectDlog($d1,$d2);
Severity: Major
Found in fannie/reports/Store-Specific/WFC/LocalSales/index.php and 1 other location - About 1 day to fix
fannie/reports/Store-Specific/WEFC_Toronto/GeneralCosts/index.php on lines 52..303

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

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

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

    public function fetch_report_data()
    {
        $date_id = date('Ymd', strtotime(FormLib::get('date', date('Y-m-d'))));
        $date_str = date('Y-m-d', strtotime(FormLib::get('date', date('Y-m-d'))));
        $store = FormLib::get('store', false);
Severity: Major
Found in fannie/reports/Paycards/PcDailyReport.php - About 1 day to fix

    Method get_month_upc_view has 219 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function get_month_upc_view($month=false)
        {
            global $FANNIE_OP_DB;
            $dbc = FannieDB::get($FANNIE_OP_DB);
            if (FormLib::get('linea') != 1) {
    Severity: Major
    Found in fannie/item/CoopDealsLookupPage.php - About 1 day to fix

      Function process_file has a Cognitive Complexity of 56 (exceeds 5 allowed). Consider refactoring.
      Open

          public function process_file($linedata, $indexes)
          {
              global $FANNIE_OP_DB;
              $dbc = FannieDB::get($FANNIE_OP_DB);
      
      
      Severity: Minor
      Found in fannie/purchasing/ImportPurchaseOrder.php - About 1 day 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 get_id_view has 218 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function get_id_view()
          {
              $table = $this->getTable();
              $td = $table;
              $superID = FormLib::get('super', -1);
      Severity: Major
      Found in fannie/batches/UNFI/VPBPIV.php - About 1 day to fix

        Method get_id_view has 218 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function get_id_view()
            {
                $table = $this->getTable();
                $td = $table;
                $superID = FormLib::get('super', -1);
        Severity: Major
        Found in fannie/batches/UNFI/VPBPV.php - About 1 day to fix

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

              function fetch_report_data()
              {
                  $dbc = $this->connection;
                  $dbc->selectDB($this->config->get('OP_DB'));
                  $date1 = $this->form->date1;
          Severity: Major
          Found in fannie/reports/DepartmentMovement/DepartmentMovementReport.php - About 1 day to fix

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

                function body_content(){
                    global $FANNIE_OP_DB, $FANNIE_PLUGIN_SETTINGS, $FANNIE_URL;
                    $ts_db = FannieDB::get($FANNIE_PLUGIN_SETTINGS['TimesheetDatabase']);
            
                    include ('./includes/header.html');
            Severity: Major
            Found in fannie/modules/plugins2.0/TimesheetPlugin/TsStaffMemReport.php - About 1 day to fix

              File LikeCodeBatchPage.php has 530 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              <?php
              
              include(dirname(__FILE__) . '/../../config.php');
              if (!class_exists('FannieAPI')) {
                  include(__DIR__ . '/../../classlib2.0/FannieAPI.php');
              Severity: Major
              Found in fannie/item/likecodes/LikeCodeBatchPage.php - About 1 day to fix

                Method getFile has 217 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function getFile($filename)
                    {
                        $depositP = $this->dbc->prepare('SELECT normal_price FROM products WHERE upc=?');
                        $settings = $this->config->get('PLUGIN_SETTINGS');
                        $storeID = $this->config->get('STORE_ID');
                Severity: Major
                Found in fannie/modules/plugins2.0/InstaCart/InstaFileV3.php - About 1 day to fix

                  File EquitySalesReport.php has 526 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  <?php
                  /*******************************************************************************
                  
                      Copyright 2012 Whole Foods Co-op
                  
                  
                  Severity: Major
                  Found in fannie/reports/EquitySales/EquitySalesReport.php - About 1 day to fix

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

                        public function get_view()
                        {
                            
                            $ret = "";
                            
                    fannie/modules/plugins2.0/DeliCateringOrders/noauto/DeliCateringOrdersPageBackup0627.php on lines 1444..1502

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

                    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 get_view()
                        {
                            
                            $ret = "";
                            
                    fannie/modules/plugins2.0/DeliCateringOrders/DeliCateringOrdersPage.php on lines 1357..1414

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

                    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 form_content(){
                    
                            global $FANNIE_PLUGIN_SETTINGS;
                    
                            $dbc = FannieDB::get($FANNIE_PLUGIN_SETTINGS['CoopCredDatabase']);
                    fannie/modules/plugins2.0/CoopCred/reports/MemberSummary/MemberSummaryReport.php on lines 539..636

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

                    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 form_content(){
                    
                            global $FANNIE_PLUGIN_SETTINGS;
                    
                            $dbc = FannieDB::get($FANNIE_PLUGIN_SETTINGS['CoopCredDatabase']);
                    fannie/modules/plugins2.0/CoopCred/reports/Liability/LiabilityReport.php on lines 512..609

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

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

                    <?php
                    /*******************************************************************************
                    
                        Copyright 2009,2010 Whole Foods Co-op
                    
                    
                    Severity: Major
                    Found in fannie/batches/newbatch/BatchListPage.php - About 1 day to fix

                      Function handle has a Cognitive Complexity of 55 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public function handle($upc,$json)
                          {
                              $pos = 0;
                              $coupon = new stdClass();
                              $coupon->firstReq = new stdClass();
                      Severity: Minor
                      Found in pos/is4c-nf/lib/Scanning/SpecialUPCs/DatabarCoupon.php - About 1 day 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

                      Severity
                      Category
                      Status
                      Source
                      Language