CORE-POS/IS4C

View on GitHub

Showing 8,297 of 8,298 total issues

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

    protected function get_id_view()
    {
        $settings = $this->config->get('PLUGIN_SETTINGS');
        $prefix = $settings['ObfDatabaseV2'] . $this->connection->sep();
        $week = FormLib::get('week');
Severity: Major
Found in fannie/modules/plugins2.0/OpenBookFinancingV2/ObfDepartmentReport.php - About 2 days to fix

    Function rpOrder has 490 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    var rpOrder = (function ($) {
    
        var mod = {};
        var state = {
            'retention': 60,
    Severity: Major
    Found in fannie/modules/plugins2.0/RP/rpDual.js - About 2 days to fix

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

          private function findItem($vendorID, $name)
          {
              switch ($vendorID) {
                  case -2:
                      return array('sku' => 'DIRECT', 'description' => $name);
      Severity: Major
      Found in fannie/modules/plugins2.0/RP/RpImportCsv.php and 1 other location - About 2 days to fix
      fannie/modules/plugins2.0/RP/RpImport.php on lines 199..246

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

      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

          private function findItem($vendorID, $name)
          {
              switch ($vendorID) {
                  case -2:
                      return array('sku' => 'DIRECT', 'description' => $name);
      Severity: Major
      Found in fannie/modules/plugins2.0/RP/RpImport.php and 1 other location - About 2 days to fix
      fannie/modules/plugins2.0/RP/RpImportCsv.php on lines 202..249

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

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

          public function showEditForm($upc, $display_mode=1, $expand_mode=1)
          {
              $FANNIE_PRODUCT_MODULES = FannieConfig::config('PRODUCT_MODULES', array());
              $upc = BarcodeLib::padUPC($upc);
      
      
      Severity: Major
      Found in fannie/item/modules/BaseItemModule.php - About 2 days to fix

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

            protected function get_view()
            {
                $this->addScript('rpOrder.js?date=20210224');
                $this->addOnloadCommand('rpOrder.initAutoCompletes();');
                $store = FormLib::get('store');
        Severity: Major
        Found in fannie/modules/plugins2.0/RP/RpOrderPage.php - About 2 days to fix

          Function weightedAverages has a Cognitive Complexity of 120 (exceeds 5 allowed). Consider refactoring.
          Open

              private function weightedAverages($dbc)
              {
                  // now do weighted averages
                  $this->cronMsg('Calculating weighted averages', FannieLogger::INFO);
                  $dbc->query('TRUNCATE TABLE productSummaryLastQuarter');
          Severity: Minor
          Found in fannie/cron/tasks/ProductSummarizeLastQuarter.php - About 2 days 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 ajax_display_program has 481 lines of code (exceeds 25 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: Major
          Found in fannie/modules/plugins2.0/CoopCred/programs/CoopCredProgramEditor.php - About 2 days to fix

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

            function additem(category){
                var item = escape(document.getElementById('newitem'+category).value);
                var orderno = document.getElementById('neworderno'+category).value;
                var units = document.getElementById('newunits'+category).value;
                var price = document.getElementById('newprice'+category).value;
            Severity: Major
            Found in fannie/modules/plugins2.0/DeliInventory/index.js and 1 other location - About 2 days to fix
            fannie/modules/plugins2.0/DeliInventory/index3.js on lines 2..29

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

            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 additem(category){
                var item = escape(document.getElementById('newitem'+category).value);
                var orderno = document.getElementById('neworderno'+category).value;
                var units = document.getElementById('newunits'+category).value;
                var price = document.getElementById('newprice'+category).value;
            Severity: Major
            Found in fannie/modules/plugins2.0/DeliInventory/index3.js and 1 other location - About 2 days to fix
            fannie/modules/plugins2.0/DeliInventory/index.js on lines 2..29

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

            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 (FormLib::get('update') == 'Save Text') {
                        $this->signage_obj->saveItems();
                        echo '<html><head></head>
                              <body onload="document.forms[0].submit();">
                              <form method="post" action="' . filter_input(INPUT_SERVER, 'PHP_SELF') . '">';
            Severity: Major
            Found in fannie/admin/labels/SignFromSearch.php and 1 other location - About 2 days to fix
            fannie/admin/labels/SignFromSearch.php on lines 201..236

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

            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 (FormLib::get('update') == 'Save Text') {
                        $this->signage_obj->saveItems();
                        echo '<html><head></head>
                              <body onload="document.forms[0].submit();">
                              <form method="post" action="' . filter_input(INPUT_SERVER, 'PHP_SELF') . '">';
            Severity: Major
            Found in fannie/admin/labels/SignFromSearch.php and 1 other location - About 2 days to fix
            fannie/admin/labels/SignFromSearch.php on lines 123..158

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

            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 HandleDeviceMessage has a Cognitive Complexity of 133 (exceeds 20 allowed). Consider refactoring.
            Open

                protected virtual void HandleDeviceMessage(byte[] msg){
                    if (this.verbose_mode > 0)
                        System.Console.Write("DMSG: {0}: ",current_state);
            
                    if (msg == null) msg = new byte[0];
            Severity: Minor
            Found in pos/is4c-nf/scale-drivers/drivers/NewMagellan/SPH_SignAndPay_USB.cs - About 2 days 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 HandleDeviceMessage has a Cognitive Complexity of 133 (exceeds 20 allowed). Consider refactoring.
            Open

                protected override void HandleDeviceMessage(byte[] msg)
                {
                    if (this.verbose_mode > 0)
                        System.Console.Write("DMSG: {0}: ",current_state);
            
            
            Severity: Minor
            Found in pos/is4c-nf/scale-drivers/drivers/NewMagellan/SPH_SignAndPay_Auto.cs - About 2 days 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($proc as $type => $info) {
                        $record = array('POS Total', 
                                        $type, 
                                        $info['Sales']['num'],
                                        sprintf('%.2f', $info['Sales']['amt']),
            Severity: Major
            Found in fannie/reports/Paycards/PcMonthlyReport.php and 1 other location - About 2 days to fix
            fannie/reports/Paycards/PcDailyReport.php on lines 329..363

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

            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($proc as $type => $info) {
                        $record = array('POS Total', 
                                        $type, 
                                        $info['Sales']['num'],
                                        sprintf('%.2f', $info['Sales']['amt']),
            Severity: Major
            Found in fannie/reports/Paycards/PcDailyReport.php and 1 other location - About 2 days to fix
            fannie/reports/Paycards/PcMonthlyReport.php on lines 342..376

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

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

                public function filter($dbc, $data)
                {
                    $reverseMap = array();
                    $tenderTTL = 0.00;
                    $tax = False;
            Severity: Minor
            Found in pos/is4c-nf/lib/ReceiptBuilding/Filter/DefaultReceiptFilter.php - About 2 days 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 filter has a Cognitive Complexity of 117 (exceeds 5 allowed). Consider refactoring.
            Open

                public function filter($dbc, $data)
                {
                    $reverseMap = array();
                    $tenderTTL = 0.00;
                    $tax = False;
            Severity: Minor
            Found in fannie/modules/plugins2.0/EReceipt/EReceiptFilter.php - About 2 days 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 rpOrder has a Cognitive Complexity of 116 (exceeds 5 allowed). Consider refactoring.
            Open

            var rpOrder = (function ($) {
            
                var mod = {};
                var state = {
                    'retention': 60,
            Severity: Minor
            Found in fannie/modules/plugins2.0/RP/rpFloral.js - About 2 days 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

                public function cleanup($json)
                {
                    switch ($this->conf->get("paycard_mode")) {
                        case PaycardLib::PAYCARD_MODE_BALANCE:
                            $resp = $this->conf->get("paycard_response");
            Severity: Major
            Found in pos/is4c-nf/plugins/Paycards/ValueLink.php and 1 other location - About 2 days to fix
            pos/is4c-nf/plugins/Paycards/MercuryGift.php on lines 172..226

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

            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

            Severity
            Category
            Status
            Source
            Language