CORE-POS/IS4C

View on GitHub

Showing 8,683 of 8,684 total issues

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

    foreach($data as $k => $row){
        $upc = $row['upc'];
        if ($i % 40 == 0 && $i != 0) {
            $pdf->AddPage('L');
            $x = $left;
Severity: Major
Found in fannie/admin/labels/pdf_layouts/WFC_HerbNspice_Flat.php and 1 other location - About 7 hrs to fix
fannie/admin/labels/pdf_layouts/WFC_Bulk_Repack_14UP.php on lines 53..72

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

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

    function fetch_report_data(){

        //global $FANNIE_TRANS_DB,
        global $FANNIE_OP_DB, $FANNIE_URL;
        global $FANNIE_PLUGIN_SETTINGS;

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

    function preprocess()
    {
        global $FANNIE_COUNTRY, $FANNIE_MEMBER_MODULES, $FANNIE_OP_DB;

        $this->country = (isset($FANNIE_COUNTRY)&&!empty($FANNIE_COUNTRY))?$FANNIE_COUNTRY:"US";
Severity: Minor
Found in fannie/mem/MemberEditor.php - About 7 hrs to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Method body_content has 189 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    function body_content(){
        global $FANNIE_OP_DB, $FANNIE_PLUGIN_SETTINGS;
        $ts_db = FannieDB::get($FANNIE_PLUGIN_SETTINGS['TimesheetDatabase']);

        include('./includes/header.html');
Severity: Major
Found in fannie/modules/plugins2.0/TimesheetPlugin/TsEmployeesReport.php - About 7 hrs to fix

    Method run has 189 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function run()
        {
    
            global $FANNIE_TRANS_DB, $FANNIE_SERVER_DBMS;
            global $FANNIE_PLUGIN_LIST, $FANNIE_PLUGIN_SETTINGS;
    Severity: Major
    Found in fannie/modules/plugins2.0/CoopCred/tasks/CoopCredHistoryTask.php - About 7 hrs to fix

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

          protected function align($description, $comment, $amount, $flags="")
          {
              $amount = sprintf('%.2f',$amount);
              if ($amount=="0.00") $amount="";
      
      
      Severity: Major
      Found in pos/is4c-nf/lib/ReceiptBuilding/Format/ItemReceiptFormat.php and 1 other location - About 7 hrs to fix
      fannie/modules/plugins2.0/EReceipt/Format/ItemEReceiptFormat.php on lines 101..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 236.

      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

          protected function align($description, $comment, $amount, $flags="")
          {
              $amount = sprintf('%.2f',$amount);
              if ($amount=="0.00") $amount="";
      
      
      pos/is4c-nf/lib/ReceiptBuilding/Format/ItemReceiptFormat.php on lines 105..125

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 236.

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

          function body_content(){
              //Should this really be done with global?
              global $FANNIE_PLUGIN_LIST, $FANNIE_PLUGIN_SETTINGS, $FANNIE_OP_DB;
              ob_start();
      
      
      Severity: Major
      Found in fannie/install/InstallPluginsPage.php - About 7 hrs to fix

        Method SaveFormData has 188 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            function SaveFormData($upc)
            {
                /* check if data was submitted */
                if (FormLib::get('s_plu') === '') return False;
        
        
        Severity: Major
        Found in fannie/item/modules/ScaleItemModule.php - About 7 hrs to fix

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

              public function refresh_data($trans_db, $month, $year, $day=False)
              {
                  if ($day) {
                      $str = date('Y-m-d', mktime(0, 0, 0, $month, $day, $year));
                      $this->initDay($str);
          fannie/modules/plugins2.0/CoreWarehouse/models/SmoothedModel.php on lines 55..68

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

          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

              public function refresh_data($trans_db, $month, $year, $day=False)
              {
                  if ($day) {
                      $str = date('Y-m-d', mktime(0, 0, 0, $month, $day, $year));
                      $this->smoothDay($str);
          fannie/modules/plugins2.0/CoreWarehouse/models/WarehouseDatesModel.php on lines 64..77

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

          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 (s.Substring(0,2) == "S1") { // scale message
                      /**
                        The scale supports two primary commands:
                        S11 is "get stable weight". This tells the scale to return
                        the next stable non-zero weight.
          pos/is4c-nf/scale-drivers/drivers/NewMagellan/SPH_Magellan_Scale.cs on lines 211..277

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

          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

                  } else if (s.Substring(0,2) == "S1") { // scale message
                      /**
                        The scale supports two primary commands:
                        S11 is "get stable weight". This tells the scale to return
                        the next stable non-zero weight.
          pos/is4c-nf/scale-drivers/drivers/NewMagellan/SPH_Magellan_WeighOnly.cs on lines 194..260

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

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

          function CalendarControl() {
          
            var calendarId = 'CalendarControl';
            var currentYear = 0;
            var currentMonth = 0;
          Severity: Major
          Found in fannie/modules/plugins2.0/CoopCred/programs/CalendarControl.js - About 7 hrs to fix

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

                public function get_id_view()
                {
                    global $FANNIE_PLUGIN_SETTINGS, $FANNIE_URL;
                    $this->addScript('js/main.js');
                    $ret = '';
            Severity: Major
            Found in fannie/modules/plugins2.0/GiveUsMoneyPlugin/GumMainPage.php - About 7 hrs to fix

              File OwnerJoinLeaveReport.php has 478 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              <?php
              /*******************************************************************************
              
                  Copyright 2014 Whole Foods Co-op
              
              
              Severity: Minor
              Found in fannie/reports/OwnerJoinLeave/OwnerJoinLeaveReport.php - About 7 hrs to fix

                Method run has 186 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function run()
                    {
                        global $FANNIE_OP_DB, $FANNIE_PLUGIN_SETTINGS;
                        $dbc = FannieDB::get($FANNIE_OP_DB);
                
                
                Severity: Major
                Found in fannie/modules/plugins2.0/UnfiInvoiceGrabber/UIGTask.php - About 7 hrs to fix

                  Method showEditForm has 186 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function showEditForm($upc, $display_mode=1, $expand_mode=1)
                      {
                          $upc = BarcodeLib::padUPC($upc);
                  
                          $dbc = $this->db();
                  Severity: Major
                  Found in fannie/item/modules/ScaleItemModule.php - About 7 hrs to fix

                    Function getTable has a Cognitive Complexity of 48 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function getTable()
                        {
                            $this->addScript('pricing-batch-II.js');
                            $dbc = $this->connection;
                            $dbc->selectDB($this->config->OP_DB);
                    Severity: Minor
                    Found in fannie/batches/UNFI/VPBPIV.php - About 7 hrs to fix

                    Cognitive Complexity

                    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                    A method's cognitive complexity is based on a few simple rules:

                    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                    • Code is considered more complex for each "break in the linear flow of the code"
                    • Code is considered more complex when "flow breaking structures are nested"

                    Further reading

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

                        public function body_content()
                        {
                            global $FANNIE_OP_DB, $FANNIE_URL;
                            ob_start();
                            $dbc = FannieDB::get($FANNIE_OP_DB);

                    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