CORE-POS/IS4C

View on GitHub

Showing 8,683 of 8,684 total issues

Function etl has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
Open

    public function etl($config)
    {
        $settings = $config->get('PLUGIN_SETTINGS');
        $mydb = $settings['MyWebDB'] . $this->connection->sep();
        $opdb = $config->get('OP_DB') . $this->connection->sep();
Severity: Minor
Found in fannie/modules/plugins2.0/MyWeb/models/MyStatsModel.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 ajax_display_program has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
Open

    private function ajax_display_program($id){
        global $FANNIE_PLUGIN_SETTINGS, $FANNIE_URL, $FANNIE_OP_DB;

        $dbc = FannieDB::get($FANNIE_PLUGIN_SETTINGS['CoopCredDatabase']);

Severity: Minor
Found in fannie/modules/plugins2.0/CoopCred/programs/CoopCredProgramEditor.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 get_id_handler has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
Open

    protected function get_id_handler()
    {
        $ret = array();
        $settings = $this->config->get('PLUGIN_SETTINGS');
        if ($this->id !== '') {
Severity: Minor
Found in fannie/modules/plugins2.0/ShelfAudit/SaHandheldPage.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_view has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
Open

    protected function post_view()
    {
        $parser = new Parser();
        $pdf = $parser->parseFile($_FILES['pdf']['tmp_name']);
        $text = $pdf->getText();
Severity: Minor
Found in fannie/purchasing/importers/RdwInvoiceImport.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 processUpload has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
Open

    protected function processUpload() 
    {
        /* use a dedicated temp directory */
        $tpath = sys_get_temp_dir().'/fannie/';
        if (!is_dir($tpath)) {
Severity: Minor
Found in fannie/classlib2.0/FannieUploadPage.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 pricePerUnit has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
Open

    public static function pricePerUnit($price,$sizeStr)
    {
        $country = \FannieConfig::factory()->get('COUNTRY', 'US');

        $num = "";
Severity: Minor
Found in fannie/classlib2.0/lib/PriceLib.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 get_view has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
Open

    public function get_view()
    {
        global $FANNIE_OP_DB, $FANNIE_TRANS_DB;
        $dbc = FannieDB::get($FANNIE_OP_DB);
        $TRANS = $FANNIE_TRANS_DB . $dbc->sep();
Severity: Minor
Found in fannie/ordering/OldSpecialOrdersPage.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

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

function manyResultForm(data){
    var selectText = '<select onchange="showResultForm(this.value);">';
    var divs = '';
    for(var i=0; i<data.length;i++){
        selectText += '<option value="'+i+'">';
Severity: Major
Found in fannie/purchasing/js/editmany.js and 1 other location - About 4 hrs to fix
fannie/purchasing/js/editone.js on lines 45..56

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

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

function manyResultForm(data){
    var selectText = '<select onchange="showResultForm(this.value);">';
    var divs = '';
    for(var i=0; i<data.length;i++){
        selectText += '<option value="'+i+'">';
Severity: Major
Found in fannie/purchasing/js/editone.js and 1 other location - About 4 hrs to fix
fannie/purchasing/js/editmany.js on lines 55..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 133.

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

function updateChangeOrder(d){
    var newval = Number(document.getElementById('changeOrder'+d).value);
    
    var v = Number(document.getElementById('safeCount1'+d).value) + newval;
    document.getElementById('cashInTills'+d).innerHTML = Math.round(v*100)/100;
Severity: Major
Found in fannie/modules/plugins2.0/OverShortTools/js/countV3.js and 1 other location - About 4 hrs to fix
fannie/modules/plugins2.0/OverShortTools/js/countV2.js on lines 107..118

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

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

function updateChangeOrder(d){
    var newval = Number(document.getElementById('changeOrder'+d).value);
    
    var v = Number(document.getElementById('safeCount1'+d).value) + newval;
    document.getElementById('cashInTills'+d).innerHTML = Math.round(v*100)/100;
Severity: Major
Found in fannie/modules/plugins2.0/OverShortTools/js/countV2.js and 1 other location - About 4 hrs to fix
fannie/modules/plugins2.0/OverShortTools/js/countV3.js on lines 110..121

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

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(FormLib::get('departments')) && count(FormLib::get('departments')) > 0) {
                        $query .= ' AND t.department IN (';
                        foreach (FormLib::get('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 767..778

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

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(FormLib::get('departments')) && count(FormLib::get('departments')) > 0) {
                        $query .= ' AND t.department IN (';
                        foreach (FormLib::get('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 753..764

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

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 batchListDisplay has 122 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    function batchListDisplay($filter='', $mode='', $maxBatchID='')
    {
        global $FANNIE_URL;
        $dbc = $this->con;

Severity: Major
Found in fannie/batches/newbatch/BatchListPage.php - About 4 hrs to fix

    File BatchReport.php has 370 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    /*******************************************************************************
    
        Copyright 2012 Whole Foods Co-op
    
    
    Severity: Minor
    Found in fannie/reports/BatchReport/BatchReport.php - About 4 hrs to fix

      Method doInsert has 122 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          function doInsert($dtrans,$amount,$department,$cardno,$comment=''){
              global $FANNIE_OP_DB, $FANNIE_TRANS_DB;
              $dbc = FannieDB::get($FANNIE_TRANS_DB);
              $OP = $FANNIE_OP_DB.$dbc->sep();
      
      
      Severity: Major
      Found in fannie/modules/plugins2.0/CoopCred/membership/CoopCredInputTool.php - About 4 hrs to fix

        Method doInsert has 122 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            function doInsert($dtrans,$amount,$department,$cardno,$comment=''){
                global $FANNIE_OP_DB, $FANNIE_TRANS_DB;
                $dbc = FannieDB::get($FANNIE_TRANS_DB);
                $OP = $FANNIE_OP_DB.$dbc->sep();
        
        

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

              protected function get_view()
              {
                  $settings = $this->config->get('PLUGIN_SETTINGS');
                  $table = $settings['IncidentDB'] . $this->connection->sep();
                  $query = "SELECT i.*, 
          Severity: Major
          Found in fannie/modules/plugins2.0/IncidentTracker/PosIncident.php - About 4 hrs to fix

            Method get_toIDs_handler has 122 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function get_toIDs_handler()
                {
                    $dbc = $this->connection;
                    $dbc->selectDB($this->config->get('OP_DB'));
                    $TRANS = $this->config->get('TRANS_DB').$dbc->sep();
            Severity: Major
            Found in fannie/ordering/SpecialOrderTags.php - About 4 hrs to fix

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

                  function get_view()
                  {
                      global $FANNIE_OP_DB, $FANNIE_TRANS_DB;
              
                      /**
              Severity: Major
              Found in fannie/item/BadScanTool.php - About 4 hrs to fix
                Severity
                Category
                Status
                Source
                Language