GemsTracker/gemstracker-library

View on GitHub
classes/Gems/Export/StreamingStataExport.php

Summary

Maintainability
F
6 days
Test Coverage
F
0%

Function addRowWithCount has a Cognitive Complexity of 66 (exceeds 5 allowed). Consider refactoring.
Open

    public function addRowWithCount($row, $writer, $rowNumber)
    {
        $exportRow   = $this->filterRow($row);
        $labeledCols = $this->getLabeledColumns();
        $exportRow   = array_replace(array_flip($labeledCols), $exportRow);
Severity: Minor
Found in classes/Gems/Export/StreamingStataExport.php - About 1 day 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 StreamingStataExport.php has 507 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

namespace Gems\Export;

use XMLWriter;
Severity: Major
Found in classes/Gems/Export/StreamingStataExport.php - About 1 day to fix

    Method createHeaderFile has 120 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        protected function createHeaderFile(XMLWriter $writer, $filename)
        {
            $columnHeaders = $this->getColumnHeaders();       
    
            if ($this->batch) {
    Severity: Major
    Found in classes/Gems/Export/StreamingStataExport.php - About 4 hrs to fix

      Function createHeaderFile has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
      Open

          protected function createHeaderFile(XMLWriter $writer, $filename)
          {
              $columnHeaders = $this->getColumnHeaders();       
      
              if ($this->batch) {
      Severity: Minor
      Found in classes/Gems/Export/StreamingStataExport.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

      The class StreamingStataExport has an overall complexity of 98 which is very high. The configured complexity threshold is 50.
      Open

      class StreamingStataExport extends ExportAbstract
      {
          protected $stataFileVersion = 117;
      
          protected $maxStringLength = 2045;

      Function addRows has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
      Open

          public function addRows($data, $modelId, $tempFilename, $filter)
          {
              $this->data = $data;
              $this->modelId = $modelId;
              $this->model = $this->getModel();
      Severity: Minor
      Found in classes/Gems/Export/StreamingStataExport.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

      Method addRowWithCount has 73 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function addRowWithCount($row, $writer, $rowNumber)
          {
              $exportRow   = $this->filterRow($row);
              $labeledCols = $this->getLabeledColumns();
              $exportRow   = array_replace(array_flip($labeledCols), $exportRow);
      Severity: Major
      Found in classes/Gems/Export/StreamingStataExport.php - About 2 hrs to fix

        Function preprocessModel has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
        Open

            protected function preprocessModel()
            {
                parent::preprocessModel();
                
                $labeledCols = $this->getLabeledColumns();
        Severity: Minor
        Found in classes/Gems/Export/StreamingStataExport.php - About 2 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 getColumnHeaders has 50 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            protected function getColumnHeaders()
            {
                $model = $this->getModel();
                $labeledCols = $this->getLabeledColumns();
        
        
        Severity: Minor
        Found in classes/Gems/Export/StreamingStataExport.php - About 2 hrs to fix

          Method addRows has 47 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function addRows($data, $modelId, $tempFilename, $filter)
              {
                  $this->data = $data;
                  $this->modelId = $modelId;
                  $this->model = $this->getModel();
          Severity: Minor
          Found in classes/Gems/Export/StreamingStataExport.php - About 1 hr to fix

            Method preprocessModel has 45 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                protected function preprocessModel()
                {
                    parent::preprocessModel();
                    
                    $labeledCols = $this->getLabeledColumns();
            Severity: Minor
            Found in classes/Gems/Export/StreamingStataExport.php - About 1 hr to fix

              Function getColumnHeaders has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
              Open

                  protected function getColumnHeaders()
                  {
                      $model = $this->getModel();
                      $labeledCols = $this->getLabeledColumns();
              
              
              Severity: Minor
              Found in classes/Gems/Export/StreamingStataExport.php - About 1 hr 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 addNestedRows has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function addNestedRows($rows, $nestedNames)
                  {
                      $flattenedRows = array();
                      foreach($rows as $row) {
                          $flattenedRow = array();
              Severity: Minor
              Found in classes/Gems/Export/StreamingStataExport.php - About 1 hr 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 addFooter has 32 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function addFooter($filename, $modelId = null, $data = null)
                  {   
                      $tempFilename = str_replace($this->fileExtension, '', $filename);
                      $this->model = $this->getModel();
                      $this->modelId = $modelId;
              Severity: Minor
              Found in classes/Gems/Export/StreamingStataExport.php - About 1 hr to fix

                Method addExport has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function addExport($data, $modelId = false)
                    {
                
                        $this->files   = $this->getFiles();
                        $this->data    = $data;
                Severity: Minor
                Found in classes/Gems/Export/StreamingStataExport.php - About 1 hr to fix

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

                      public function addExport($data, $modelId = false)
                      {
                  
                          $this->files   = $this->getFiles();
                          $this->data    = $data;
                  Severity: Minor
                  Found in classes/Gems/Export/StreamingStataExport.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

                  The method addRows() has an NPath complexity of 258. The configured NPath complexity threshold is 200.
                  Open

                      public function addRows($data, $modelId, $tempFilename, $filter)
                      {
                          $this->data = $data;
                          $this->modelId = $modelId;
                          $this->model = $this->getModel();

                  NPathComplexity

                  Since: 0.1

                  The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.

                  Example

                  class Foo {
                      function bar() {
                          // lots of complicated code
                      }
                  }

                  Source https://phpmd.org/rules/codesize.html#npathcomplexity

                  The method addRowWithCount() has an NPath complexity of 2690. The configured NPath complexity threshold is 200.
                  Open

                      public function addRowWithCount($row, $writer, $rowNumber)
                      {
                          $exportRow   = $this->filterRow($row);
                          $labeledCols = $this->getLabeledColumns();
                          $exportRow   = array_replace(array_flip($labeledCols), $exportRow);

                  NPathComplexity

                  Since: 0.1

                  The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.

                  Example

                  class Foo {
                      function bar() {
                          // lots of complicated code
                      }
                  }

                  Source https://phpmd.org/rules/codesize.html#npathcomplexity

                  The method createHeaderFile() has an NPath complexity of 2112. The configured NPath complexity threshold is 200.
                  Open

                      protected function createHeaderFile(XMLWriter $writer, $filename)
                      {
                          $columnHeaders = $this->getColumnHeaders();       
                  
                          if ($this->batch) {

                  NPathComplexity

                  Since: 0.1

                  The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.

                  Example

                  class Foo {
                      function bar() {
                          // lots of complicated code
                      }
                  }

                  Source https://phpmd.org/rules/codesize.html#npathcomplexity

                  The method createHeaderFile() has 153 lines of code. Current threshold is set to 100. Avoid really long methods.
                  Open

                      protected function createHeaderFile(XMLWriter $writer, $filename)
                      {
                          $columnHeaders = $this->getColumnHeaders();       
                  
                          if ($this->batch) {

                  The method addRowWithCount() has a Cyclomatic Complexity of 23. The configured cyclomatic complexity threshold is 10.
                  Open

                      public function addRowWithCount($row, $writer, $rowNumber)
                      {
                          $exportRow   = $this->filterRow($row);
                          $labeledCols = $this->getLabeledColumns();
                          $exportRow   = array_replace(array_flip($labeledCols), $exportRow);

                  CyclomaticComplexity

                  Since: 0.1

                  Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.

                  Example

                  // Cyclomatic Complexity = 11
                  class Foo {
                  1   public function example() {
                  2       if ($a == $b) {
                  3           if ($a1 == $b1) {
                                  fiddle();
                  4           } elseif ($a2 == $b2) {
                                  fiddle();
                              } else {
                                  fiddle();
                              }
                  5       } elseif ($c == $d) {
                  6           while ($c == $d) {
                                  fiddle();
                              }
                  7        } elseif ($e == $f) {
                  8           for ($n = 0; $n < $h; $n++) {
                                  fiddle();
                              }
                          } else {
                              switch ($z) {
                  9               case 1:
                                      fiddle();
                                      break;
                  10              case 2:
                                      fiddle();
                                      break;
                  11              case 3:
                                      fiddle();
                                      break;
                                  default:
                                      fiddle();
                                      break;
                              }
                          }
                      }
                  }

                  Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity

                  The method addRows() has a Cyclomatic Complexity of 11. The configured cyclomatic complexity threshold is 10.
                  Open

                      public function addRows($data, $modelId, $tempFilename, $filter)
                      {
                          $this->data = $data;
                          $this->modelId = $modelId;
                          $this->model = $this->getModel();

                  CyclomaticComplexity

                  Since: 0.1

                  Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.

                  Example

                  // Cyclomatic Complexity = 11
                  class Foo {
                  1   public function example() {
                  2       if ($a == $b) {
                  3           if ($a1 == $b1) {
                                  fiddle();
                  4           } elseif ($a2 == $b2) {
                                  fiddle();
                              } else {
                                  fiddle();
                              }
                  5       } elseif ($c == $d) {
                  6           while ($c == $d) {
                                  fiddle();
                              }
                  7        } elseif ($e == $f) {
                  8           for ($n = 0; $n < $h; $n++) {
                                  fiddle();
                              }
                          } else {
                              switch ($z) {
                  9               case 1:
                                      fiddle();
                                      break;
                  10              case 2:
                                      fiddle();
                                      break;
                  11              case 3:
                                      fiddle();
                                      break;
                                  default:
                                      fiddle();
                                      break;
                              }
                          }
                      }
                  }

                  Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity

                  The method preprocessModel() has a Cyclomatic Complexity of 13. The configured cyclomatic complexity threshold is 10.
                  Open

                      protected function preprocessModel()
                      {
                          parent::preprocessModel();
                          
                          $labeledCols = $this->getLabeledColumns();

                  CyclomaticComplexity

                  Since: 0.1

                  Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.

                  Example

                  // Cyclomatic Complexity = 11
                  class Foo {
                  1   public function example() {
                  2       if ($a == $b) {
                  3           if ($a1 == $b1) {
                                  fiddle();
                  4           } elseif ($a2 == $b2) {
                                  fiddle();
                              } else {
                                  fiddle();
                              }
                  5       } elseif ($c == $d) {
                  6           while ($c == $d) {
                                  fiddle();
                              }
                  7        } elseif ($e == $f) {
                  8           for ($n = 0; $n < $h; $n++) {
                                  fiddle();
                              }
                          } else {
                              switch ($z) {
                  9               case 1:
                                      fiddle();
                                      break;
                  10              case 2:
                                      fiddle();
                                      break;
                  11              case 3:
                                      fiddle();
                                      break;
                                  default:
                                      fiddle();
                                      break;
                              }
                          }
                      }
                  }

                  Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity

                  The method createHeaderFile() has a Cyclomatic Complexity of 15. The configured cyclomatic complexity threshold is 10.
                  Open

                      protected function createHeaderFile(XMLWriter $writer, $filename)
                      {
                          $columnHeaders = $this->getColumnHeaders();       
                  
                          if ($this->batch) {

                  CyclomaticComplexity

                  Since: 0.1

                  Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.

                  Example

                  // Cyclomatic Complexity = 11
                  class Foo {
                  1   public function example() {
                  2       if ($a == $b) {
                  3           if ($a1 == $b1) {
                                  fiddle();
                  4           } elseif ($a2 == $b2) {
                                  fiddle();
                              } else {
                                  fiddle();
                              }
                  5       } elseif ($c == $d) {
                  6           while ($c == $d) {
                                  fiddle();
                              }
                  7        } elseif ($e == $f) {
                  8           for ($n = 0; $n < $h; $n++) {
                                  fiddle();
                              }
                          } else {
                              switch ($z) {
                  9               case 1:
                                      fiddle();
                                      break;
                  10              case 2:
                                      fiddle();
                                      break;
                  11              case 3:
                                      fiddle();
                                      break;
                                  default:
                                      fiddle();
                                      break;
                              }
                          }
                      }
                  }

                  Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity

                  The method getColumnHeaders() has a Cyclomatic Complexity of 10. The configured cyclomatic complexity threshold is 10.
                  Open

                      protected function getColumnHeaders()
                      {
                          $model = $this->getModel();
                          $labeledCols = $this->getLabeledColumns();
                  
                  

                  CyclomaticComplexity

                  Since: 0.1

                  Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.

                  Example

                  // Cyclomatic Complexity = 11
                  class Foo {
                  1   public function example() {
                  2       if ($a == $b) {
                  3           if ($a1 == $b1) {
                                  fiddle();
                  4           } elseif ($a2 == $b2) {
                                  fiddle();
                              } else {
                                  fiddle();
                              }
                  5       } elseif ($c == $d) {
                  6           while ($c == $d) {
                                  fiddle();
                              }
                  7        } elseif ($e == $f) {
                  8           for ($n = 0; $n < $h; $n++) {
                                  fiddle();
                              }
                          } else {
                              switch ($z) {
                  9               case 1:
                                      fiddle();
                                      break;
                  10              case 2:
                                      fiddle();
                                      break;
                  11              case 3:
                                      fiddle();
                                      break;
                                  default:
                                      fiddle();
                                      break;
                              }
                          }
                      }
                  }

                  Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity

                  Avoid unused local variables such as '$model'.
                  Open

                          if ($model = $this->getModel()) {

                  UnusedLocalVariable

                  Since: 0.2

                  Detects when a local variable is declared and/or assigned, but not used.

                  Example

                  class Foo {
                      public function doSomething()
                      {
                          $i = 5; // Unused
                      }
                  }

                  Source https://phpmd.org/rules/unusedcode.html#unusedlocalvariable

                  Avoid unused parameters such as '$file'.
                  Open

                      public function addRow($row, $file)

                  UnusedFormalParameter

                  Since: 0.2

                  Avoid passing parameters to methods or constructors and then not using those parameters.

                  Example

                  class Foo
                  {
                      private function bar($howdy)
                      {
                          // $howdy is not used
                      }
                  }

                  Source https://phpmd.org/rules/unusedcode.html#unusedformalparameter

                  Avoid unused local variables such as '$value'.
                  Open

                                      foreach($multiOptions as $key=>$value) {

                  UnusedLocalVariable

                  Since: 0.2

                  Detects when a local variable is declared and/or assigned, but not used.

                  Example

                  class Foo {
                      public function doSomething()
                      {
                          $i = 5; // Unused
                      }
                  }

                  Source https://phpmd.org/rules/unusedcode.html#unusedlocalvariable

                  Avoid unused local variables such as '$exportName'.
                  Open

                              $exportName = $this->getName();

                  UnusedLocalVariable

                  Since: 0.2

                  Detects when a local variable is declared and/or assigned, but not used.

                  Example

                  class Foo {
                      public function doSomething()
                      {
                          $i = 5; // Unused
                      }
                  }

                  Source https://phpmd.org/rules/unusedcode.html#unusedlocalvariable

                  Avoid unused local variables such as '$stringSizes'.
                  Open

                              $stringSizes = $this->batch->getSessionVariable('stringSizes');

                  UnusedLocalVariable

                  Since: 0.2

                  Detects when a local variable is declared and/or assigned, but not used.

                  Example

                  class Foo {
                      public function doSomething()
                      {
                          $i = 5; // Unused
                      }
                  }

                  Source https://phpmd.org/rules/unusedcode.html#unusedlocalvariable

                  Avoid unused parameters such as '$row'.
                  Open

                      public function addRow($row, $file)

                  UnusedFormalParameter

                  Since: 0.2

                  Avoid passing parameters to methods or constructors and then not using those parameters.

                  Example

                  class Foo
                  {
                      private function bar($howdy)
                      {
                          // $howdy is not used
                      }
                  }

                  Source https://phpmd.org/rules/unusedcode.html#unusedformalparameter

                  Avoid unused parameters such as '$filename'.
                  Open

                      protected function addheader($filename)

                  UnusedFormalParameter

                  Since: 0.2

                  Avoid passing parameters to methods or constructors and then not using those parameters.

                  Example

                  class Foo
                  {
                      private function bar($howdy)
                      {
                          // $howdy is not used
                      }
                  }

                  Source https://phpmd.org/rules/unusedcode.html#unusedformalparameter

                  Avoid unused local variables such as '$subrowNumber'.
                  Open

                                  $subrowNumber = count($subrows);

                  UnusedLocalVariable

                  Since: 0.2

                  Detects when a local variable is declared and/or assigned, but not used.

                  Example

                  class Foo {
                      public function doSomething()
                      {
                          $i = 5; // Unused
                      }
                  }

                  Source https://phpmd.org/rules/unusedcode.html#unusedlocalvariable

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

                              do {
                                  $filter['limit'] = array($this->rowsPerBatch, $currentRow);
                                  if ($this->batch) {
                                      $this->batch->addTask('Export_ExportCommand', $data['type'], 'addRows', $data, $modelId, $this->tempFilename, $filter);
                                  } else {
                  Severity: Major
                  Found in classes/Gems/Export/StreamingStataExport.php and 1 other location - About 1 hr to fix
                  classes/Gems/Export/ExportAbstract.php on lines 171..179

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

                  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 ($this->batch) {
                                  $this->batch->addTask('Export_ExportCommand', $data['type'], 'addFooter', $this->tempFilename . $this->fileExtension, $modelId, $data);
                                  $this->batch->setSessionVariable('files', $this->files);
                              } else {
                                  $this->addFooter($this->tempFilename . $this->fileExtension, $modelId, $data);
                  Severity: Minor
                  Found in classes/Gems/Export/StreamingStataExport.php and 1 other location - About 1 hr to fix
                  classes/Gems/Export/ExportAbstract.php on lines 181..187

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

                  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

                  Avoid excessively long variable names like $modelFilterAttributes. Keep variable name length under 20.
                  Open

                      protected $modelFilterAttributes = array('formatFunction', 'dateFormat', 'storageFormat', 'itemDisplay');

                  LongVariable

                  Since: 0.2

                  Detects when a field, formal or local variable is declared with a long name.

                  Example

                  class Something {
                      protected $reallyLongIntName = -3; // VIOLATION - Field
                      public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
                          $otherReallyLongName = -5; // VIOLATION - Local
                          for ($interestingIntIndex = 0; // VIOLATION - For
                               $interestingIntIndex < 10;
                               $interestingIntIndex++ ) {
                          }
                      }
                  }

                  Source https://phpmd.org/rules/naming.html#longvariable

                  Avoid variables with short names like $i. Configured minimum length is 3.
                  Open

                                  $i = 1;

                  ShortVariable

                  Since: 0.2

                  Detects when a field, local, or parameter has a very short name.

                  Example

                  class Something {
                      private $q = 15; // VIOLATION - Field
                      public static function main( array $as ) { // VIOLATION - Formal
                          $r = 20 + $this->q; // VIOLATION - Local
                          for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
                              $r += $this->q;
                          }
                      }
                  }

                  Source https://phpmd.org/rules/naming.html#shortvariable

                  Avoid variables with short names like $i. Configured minimum length is 3.
                  Open

                                      $i=0;

                  ShortVariable

                  Since: 0.2

                  Detects when a field, local, or parameter has a very short name.

                  Example

                  class Something {
                      private $q = 15; // VIOLATION - Field
                      public static function main( array $as ) { // VIOLATION - Formal
                          $r = 20 + $this->q; // VIOLATION - Local
                          for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
                              $r += $this->q;
                          }
                      }
                  }

                  Source https://phpmd.org/rules/naming.html#shortvariable

                  Avoid variables with short names like $i. Configured minimum length is 3.
                  Open

                                      $i=0;

                  ShortVariable

                  Since: 0.2

                  Detects when a field, local, or parameter has a very short name.

                  Example

                  class Something {
                      private $q = 15; // VIOLATION - Field
                      public static function main( array $as ) { // VIOLATION - Formal
                          $r = 20 + $this->q; // VIOLATION - Local
                          for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
                              $r += $this->q;
                          }
                      }
                  }

                  Source https://phpmd.org/rules/naming.html#shortvariable

                  There are no issues that match your filters.

                  Category
                  Status