CORE-POS/IS4C

View on GitHub

Showing 8,683 of 8,684 total issues

Method editableItemList has 90 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function editableItemList($orderID)
{
    global $FANNIE_OP_DB, $TRANS;
    $dbc = FannieDB::get($FANNIE_OP_DB);

Severity: Major
Found in fannie/ordering/ajax-calls.php - About 3 hrs to fix

    Method javascriptContent has 90 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function javascriptContent()
        {
            return <<<JAVASCRIPT
    $('#upc').keyup(function(e){
        var upc = $(this).val();
    Severity: Major
    Found in fannie/item/WFC-Uproducts/NewClassPage.php - About 3 hrs to fix

      Method ConnectClient has 90 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              private void ConnectClient(IAsyncResult state)
              {
                  TcpClient client;
                  try {
                      TcpListener server = (TcpListener)state.AsyncState;
      Severity: Major
      Found in pos/is4c-nf/scale-drivers/drivers/NewMagellan/WebSocketServer.cs - About 3 hrs to fix

        Method WriteSchema has 90 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                public void WriteSchema(JsonSchema schema)
                {
                    ValidationUtils.ArgumentNotNull(schema, "schema");
        
                    if (!_resolver.LoadedSchemas.Contains(schema))

          Method HandleReadData has 90 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              protected void HandleReadData(byte[] input){
                  int msg_sum = 0;
                  if (usb_report_size == 64){
                      byte[] temp_in = new byte[65];
                      temp_in[0] = 0;
          Severity: Major
          Found in pos/is4c-nf/scale-drivers/drivers/NewMagellan/SPH_SignAndPay_USB.cs - About 3 hrs to fix

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

                            if (ev.shiftKey) {
                                var next = $(openInput).prev('td.editable').get(0);
                                if (!next) {
                                    var next = $(openInput).closest('tr').prev('tr').find('td.cost').get(0);
                                }
            Severity: Major
            Found in fannie/modules/plugins2.0/DeliInventory/di.js and 1 other location - About 3 hrs to fix
            fannie/modules/plugins2.0/DeliInventory/di.js on lines 132..141

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

            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 saveCategory(category){
                var newcat = document.getElementById('renameCategory'+category).value;
                var dstr = 'action=saveCategory&oldcat='+category+'&newcat='+newcat;
                $.ajax({
                    url: 'DeliInventoryPage.php',
            Severity: Major
            Found in fannie/modules/plugins2.0/DeliInventory/index.js and 1 other location - About 3 hrs to fix
            fannie/modules/plugins2.0/DeliInventory/index3.js on lines 135..145

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

            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 saveCategory(category){
                var newcat = document.getElementById('renameCategory'+category).value;
                var dstr = 'action=saveCategory&oldcat='+category+'&newcat='+newcat;
                $.ajax({
                    url: 'DeliInventoryPage2.php',
            Severity: Major
            Found in fannie/modules/plugins2.0/DeliInventory/index3.js and 1 other location - About 3 hrs to fix
            fannie/modules/plugins2.0/DeliInventory/index.js on lines 135..145

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

            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

                            } else {
                                var next = $(openInput).next('td.editable').get(0);
                                if (!next) {
                                    var next = $(openInput).closest('tr').next('tr').find('td.editable').get(0);
                                }
            Severity: Major
            Found in fannie/modules/plugins2.0/DeliInventory/di.js and 1 other location - About 3 hrs to fix
            fannie/modules/plugins2.0/DeliInventory/di.js on lines 123..132

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

            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 ($dots[$upc] == 'REFRIGERATED' && $store == 2) {
                        $pdf->SetFillColor(0, 100, 255); // blue
                        $pdf->Circle($baseX+27.5, $baseY-10, 1.25, 'F');
                        $pdf->SetFillColor(255,255,255);
                        $pdf->SetTextColor(255,255,255);
            Severity: Major
            Found in fannie/admin/labels/pdf_layouts/WFC_Hybrid.php and 1 other location - About 3 hrs to fix
            fannie/admin/labels/pdf_layouts/WFC_Hybrid_Single.php on lines 442..451

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

            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 ($dots[$upc] == 'REFRIGERATED' && $store == 2) {
                        $pdf->SetFillColor(0, 100, 255); // blue
                        $pdf->Circle($baseX+27.5, $baseY-10, 1.25, 'F');
                        $pdf->SetFillColor(255,255,255);
                        $pdf->SetTextColor(255,255,255);
            Severity: Major
            Found in fannie/admin/labels/pdf_layouts/WFC_Hybrid_Single.php and 1 other location - About 3 hrs to fix
            fannie/admin/labels/pdf_layouts/WFC_Hybrid.php on lines 476..485

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

            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

                    foreach($FANNIE_LANES as $lane) {
                        $laneNumber++;
                        $lane['op'] = $coopCredLaneDatabase;
                        $sql = new SQLManager($lane['host'],$lane['type'],$lane['op'],
                                    $lane['user'],$lane['pw']);    
            fannie/modules/plugins2.0/CoopCred/models/CCredMembershipsModel.php on lines 98..114

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

            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 (CoreLocal::get('laneno') === '') {
                            // no store_id set. assign based on IP
                            CoreLocal::set('laneno', $map[$ip]['register_id']);
                            $lane_id_is_mapped = true;
                        } else if (CoreLocal::get('laneno') != $map[$ip]['register_id']) {
            Severity: Major
            Found in pos/is4c-nf/install/index.php and 1 other location - About 3 hrs to fix
            pos/is4c-nf/install/index.php on lines 87..97

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

            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

                    foreach($FANNIE_LANES as $lane) {
                        $laneNumber++;
                        $lane['op'] = $coopCredLaneDatabase;
                        $sql = new SQLManager($lane['host'],$lane['type'],$lane['op'],
                                    $lane['user'],$lane['pw']);    
            fannie/modules/plugins2.0/CoopCred/models/CCredProgramsModel.php on lines 111..127

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

            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

                        $data[] = array(
                            'Hours',
                            '',
                            number_format($proj_hours, 0),
                            '',
            fannie/modules/plugins2.0/OpenBookFinancing/ObfWeeklyReport.php on lines 464..478

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

            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 (CoreLocal::get('store_id') === '') {
                            // no store_id set. assign based on IP
                            CoreLocal::set('store_id', $map[$ip]['store_id']);
                            $store_id_is_mapped = true;
                        } else if (CoreLocal::get('store_id') != $map[$ip]['store_id']) {
            Severity: Major
            Found in pos/is4c-nf/install/index.php and 1 other location - About 3 hrs to fix
            pos/is4c-nf/install/index.php on lines 98..110

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

            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

                        $data[] = array(
                            'Wages',
                            '',
                            number_format($proj_wages, 0),
                            '',
            fannie/modules/plugins2.0/OpenBookFinancing/ObfWeeklyReport.php on lines 446..460

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

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

            <?php
            /*******************************************************************************
            
                Copyright 2013 Whole Foods Co-op
            
            
            Severity: Minor
            Found in fannie/reports/StoreSummary/StoreSummaryReportAlt.php - About 3 hrs to fix

              Function preprocess has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
              Open

                  function preprocess()
                  {
                      // check for posts before drawing anything, so we can redirect
                      if (FormLib::get('reginput', false) !== false) {
                          $input = strtoupper(trim(FormLib::get('reginput')));
              Severity: Minor
              Found in pos/is4c-nf/plugins/Paycards/gui/paycardboxMsgVoid.php - About 3 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 message has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function message($val, $ref, $reprint=False){
              
                      global $CORE_LOCAL;
              
                      if ($val == 0) {
              Severity: Minor
              Found in pos/is4c-nf/plugins/CoopCred/receiptMessages/CCredUsedBalances.php - About 3 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