staempfli/magento2-builder-tool

View on GitHub
build/phpscripts/lib/SpycLib.php

Summary

Maintainability
A
2 hrs
Test Coverage

File SpycLib.php has 711 lines of code (exceeds 250 allowed). Consider refactoring.
Wontfix

<?php
/**
   * SpycLib -- A Simple PHP YAML Class
   * @version 0.5.1
   * @author Vlad Andersen <vlad.andersen@gmail.com>
Severity: Major
Found in build/phpscripts/lib/SpycLib.php - About 1 day to fix

    Function _inlineEscape has a Cognitive Complexity of 78 (exceeds 5 allowed). Consider refactoring.
    Wontfix

      private function _inlineEscape($inline) {
        // There's gotta be a cleaner way to do this...
        // While pure sequences seem to be nesting just fine,
        // pure mappings and mappings with sequences inside can't go very
        // deep.  This needs to be fixed.
    Severity: Minor
    Found in build/phpscripts/lib/SpycLib.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

    SpycLib has 54 functions (exceeds 20 allowed). Consider refactoring.
    Wontfix

    class SpycLib {
    
      // SETTINGS
    
      const REMPTY = "\0\0\0\0\0";
    Severity: Major
    Found in build/phpscripts/lib/SpycLib.php - About 7 hrs to fix

      Function _toType has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring.
      Wontfix

        private function _toType($value) {
          if ($value === '') return "";
          $first_character = $value[0];
          $last_character = substr($value, -1, 1);
      
      
      Severity: Minor
      Found in build/phpscripts/lib/SpycLib.php - About 6 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 addArray has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
      Wontfix

        private function addArray ($incoming_data, $incoming_indent) {
      
         // print_r ($incoming_data);
      
          if (count ($incoming_data) > 1)
      Severity: Minor
      Found in build/phpscripts/lib/SpycLib.php - About 5 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

      Consider simplifying this complex logical expression.
      Wontfix

          if (is_string ($value) && ((strpos($value,"\n") !== false || strpos($value,": ") !== false || strpos($value,"- ") !== false ||
            strpos($value,"*") !== false || strpos($value,"#") !== false || strpos($value,"<") !== false || strpos($value,">") !== false || strpos ($value, '  ') !== false ||
            strpos($value,"[") !== false || strpos($value,"]") !== false || strpos($value,"{") !== false || strpos($value,"}") !== false) || strpos($value,"&") !== false || strpos($value, "'") !== false || strpos($value, "!") === 0 ||
            substr ($value, -1, 1) == ':')
          ) {
      Severity: Critical
      Found in build/phpscripts/lib/SpycLib.php - About 4 hrs to fix

        Method _inlineEscape has 91 lines of code (exceeds 25 allowed). Consider refactoring.
        Wontfix

          private function _inlineEscape($inline) {
            // There's gotta be a cleaner way to do this...
            // While pure sequences seem to be nesting just fine,
            // pure mappings and mappings with sequences inside can't go very
            // deep.  This needs to be fixed.
        Severity: Major
        Found in build/phpscripts/lib/SpycLib.php - About 3 hrs to fix

          Function loadWithSource has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
          Wontfix

            private function loadWithSource($Source) {
              if (empty ($Source)) return array();
              if ($this->setting_use_syck_is_possible && function_exists ('syck_load')) {
                $array = syck_load (implode ("\n", $Source));
                return is_array($array) ? $array : array();
          Severity: Minor
          Found in build/phpscripts/lib/SpycLib.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 _toType has 69 lines of code (exceeds 25 allowed). Consider refactoring.
          Wontfix

            private function _toType($value) {
              if ($value === '') return "";
              $first_character = $value[0];
              $last_character = substr($value, -1, 1);
          
          
          Severity: Major
          Found in build/phpscripts/lib/SpycLib.php - About 2 hrs to fix

            Function _dumpNode has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
            Wontfix

              private function _dumpNode($key, $value, $indent, $previous_key = -1, $first_key = 0, $source_array = null) {
                // do some folding here, for blocks
                if (is_string ($value) && ((strpos($value,"\n") !== false || strpos($value,": ") !== false || strpos($value,"- ") !== false ||
                  strpos($value,"*") !== false || strpos($value,"#") !== false || strpos($value,"<") !== false || strpos($value,">") !== false || strpos ($value, '  ') !== false ||
                  strpos($value,"[") !== false || strpos($value,"]") !== false || strpos($value,"{") !== false || strpos($value,"}") !== false) || strpos($value,"&") !== false || strpos($value, "'") !== false || strpos($value, "!") === 0 ||
            Severity: Minor
            Found in build/phpscripts/lib/SpycLib.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 addArray has 54 lines of code (exceeds 25 allowed). Consider refactoring.
            Wontfix

              private function addArray ($incoming_data, $incoming_indent) {
            
               // print_r ($incoming_data);
            
                if (count ($incoming_data) > 1)
            Severity: Major
            Found in build/phpscripts/lib/SpycLib.php - About 2 hrs to fix

              Method loadWithSource has 43 lines of code (exceeds 25 allowed). Consider refactoring.
              Wontfix

                private function loadWithSource($Source) {
                  if (empty ($Source)) return array();
                  if ($this->setting_use_syck_is_possible && function_exists ('syck_load')) {
                    $array = syck_load (implode ("\n", $Source));
                    return is_array($array) ? $array : array();
              Severity: Minor
              Found in build/phpscripts/lib/SpycLib.php - About 1 hr to fix

                Function dump has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                Wontfix

                  public function dump($array,$indent = false,$wordwrap = false, $no_opening_dashes = false) {
                    // Dumps to some very clean YAML.  We'll have to add some more features
                    // and options soon.  And better support for folding.
                
                    // New features and options.
                Severity: Minor
                Found in build/phpscripts/lib/SpycLib.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 _dumpNode has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                Wontfix

                  private function _dumpNode($key, $value, $indent, $previous_key = -1, $first_key = 0, $source_array = null) {
                    // do some folding here, for blocks
                    if (is_string ($value) && ((strpos($value,"\n") !== false || strpos($value,": ") !== false || strpos($value,"- ") !== false ||
                      strpos($value,"*") !== false || strpos($value,"#") !== false || strpos($value,"<") !== false || strpos($value,">") !== false || strpos ($value, '  ') !== false ||
                      strpos($value,"[") !== false || strpos($value,"]") !== false || strpos($value,"{") !== false || strpos($value,"}") !== false) || strpos($value,"&") !== false || strpos($value, "'") !== false || strpos($value, "!") === 0 ||
                Severity: Minor
                Found in build/phpscripts/lib/SpycLib.php - About 1 hr to fix

                  Function returnKeyValuePair has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                  Wontfix

                    private function returnKeyValuePair ($line) {
                      $array = array();
                      $key = '';
                      if (strpos ($line, ': ')) {
                        // It's a key/value pair most likely
                  Severity: Minor
                  Found in build/phpscripts/lib/SpycLib.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

                  Method _dumpNode has 6 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                    private function _dumpNode($key, $value, $indent, $previous_key = -1, $first_key = 0, $source_array = null) {
                  Severity: Minor
                  Found in build/phpscripts/lib/SpycLib.php - About 45 mins to fix

                    Method _yamlize has 6 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                      private function _yamlize($key,$value,$indent, $previous_key = -1, $first_key = 0, $source_array = null) {
                    Severity: Minor
                    Found in build/phpscripts/lib/SpycLib.php - About 45 mins to fix

                      Function coerceValue has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                      Wontfix

                        private function coerceValue(&$value) {
                          if (self::isTrueWord($value)) {
                            $value = true;
                          } else if (self::isFalseWord($value)) {
                            $value = false;
                      Severity: Minor
                      Found in build/phpscripts/lib/SpycLib.php - About 45 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 _parseLine has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                      Wontfix

                        private function _parseLine($line) {
                          if (!$line) return array();
                          $line = trim($line);
                          if (!$line) return array();
                      
                      
                      Severity: Minor
                      Found in build/phpscripts/lib/SpycLib.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

                      Function _yamlizeArray has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                      Wontfix

                        private function _yamlizeArray($array,$indent) {
                          if (is_array($array)) {
                            $string = '';
                            $previous_key = -1;
                            foreach ($array as $key => $value) {
                      Severity: Minor
                      Found in build/phpscripts/lib/SpycLib.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

                      Function _doFolding has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                      Wontfix

                        private function _doFolding($value,$indent) {
                          // Don't do anything if wordwrap is set to 0
                      
                          if ($this->_dumpWordWrap !== 0 && is_string ($value) && strlen($value) > $this->_dumpWordWrap) {
                            $indent += $this->_dumpIndent;
                      Severity: Minor
                      Found in build/phpscripts/lib/SpycLib.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

                      Function revertLiteralPlaceHolder has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                      Wontfix

                         function revertLiteralPlaceHolder ($lineArray, $literalBlock) {
                           foreach ($lineArray as $k => $_) {
                            if (is_array($_))
                              $lineArray[$k] = $this->revertLiteralPlaceHolder ($_, $literalBlock);
                            else if (substr($_, -1 * strlen ($this->LiteralPlaceHolder)) == $this->LiteralPlaceHolder)
                      Severity: Minor
                      Found in build/phpscripts/lib/SpycLib.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

                      Function nodeContainsGroup has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                      Wontfix

                        private function nodeContainsGroup ($line) {
                          $symbolsForReference = 'A-z0-9_\-';
                          if (strpos($line, '&') === false && strpos($line, '*') === false) return false; // Please die fast ;-)
                          if ($line[0] == '&' && preg_match('/^(&['.$symbolsForReference.']+)/', $line, $matches)) return $matches[1];
                          if ($line[0] == '*' && preg_match('/^(\*['.$symbolsForReference.']+)/', $line, $matches)) return $matches[1];
                      Severity: Minor
                      Found in build/phpscripts/lib/SpycLib.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.
                      Wontfix

                            if ($innerValue === '') return array();
                      Severity: Major
                      Found in build/phpscripts/lib/SpycLib.php - About 30 mins to fix

                        Avoid too many return statements within this method.
                        Wontfix

                              return $value;
                        Severity: Major
                        Found in build/phpscripts/lib/SpycLib.php - About 30 mins to fix

                          Avoid too many return statements within this method.
                          Wontfix

                              return $value;
                          Severity: Major
                          Found in build/phpscripts/lib/SpycLib.php - About 30 mins to fix

                            Avoid too many return statements within this method.
                            Wontfix

                                  return $array;
                            Severity: Major
                            Found in build/phpscripts/lib/SpycLib.php - About 30 mins to fix

                              Avoid too many return statements within this method.
                              Wontfix

                                    if ($value === '0') return 0;
                              Severity: Major
                              Found in build/phpscripts/lib/SpycLib.php - About 30 mins to fix

                                Avoid too many return statements within this method.
                                Wontfix

                                    return false;
                                Severity: Major
                                Found in build/phpscripts/lib/SpycLib.php - About 30 mins to fix

                                  Avoid too many return statements within this method.
                                  Wontfix

                                      if (preg_match('/(\*['.$symbolsForReference.']+$)/', $line, $matches)) return $matches[1];
                                  Severity: Major
                                  Found in build/phpscripts/lib/SpycLib.php - About 30 mins to fix

                                    Avoid too many return statements within this method.
                                    Wontfix

                                        return false;
                                    Severity: Major
                                    Found in build/phpscripts/lib/SpycLib.php - About 30 mins to fix

                                      Avoid too many return statements within this method.
                                      Wontfix

                                          if (preg_match ('#^\s*<<\s*:\s*(\*[^\s]+).*$#', $line, $matches)) return $matches[1];
                                      Severity: Major
                                      Found in build/phpscripts/lib/SpycLib.php - About 30 mins to fix

                                        Avoid too many return statements within this method.
                                        Wontfix

                                             return $this->returnPlainArray($line);
                                        Severity: Major
                                        Found in build/phpscripts/lib/SpycLib.php - About 30 mins to fix

                                          Avoid too many return statements within this method.
                                          Wontfix

                                               return $this->returnArrayElement($line);
                                          Severity: Major
                                          Found in build/phpscripts/lib/SpycLib.php - About 30 mins to fix

                                            Avoid too many return statements within this method.
                                            Wontfix

                                                  return array($key => $value);
                                            Severity: Major
                                            Found in build/phpscripts/lib/SpycLib.php - About 30 mins to fix

                                              Avoid too many return statements within this method.
                                              Wontfix

                                                  return $value;
                                              Severity: Major
                                              Found in build/phpscripts/lib/SpycLib.php - About 30 mins to fix

                                                Avoid too many return statements within this method.
                                                Wontfix

                                                      return $value;
                                                Severity: Major
                                                Found in build/phpscripts/lib/SpycLib.php - About 30 mins to fix

                                                  Avoid too many return statements within this method.
                                                  Wontfix

                                                      return $this->returnKeyValuePair($line);
                                                  Severity: Major
                                                  Found in build/phpscripts/lib/SpycLib.php - About 30 mins to fix

                                                    Avoid too many return statements within this method.
                                                    Wontfix

                                                          return null;
                                                    Severity: Major
                                                    Found in build/phpscripts/lib/SpycLib.php - About 30 mins to fix

                                                      Avoid too many return statements within this method.
                                                      Wontfix

                                                            return hexdec($value);
                                                      Severity: Major
                                                      Found in build/phpscripts/lib/SpycLib.php - About 30 mins to fix

                                                        Function addLiteralLine has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                                        Wontfix

                                                          private function addLiteralLine ($literalBlock, $line, $literalBlockStyle, $indent = -1) {
                                                            $line = self::stripIndent($line, $indent);
                                                            if ($literalBlockStyle !== '|') {
                                                                $line = self::stripIndent($line);
                                                            }
                                                        Severity: Minor
                                                        Found in build/phpscripts/lib/SpycLib.php - About 25 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 isArrayElement has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                                        Wontfix

                                                          private function isArrayElement ($line) {
                                                            if (!$line || !is_scalar($line)) return false;
                                                            if (substr($line, 0, 2) != '- ') return false;
                                                            if (strlen ($line) > 3)
                                                              if (substr($line,0,3) == '---') return false;
                                                        Severity: Minor
                                                        Found in build/phpscripts/lib/SpycLib.php - About 25 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

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

                                                            if (!empty($maps)) {
                                                              foreach ($explode as $key => $value) {
                                                                if (strpos($value,'YAMLMap') !== false) {
                                                                  foreach ($maps as $mapk => $map) {
                                                                    $explode[$key] = str_replace(('YAMLMap'.$mapk.'s'), $map, $value);
                                                        Severity: Minor
                                                        Found in build/phpscripts/lib/SpycLib.php and 1 other location - About 30 mins to fix
                                                        build/phpscripts/lib/SpycLib.php on lines 739..748

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

                                                        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 (!empty($seqs)) {
                                                              foreach ($explode as $key => $value) {
                                                                if (strpos($value,'YAMLSeq') !== false) {
                                                                  foreach ($seqs as $seqk => $seq) {
                                                                    $explode[$key] = str_replace(('YAMLSeq'.$seqk.'s'),$seq,$value);
                                                        Severity: Minor
                                                        Found in build/phpscripts/lib/SpycLib.php and 1 other location - About 30 mins to fix
                                                        build/phpscripts/lib/SpycLib.php on lines 751..760

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

                                                        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

                                                        There are no issues that match your filters.

                                                        Category
                                                        Status