CORE-POS/IS4C

View on GitHub

Showing 8,683 of 8,684 total issues

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

    if (count($lines) > 1) {
        $pdf->SetXY($x,$y+13);
        $pdf->Cell($width, 5, $lines[0], 0, 1, 'C', true); 
        $pdf->SetXY($x, $y+19);
        $pdf->Cell($width, 5, $lines[1], 0, 1, 'C', true); 
Severity: Major
Found in fannie/admin/labels/pdf_layouts/New_WFC_Deli_Narrow.php and 1 other location - About 4 hrs to fix
fannie/admin/labels/pdf_layouts/New_WFC_Deli_Regular.php on lines 305..313

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

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 ($dbc->connections[$lane[$db]]) {
                $success = $dbc->transfer($lane[$db],
                           "SELECT * FROM $table",
                           $server_db,
                           "INSERT INTO $table");
fannie/classlib2.0/data/SyncLanes.php on lines 225..241

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

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 ($dbc->connections[$lane[$db]]) {
                $success = $dbc->transfer($lane[$db],
                           "SELECT * FROM $table",
                           $server_db,
                           "INSERT INTO $table");
Severity: Major
Found in fannie/classlib2.0/data/SyncLanes.php and 1 other location - About 4 hrs to fix
fannie/modules/plugins2.0/CoopCred/sync/SyncLanesForPlugin.php on lines 314..330

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

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

<?php

use COREPOS\Fannie\API\item\ItemText;

class InstaFileV3
Severity: Minor
Found in fannie/modules/plugins2.0/InstaCart/InstaFileV3.php - About 4 hrs to fix

    File receipt.php has 345 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    use COREPOS\pos\install\conf\Conf;
    use COREPOS\pos\install\conf\FormFactory;
    use COREPOS\pos\install\InstallUtilities;
    use COREPOS\pos\lib\CoreState;
    Severity: Minor
    Found in pos/is4c-nf/install/receipt.php - About 4 hrs to fix

      File SalesBatchTask.php has 345 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      <?php
      /*******************************************************************************
      
          Copyright 2014 Whole Foods Co-op
      
      
      Severity: Minor
      Found in fannie/cron/tasks/SalesBatchTask.php - About 4 hrs to fix

        Method WFC_Produce_Single has 107 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function WFC_Produce_Single($data,$offset=0){
        
        $pdf=new WFC_Produce_Single_PDF('L','mm',array(25.4, 53.975)); //start new instance of PDF
        $pdf->Open(); //open new PDF Document
        $pdf->setTagDate(date("m/d/Y"));
        Severity: Major
        Found in fannie/admin/labels/pdf_layouts/WFC_Produce_Single.php - About 4 hrs to fix

          File TenderEditor.php has 345 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          <?php
          /*******************************************************************************
          
              Copyright 2010 Whole Foods Co-op
          
          
          Severity: Minor
          Found in fannie/admin/Tenders/TenderEditor.php - About 4 hrs to fix

            Method post_view has 107 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                protected function post_view()
                {
                    $file = $_FILES['invoice']['tmp_name'];
                    $type = $_FILES['invoice']['type'];
                    $store = FormLib::get('store');
            Severity: Major
            Found in fannie/purchasing/importers/UsFoodsInvoiceImport.php - About 4 hrs to fix

              Method doc has 107 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function doc()
                  {
                      return '
              Use:
              This table lists items in the system.
              Severity: Major
              Found in fannie/classlib2.0/data/models/op/ProductsModel.php - About 4 hrs to fix

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

                        if (!empty($units)){
                            if ($units[strlen($units)-1] == '#' && 
                                $fraction[strlen($fraction)-1] == '#' && $units != 0){
                                $partial = substr($fraction,0,strlen($fraction)-1) / substr($units,0,strlen($units)-1);
                                $stocktotal = $cases + $partial;        
                fannie/modules/plugins2.0/DeliInventory/DeliInventoryPage.php on lines 113..123

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

                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 (!empty($units)){
                            if ($units[strlen($units)-1] == '#' && 
                                $fraction[strlen($fraction)-1] == '#' && $units != 0){
                                $partial = substr($fraction,0,strlen($fraction)-1) / substr($units,0,strlen($units)-1);
                                $stocktotal = $cases + $partial;        
                fannie/modules/plugins2.0/DeliInventory/DeliInventoryPage.php on lines 66..76

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

                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 handleResponseDataCap has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function handleResponseDataCap($xml)
                    {
                        $rawXml = $xml;
                        $ref = $this->refnum($this->conf->get('paycard_id'));
                        $transID = $this->conf->get('paycard_id');
                Severity: Minor
                Found in pos/is4c-nf/plugins/Paycards/MercuryDC.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 prepareDataCapVoid has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function prepareDataCapVoid($pcID)
                    {
                        $dbc = Database::tDataConnect();
                        $prep = $dbc->prepare('SELECT transNo, registerNo FROM PaycardTransactions WHERE paycardTransactionID=?');
                        $row = $dbc->getRow($prep, $pcID);
                Severity: Minor
                Found in pos/is4c-nf/plugins/Paycards/MercuryDC.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 parse has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function parse($str)
                    {
                        $ret = $this->default_json();
                        if ($this->conf->get("ttlflag") != 1 && substr($str, 0, 9) !== 'PVDATACAP') { // must subtotal before running card
                            $ret['output'] = PaycardLib::paycardMsgBox("No Total",
                Severity: Minor
                Found in pos/is4c-nf/plugins/Paycards/lib/PaycardDatacapParser.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 selectField has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function selectField($name, $options, $default_value='', $storage=Conf::EITHER_SETTING, $quoted=true, $attributes=array())
                    {
                        $current_value = $this->getCurrentValue($name, $default_value, $quoted);
                
                        $is_array = false;
                Severity: Minor
                Found in pos/is4c-nf/install/conf/FormFactory.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 addItem has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function addItem(array $row, $quantity, $priceObj)
                    {
                        if ($quantity == 0) {
                            return false;
                        }
                Severity: Minor
                Found in pos/is4c-nf/lib/Scanning/PriceMethods/ABGroupPM.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 29 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function run()
                    {
                        $sql = FannieDB::get($this->config->get('OP_DB'));
                
                        $chk_vital = array();
                Severity: Minor
                Found in fannie/cron/tasks/PriceBatchTask.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 getBathchesBySuperDept has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
                Open

                    private function getBathchesBySuperDept($superDepts,$contacts)
                    {
                        $dbc = FannieDB::get($this->config->get('OP_DB'));
                        $date = date('Y-m-d').' 00:00:00';
                        $d = date('d');
                Severity: Minor
                Found in fannie/cron/tasks/EndSalesBatchAlertTask.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 results_content has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function results_content()
                    {
                        global $FANNIE_OP_DB;
                        $dbc = FannieDB::get($FANNIE_OP_DB);
                        $start = date('Y-m-d', strtotime(FormLib::get_form_value('start',date('Y-m-d'))));
                Severity: Minor
                Found in fannie/batches/CAP/CoopDealsReviewPage.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

                Severity
                Category
                Status
                Source
                Language