modxcms/revolution

View on GitHub
core/xpdo/cache/xpdocachemanager.class.php

Summary

Maintainability
F
1 wk
Test Coverage

File xpdocachemanager.class.php has 713 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/*
 * Copyright 2010-2015 by MODX, LLC.
 *
 * This file is part of xPDO.
Severity: Major
Found in core/xpdo/cache/xpdocachemanager.class.php - About 1 day to fix

    Function deleteTree has a Cognitive Complexity of 79 (exceeds 5 allowed). Consider refactoring.
    Open

        public function deleteTree($dirname, $options= array('deleteTop' => false, 'skipDirs' => false, 'extensions' => array('.cache.php'))) {
            $result= false;
            if (is_dir($dirname)) { /* Operate on dirs only */
                if (substr($dirname, -1) != '/') {
                    $dirname .= '/';
    Severity: Minor
    Found in core/xpdo/cache/xpdocachemanager.class.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

    Function copyTree has a Cognitive Complexity of 70 (exceeds 5 allowed). Consider refactoring.
    Open

        public function copyTree($source, $target, $options= array()) {
            $copied= false;
            $source= strtr($source, '\\', '/');
            $target= strtr($target, '\\', '/');
            if ($source[strlen($source) - 1] == '/') $source = substr($source, 0, strlen($source) - 1);
    Severity: Minor
    Found in core/xpdo/cache/xpdocachemanager.class.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

    Function getCachePath has a Cognitive Complexity of 62 (exceeds 5 allowed). Consider refactoring.
    Open

        public function getCachePath() {
            $cachePath= false;
            if (empty($this->xpdo->cachePath)) {
                if (!isset ($this->xpdo->config['cache_path'])) {
                    while (true) {
    Severity: Minor
    Found in core/xpdo/cache/xpdocachemanager.class.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

    Function get has a Cognitive Complexity of 54 (exceeds 5 allowed). Consider refactoring.
    Open

        public function get($key, $options= array()) {
            $value= null;
            $cacheKey= $this->getCacheKey($key, $options);
            if (file_exists($cacheKey)) {
                if ($file = @fopen($cacheKey, 'rb')) {
    Severity: Minor
    Found in core/xpdo/cache/xpdocachemanager.class.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

    Function writeFile has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
    Open

        public function writeFile($filename, $content, $mode= 'wb', $options= array()) {
            $written= false;
            if (!is_array($options)) {
                $options = is_scalar($options) && !is_bool($options) ? array('new_folder_permissions' => $options) : array();
            }
    Severity: Minor
    Found in core/xpdo/cache/xpdocachemanager.class.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

    Function copyFile has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
    Open

        public function copyFile($source, $target, $options = array()) {
            $copied= false;
            if (!is_array($options)) $options = is_scalar($options) && !is_bool($options) ? array('new_file_permissions' => $options) : array();
            if (func_num_args() === 4) $options['new_folder_permissions'] = func_get_arg(3);
            if ($this->writeTree(dirname($target), $options)) {
    Severity: Minor
    Found in core/xpdo/cache/xpdocachemanager.class.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

    Function generateObject has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
    Open

        public function generateObject($obj, $objName, $generateObjVars= false, $generateRelated= false, $objRef= 'this->xpdo', $format= xPDOCacheManager::CACHE_PHP) {
            $source= false;
            if (is_object($obj) && $obj instanceof xPDOObject) {
                $className= $obj->_class;
                $source= "\${$objName}= \${$objRef}->newObject('{$className}');\n";
    Severity: Minor
    Found in core/xpdo/cache/xpdocachemanager.class.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

    xPDOCacheManager has 25 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class xPDOCacheManager {
        const CACHE_PHP = 0;
        const CACHE_JSON = 1;
        const CACHE_SERIALIZE = 2;
        const CACHE_DIR = 'objects/';
    Severity: Minor
    Found in core/xpdo/cache/xpdocachemanager.class.php - About 2 hrs to fix

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

          public function copyTree($source, $target, $options= array()) {
              $copied= false;
              $source= strtr($source, '\\', '/');
              $target= strtr($target, '\\', '/');
              if ($source[strlen($source) - 1] == '/') $source = substr($source, 0, strlen($source) - 1);
      Severity: Major
      Found in core/xpdo/cache/xpdocachemanager.class.php - About 2 hrs to fix

        Method deleteTree has 58 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function deleteTree($dirname, $options= array('deleteTop' => false, 'skipDirs' => false, 'extensions' => array('.cache.php'))) {
                $result= false;
                if (is_dir($dirname)) { /* Operate on dirs only */
                    if (substr($dirname, -1) != '/') {
                        $dirname .= '/';
        Severity: Major
        Found in core/xpdo/cache/xpdocachemanager.class.php - About 2 hrs to fix

          Method writeFile has 57 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function writeFile($filename, $content, $mode= 'wb', $options= array()) {
                  $written= false;
                  if (!is_array($options)) {
                      $options = is_scalar($options) && !is_bool($options) ? array('new_folder_permissions' => $options) : array();
                  }
          Severity: Major
          Found in core/xpdo/cache/xpdocachemanager.class.php - About 2 hrs to fix

            Function endsWith has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
            Open

                public function endsWith($string, $pattern) {
                    $matched= false;
                    if (is_string($string) && ($stringLen= strlen($string))) {
                        if (is_array($pattern)) {
                            foreach ($pattern as $subPattern) {
            Severity: Minor
            Found in core/xpdo/cache/xpdocachemanager.class.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

            Function writeTree has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
            Open

                public function writeTree($dirname, $options= array()) {
                    $written= false;
                    if (!empty ($dirname)) {
                        if (!is_array($options)) $options = is_scalar($options) && !is_bool($options) ? array('new_folder_permissions' => $options) : array();
                        $mode = $this->getOption('new_folder_permissions', $options, $this->getFolderPermissions());
            Severity: Minor
            Found in core/xpdo/cache/xpdocachemanager.class.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 get has 48 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function get($key, $options= array()) {
                    $value= null;
                    $cacheKey= $this->getCacheKey($key, $options);
                    if (file_exists($cacheKey)) {
                        if ($file = @fopen($cacheKey, 'rb')) {
            Severity: Minor
            Found in core/xpdo/cache/xpdocachemanager.class.php - About 1 hr to fix

              Method getCachePath has 46 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function getCachePath() {
                      $cachePath= false;
                      if (empty($this->xpdo->cachePath)) {
                          if (!isset ($this->xpdo->config['cache_path'])) {
                              while (true) {
              Severity: Minor
              Found in core/xpdo/cache/xpdocachemanager.class.php - About 1 hr to fix

                Function lockFile has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function lockFile($file, array $options = array()) {
                        $locked = false;
                        $lockDir = $this->getOption('lock_dir', $options, $this->getCachePath() . 'locks' . DIRECTORY_SEPARATOR);
                        if ($this->writeTree($lockDir, $options)) {
                            $lockFile = $this->lockFileName($file, $options);
                Severity: Minor
                Found in core/xpdo/cache/xpdocachemanager.class.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 set has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function set($key, $var, $expire= 0, $options= array()) {
                        $set= false;
                        if ($var !== null) {
                            if ($expire === true)
                                $expire= 0;
                Severity: Minor
                Found in core/xpdo/cache/xpdocachemanager.class.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 getCacheProvider has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function & getCacheProvider($key = '', $options = array()) {
                        $objCache = null;
                        if (empty($key)) {
                            $key = $this->getOption(xPDO::OPT_CACHE_KEY, $options, 'default');
                        }
                Severity: Minor
                Found in core/xpdo/cache/xpdocachemanager.class.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 matches has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function matches($string, $pattern) {
                        $matched= false;
                        if (is_string($string) && ($stringLen= strlen($string))) {
                            if (is_array($pattern)) {
                                foreach ($pattern as $subPattern) {
                Severity: Minor
                Found in core/xpdo/cache/xpdocachemanager.class.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 getOption has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function getOption($key, $options = array(), $default = null) {
                        $option = $default;
                        if (is_array($key)) {
                            if (!is_array($option)) {
                                $default= $option;
                Severity: Minor
                Found in core/xpdo/cache/xpdocachemanager.class.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 getOption has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function getOption($key, $options = array(), $default = null) {
                        $option = $default;
                        if (is_array($key)) {
                            if (!is_array($option)) {
                                $default= $option;
                Severity: Minor
                Found in core/xpdo/cache/xpdocachemanager.class.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 copyFile has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function copyFile($source, $target, $options = array()) {
                        $copied= false;
                        if (!is_array($options)) $options = is_scalar($options) && !is_bool($options) ? array('new_file_permissions' => $options) : array();
                        if (func_num_args() === 4) $options['new_folder_permissions'] = func_get_arg(3);
                        if ($this->writeTree(dirname($target), $options)) {
                Severity: Minor
                Found in core/xpdo/cache/xpdocachemanager.class.php - About 1 hr to fix

                  Method set has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function set($key, $var, $expire= 0, $options= array()) {
                          $set= false;
                          if ($var !== null) {
                              if ($expire === true)
                                  $expire= 0;
                  Severity: Minor
                  Found in core/xpdo/cache/xpdocachemanager.class.php - About 1 hr to fix

                    Avoid deeply nested control flow statements.
                    Open

                                                if (!filesize($cacheKey)) {
                                                    $value= false;
                                                    break;
                                                }
                    Severity: Major
                    Found in core/xpdo/cache/xpdocachemanager.class.php - About 45 mins to fix

                      Avoid deeply nested control flow statements.
                      Open

                                                  if ($payload !== false) {
                                                      $payload = $this->xpdo->fromJSON($payload);
                                                      if (is_array($payload) && isset($payload['expires']) && (empty($payload['expires']) || time() < $payload['expires'])) {
                                                          if (array_key_exists('content', $payload)) {
                                                              $value= $payload['content'];
                      Severity: Major
                      Found in core/xpdo/cache/xpdocachemanager.class.php - About 45 mins to fix

                        Avoid deeply nested control flow statements.
                        Open

                                                    if (is_dir($path)) {
                                                        $suboptions = array_merge($options, array('deleteTop' => !$this->getOption('skipDirs', $options, false)));
                                                        if ($subresult= $this->deleteTree($path, $suboptions)) {
                                                            $result= array_merge($result, $subresult);
                                                        }
                        Severity: Major
                        Found in core/xpdo/cache/xpdocachemanager.class.php - About 45 mins to fix

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

                              public function generateObject($obj, $objName, $generateObjVars= false, $generateRelated= false, $objRef= 'this->xpdo', $format= xPDOCacheManager::CACHE_PHP) {
                          Severity: Minor
                          Found in core/xpdo/cache/xpdocachemanager.class.php - About 45 mins to fix

                            Avoid deeply nested control flow statements.
                            Open

                                                        if ($payload !== false) {
                                                            $payload = unserialize($payload);
                                                            if (is_array($payload) && isset($payload['expires']) && (empty($payload['expires']) || time() < $payload['expires'])) {
                                                                if (array_key_exists('content', $payload)) {
                                                                    $value= $payload['content'];
                            Severity: Major
                            Found in core/xpdo/cache/xpdocachemanager.class.php - About 45 mins to fix

                              Function delete has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                              Open

                                  public function delete($key, $options= array()) {
                                      $deleted= false;
                                      if ($this->getOption('multiple_object_delete', $options, true)) {
                                          $cacheKey= $this->getCacheKey($key, array_merge($options, array('cache_ext' => '')));
                                          if (file_exists($cacheKey) && is_dir($cacheKey)) {
                              Severity: Minor
                              Found in core/xpdo/cache/xpdocachemanager.class.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 refresh has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                              Open

                                  public function refresh(array $providers = array(), array &$results = array()) {
                                      if (empty($providers)) {
                                          foreach ($this->caches as $cacheKey => $cache) {
                                              $providers[$cacheKey] = array();
                                          }
                              Severity: Minor
                              Found in core/xpdo/cache/xpdocachemanager.class.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 set has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                              Open

                                  public function set($key, & $var, $lifetime= 0, $options= array()) {
                                      $return= false;
                                      if ($cache = $this->getCacheProvider($this->getOption(xPDO::OPT_CACHE_KEY, $options), $options)) {
                                          $value= null;
                                          if (is_object($var) && $var instanceof xPDOObject) {
                              Severity: Minor
                              Found in core/xpdo/cache/xpdocachemanager.class.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

                                  public function getOption($key, $options = array(), $default = null) {
                                      $option = $default;
                                      if (is_array($key)) {
                                          if (!is_array($option)) {
                                              $default= $option;
                              Severity: Major
                              Found in core/xpdo/cache/xpdocachemanager.class.php and 1 other location - About 7 hrs to fix
                              core/xpdo/compression/xpdozip.class.php on lines 187..207

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

                              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