CORE-POS/IS4C

View on GitHub

Showing 8,683 of 8,684 total issues

Function drawKeys has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
Open

    private function drawKeys($filter='')
    {
        $launcher = new QuickKeyLauncher($this->session);
        $my_keys = $launcher->getKeys(CoreLocal::get('qkNumber'), $filter);

Severity: Minor
Found in pos/is4c-nf/plugins/QuickKeys/QKDisplay.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

Function body_content has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
Open

    function body_content()
    {
        global $FANNIE_OP_DB, $FANNIE_TRANS_DB, $FANNIE_COOP_ID;
        $dbc = $this->connection;
        $dbc->selectDB($this->config->get('OP_DB'));
Severity: Minor
Found in fannie/reports/SalesAndTaxToday/SalesAndTaxTodayReport.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

Function WFC_Dark_Shelf_Labels has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
Open

function WFC_Dark_Shelf_Labels($data,$offset=0){

$pdf=new WFC_Dark_Shelf_Labels_PDF('P','mm','Letter'); //start new instance of PDF
$pdf->Open(); //open new PDF Document
$pdf->setTagDate(date("m/d/Y"));
Severity: Minor
Found in fannie/admin/labels/pdf_layouts/WFC_Dark_Shelf_Labels.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

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

    public function run()
    {
        $settings = $this->config->get('PLUGIN_SETTINGS');
        $dbc = FannieDB::get($settings['ScheduledEmailDB']);

Severity: Minor
Found in fannie/modules/plugins2.0/ScheduledEmails/ScheduledEmailSendTask.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

Function post_path_current_new_handler has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
Open

    public function post_path_current_new_handler()
    {
        $current = dirname(__FILE__) . '/noauto/queue/' . base64_decode($this->current);
        $save_path = dirname(__FILE__) . '/noauto/save-paths/' . base64_decode($this->path);
        $new = $save_path . '/' . $this->new;
Severity: Minor
Found in fannie/modules/plugins2.0/FileByEmail/FbeProcessQueuePage.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

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

    public function run($args=array())
    {
        $ret = array();
        $errored = $this->checkBasicErrors($args, $ret);
        if ($errored !== false) {
Severity: Minor
Found in fannie/classlib2.0/webservices/FannieEntity.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

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

    public function run($args=array())
    {
        $ret = array();
        if (!property_exists($args, 'type')) {
            // missing required arguments
Severity: Minor
Found in fannie/classlib2.0/webservices/FannieDeptLookup.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

Function showEditForm has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
Open

    public function showEditForm($upc, $display_mode=1, $expand_mode=1)
    {
        $FANNIE_URL = FannieConfig::config('URL');
        $upc = BarcodeLib::padUPC($upc);

Severity: Minor
Found in fannie/item/modules/ProdUserModule.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 ReadCallback has a Cognitive Complexity of 45 (exceeds 20 allowed). Consider refactoring.
Open

    private void ReadCallback(IAsyncResult iar)
    {
        byte[] input = null;
        try {
            input = (byte[])iar.AsyncState;
Severity: Minor
Found in pos/is4c-nf/scale-drivers/drivers/NewMagellan/SPH_IngenicoRBA_USB.cs - 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

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

        foreach ($words as $word) {
           if ($curCnt == 0) {
               $curStr .= $word . " ";
               $length += strlen($word)+1;
           } elseif ($curCnt == 1 && ($length + strlen($word) + 1) < 17) {
Severity: Major
Found in fannie/admin/labels/pdf_layouts/WFC_Hybrid.php and 1 other location - About 4 hrs to fix
fannie/admin/labels/pdf_layouts/WFC_Hybrid_Single.php on lines 414..430

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

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

        foreach ($words as $word) {
           if ($curCnt == 0) {
               $curStr .= $word . " ";
               $length += strlen($word)+1;
           } elseif ($curCnt == 1 && ($length + strlen($word) + 1) < 17) {
Severity: Major
Found in fannie/admin/labels/pdf_layouts/WFC_Hybrid_Single.php and 1 other location - About 4 hrs to fix
fannie/admin/labels/pdf_layouts/WFC_Hybrid.php on lines 443..459

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

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 2013 Whole Foods Co-op

Severity: Major
Found in pos/is4c-nf/lib/models/trans/StaffDiscountAddModel.php and 1 other location - About 4 hrs to fix
pos/is4c-nf/lib/models/trans/StaffDiscountRemoveModel.php on lines 1..125

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

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 2013 Whole Foods Co-op

Severity: Major
Found in pos/is4c-nf/lib/models/trans/StaffDiscountRemoveModel.php and 1 other location - About 4 hrs to fix
pos/is4c-nf/lib/models/trans/StaffDiscountAddModel.php on lines 1..111

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

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Function selectSubmit has 110 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function selectSubmit(selector, myform, filter_selector, leave_submit, custom_callback) {

    var enterDown = 0;
    var enterUp = 0;
    var prevKey = 0;
Severity: Major
Found in pos/is4c-nf/js/selectSubmit.js - About 4 hrs to fix

    Method form_content has 110 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

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

      Method process_file has 110 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          function process_file($linedata, $indexes)
          {
              global $FANNIE_OP_DB;
              $dbc = FannieDB::get($FANNIE_OP_DB);
      
      
      Severity: Major
      Found in fannie/batches/xlsbatch/XlsBatchPage.php - About 4 hrs to fix

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

            protected function get_view()
            {
                $store = FormLib::get('store', false);
                if ($store === false) {
                    $store = Store::getIdByIp();
        Severity: Major
        Found in fannie/modules/plugins2.0/Pickup/ViewPickups.php - About 4 hrs to fix

          Method preprocess has 110 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              function preprocess(){
                  global $FANNIE_OP_DB, $FANNIE_PLUGIN_SETTINGS;
          
                  $ts_db = FannieDB::get($FANNIE_PLUGIN_SETTINGS['TimesheetDatabase']);
          
          
          Severity: Major
          Found in fannie/modules/plugins2.0/TimesheetPlugin/EditTimesheetDatePage.php - About 4 hrs to fix

            Method preprocess has 110 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function preprocess()
                {
                    global $FANNIE_PLUGIN_SETTINGS;
                    $ts_db = FannieDB::get($FANNIE_PLUGIN_SETTINGS['TimesheetDatabase']);
                    $this->header = 'Timeclock - Entry';
            Severity: Major
            Found in fannie/modules/plugins2.0/TimesheetPlugin/TimesheetPage.php - About 4 hrs to fix

              File MemberTypeEditor.php has 350 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              <?php
              /*******************************************************************************
              
                  Copyright 2010,2013 Whole Foods Co-op, Duluth, MN
              
              
              Severity: Minor
              Found in fannie/mem/MemberTypeEditor.php - About 4 hrs to fix
                Severity
                Category
                Status
                Source
                Language