CORE-POS/IS4C

View on GitHub
fannie/classlib2.0/FannieUploadPage.php

Summary

Maintainability
F
1 wk
Test Coverage
F
15%

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

    public function preprocess()
    {
        $col_select = \FormLib::get_form_value('cs','');
        $this->finishPreviewOpts();

Severity: Minor
Found in fannie/classlib2.0/FannieUploadPage.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

File FannieUploadPage.php has 606 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/*******************************************************************************

    Copyright 2013 Whole Foods Co-op

Severity: Major
Found in fannie/classlib2.0/FannieUploadPage.php - About 1 day to fix

    Method preprocess has 147 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function preprocess()
        {
            $col_select = \FormLib::get_form_value('cs','');
            $this->finishPreviewOpts();
    
    
    Severity: Major
    Found in fannie/classlib2.0/FannieUploadPage.php - About 5 hrs to fix

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

          protected function processUpload() 
          {
              /* use a dedicated temp directory */
              $tpath = sys_get_temp_dir().'/fannie/';
              if (!is_dir($tpath)) {
      Severity: Minor
      Found in fannie/classlib2.0/FannieUploadPage.php - About 4 hrs to fix

      Cognitive Complexity

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

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

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

      Further reading

      Method processUpload has 98 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          protected function processUpload() 
          {
              /* use a dedicated temp directory */
              $tpath = sys_get_temp_dir().'/fannie/';
              if (!is_dir($tpath)) {
      Severity: Major
      Found in fannie/classlib2.0/FannieUploadPage.php - About 3 hrs to fix

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

            protected function basicPreview()
            {
                $ret = '<h3>Select columns</h3>';
                /* show any errors */
                if ($this->error_details != 'n/a' && $this->error_details != '') {
        Severity: Minor
        Found in fannie/classlib2.0/FannieUploadPage.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

        FannieUploadPage has 28 functions (exceeds 20 allowed). Consider refactoring.
        Open

        class FannieUploadPage extends \FanniePage 
        {
        
            public $required = true;
        
        
        Severity: Minor
        Found in fannie/classlib2.0/FannieUploadPage.php - About 3 hrs to fix

          Method basicPreview has 61 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              protected function basicPreview()
              {
                  $ret = '<h3>Select columns</h3>';
                  /* show any errors */
                  if ($this->error_details != 'n/a' && $this->error_details != '') {
          Severity: Major
          Found in fannie/classlib2.0/FannieUploadPage.php - About 2 hrs to fix

            Method javascript_content has 39 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function javascript_content()
                {
                    ob_start();
                    ?>
                    $(document).ready(function(){
            Severity: Minor
            Found in fannie/classlib2.0/FannieUploadPage.php - About 1 hr to fix

              Function finishPreviewOpts has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Open

                  private function finishPreviewOpts()
                  {
                      foreach ($this->preview_opts as $k=>$v) {
                          if (!isset($this->preview_opts[$k]['name'])) {
                              $this->preview_opts[$k]['name'] = $k;
              Severity: Minor
              Found in fannie/classlib2.0/FannieUploadPage.php - About 55 mins 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 ajaxContent has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function ajaxContent()
                  {
                      $ret = '<div id="progressDiv">
                          <span id="uploadingSpan"></span><span id="numLines"></span><br />
                          <span id="progressSpan"></span><span id="numRecords"></span><br />
              Severity: Minor
              Found in fannie/classlib2.0/FannieUploadPage.php - About 35 mins 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

              Avoid too many return statements within this method.
              Open

                          return false;
              Severity: Major
              Found in fannie/classlib2.0/FannieUploadPage.php - About 30 mins to fix

                Avoid too many return statements within this method.
                Open

                        return true;
                Severity: Major
                Found in fannie/classlib2.0/FannieUploadPage.php - About 30 mins to fix

                  Avoid too many return statements within this method.
                  Open

                                              $url .= array_reduce($col_select, function($carry, $item){ return $carry . 'cs[]=' . $item . '&'; }, '');
                  Severity: Major
                  Found in fannie/classlib2.0/FannieUploadPage.php - About 30 mins to fix

                    Avoid too many return statements within this method.
                    Open

                                    return false;
                    Severity: Major
                    Found in fannie/classlib2.0/FannieUploadPage.php - About 30 mins to fix

                      Avoid too many return statements within this method.
                      Open

                                              return true;
                      Severity: Major
                      Found in fannie/classlib2.0/FannieUploadPage.php - About 30 mins to fix

                        Avoid too many return statements within this method.
                        Open

                                                    $url .= array_reduce($files, function($carry, $item){ return $carry . 'f[]=' . $item . '&'; }, '');
                        Severity: Major
                        Found in fannie/classlib2.0/FannieUploadPage.php - About 30 mins to fix

                          Avoid too many return statements within this method.
                          Open

                                                      return false;
                          Severity: Major
                          Found in fannie/classlib2.0/FannieUploadPage.php - About 30 mins to fix

                            Avoid too many return statements within this method.
                            Open

                                        return false;
                            Severity: Major
                            Found in fannie/classlib2.0/FannieUploadPage.php - About 30 mins to fix

                              Avoid too many return statements within this method.
                              Open

                                          return array();
                              Severity: Major
                              Found in fannie/classlib2.0/FannieUploadPage.php - About 30 mins to fix

                                Avoid too many return statements within this method.
                                Open

                                            return false;
                                Severity: Major
                                Found in fannie/classlib2.0/FannieUploadPage.php - About 30 mins to fix

                                  Avoid too many return statements within this method.
                                  Open

                                          return true;
                                  Severity: Major
                                  Found in fannie/classlib2.0/FannieUploadPage.php - About 30 mins to fix

                                    There are no issues that match your filters.

                                    Category
                                    Status