shipshapecode/tether

View on GitHub
src/js/tether.js

Summary

Maintainability
F
1 wk
Test Coverage
C
71%

File tether.js has 666 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import '../css/tether.scss';
import '../css/tether-theme-arrows.scss';
import '../css/tether-theme-arrows-dark.scss';
import '../css/tether-theme-basic.scss';
import Abutment from './abutment';
Severity: Major
Found in src/js/tether.js - About 1 day to fix

    Function move has a Cognitive Complexity of 75 (exceeds 5 allowed). Consider refactoring.
    Open

      move(pos) {
        if (isUndefined(this.element.parentNode)) {
          return;
        }
    
    
    Severity: Minor
    Found in src/js/tether.js - 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 move has 149 lines of code (exceeds 30 allowed). Consider refactoring.
    Open

      move(pos) {
        if (isUndefined(this.element.parentNode)) {
          return;
        }
    
    
    Severity: Major
    Found in src/js/tether.js - About 5 hrs to fix

      Function position has 148 lines of code (exceeds 30 allowed). Consider refactoring.
      Open

        position(flushChanges = true) {
          // flushChanges commits the changes immediately, leave true unless you are positioning multiple
          // tethers (in which case call Tether.Utils.flush yourself when you're done)
      
          if (!this.enabled) {
      Severity: Major
      Found in src/js/tether.js - About 5 hrs to fix

        Function position has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
        Open

          position(flushChanges = true) {
            // flushChanges commits the changes immediately, leave true unless you are positioning multiple
            // tethers (in which case call Tether.Utils.flush yourself when you're done)
        
            if (!this.enabled) {
        Severity: Minor
        Found in src/js/tether.js - 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 updateAttachClasses has 58 lines of code (exceeds 30 allowed). Consider refactoring.
        Open

          updateAttachClasses(elementAttach, targetAttach) {
            elementAttach = elementAttach || this.attachment;
            targetAttach = targetAttach || this.targetAttachment;
            const sides = ['left', 'top', 'bottom', 'right', 'middle', 'center'];
            const { classes, classPrefix } = this.options;
        Severity: Major
        Found in src/js/tether.js - About 2 hrs to fix

          Function setOptions has 54 lines of code (exceeds 30 allowed). Consider refactoring.
          Open

            setOptions(options, pos = true) {
              const defaults = {
                offset: '0 0',
                targetOffset: '0 0',
                targetAttachment: 'auto auto',
          Severity: Major
          Found in src/js/tether.js - About 1 hr to fix

            Function transcribe has 38 lines of code (exceeds 30 allowed). Consider refactoring.
            Open

                const transcribe = (_same, _pos) => {
                  const hasOptimizations = !isUndefined(this.options.optimizations);
                  const gpu = hasOptimizations ? this.options.optimizations.gpu : null;
                  if (gpu !== false) {
                    let yPos, xPos;
            Severity: Minor
            Found in src/js/tether.js - About 1 hr to fix

              Function position has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
              Open

                position({ manualOffset, manualTargetOffset }) {
                  const offsets = {
                    element: manualOffset,
                    target: manualTargetOffset
                  };
              Severity: Minor
              Found in src/js/tether.js - 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 updateAttachClasses has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                updateAttachClasses(elementAttach, targetAttach) {
                  elementAttach = elementAttach || this.attachment;
                  targetAttach = targetAttach || this.targetAttachment;
                  const sides = ['left', 'top', 'bottom', 'right', 'middle', 'center'];
                  const { classes, classPrefix } = this.options;
              Severity: Minor
              Found in src/js/tether.js - 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 setOptions has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                setOptions(options, pos = true) {
                  const defaults = {
                    offset: '0 0',
                    targetOffset: '0 0',
                    targetAttachment: 'auto auto',
              Severity: Minor
              Found in src/js/tether.js - 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

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

                      if (_same.top) {
                        css.top = `${_pos.top}px`;
                      } else {
                        css.bottom = `${_pos.bottom}px`;
                      }
              Severity: Major
              Found in src/js/tether.js and 1 other location - About 1 hr to fix
              src/js/tether.js on lines 642..646

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

              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 (_same.left) {
                        css.left = `${_pos.left}px`;
                      } else {
                        css.right = `${_pos.right}px`;
                      }
              Severity: Major
              Found in src/js/tether.js and 1 other location - About 1 hr to fix
              src/js/tether.js on lines 636..640

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

              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 (_same.top) {
                        css.top = 0;
                        yPos = _pos.top;
                      } else {
                        css.bottom = 0;
              Severity: Major
              Found in src/js/tether.js and 1 other location - About 1 hr to fix
              src/js/tether.js on lines 615..621

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

              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 (_same.left) {
                        css.left = 0;
                        xPos = _pos.left;
                      } else {
                        css.right = 0;
              Severity: Major
              Found in src/js/tether.js and 1 other location - About 1 hr to fix
              src/js/tether.js on lines 607..613

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

              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 (win.innerHeight > doc.documentElement.clientHeight) {
                    scrollbarSize = this.cache('scrollbar-size', getScrollBarSize);
                    next.viewport.bottom -= scrollbarSize.height;
                  }
              Severity: Major
              Found in src/js/tether.js and 1 other location - About 1 hr to fix
              src/js/tether.js on lines 479..482

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

              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 (win.innerWidth > doc.documentElement.clientWidth) {
                    scrollbarSize = this.cache('scrollbar-size', getScrollBarSize);
                    next.viewport.right -= scrollbarSize.width;
                  }
              Severity: Major
              Found in src/js/tether.js and 1 other location - About 1 hr to fix
              src/js/tether.js on lines 474..477

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

              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

                  TetherBase.modules.forEach((module) => {
                    if (!isUndefined(module.destroy)) {
                      module.destroy.call(this);
                    }
                  });
              Severity: Minor
              Found in src/js/tether.js and 1 other location - About 55 mins to fix
              src/js/tether.js on lines 131..135

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

              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

                  TetherBase.modules.forEach((module) => {
                    if (!isUndefined(module.initialize)) {
                      module.initialize.call(this);
                    }
                  });
              Severity: Minor
              Found in src/js/tether.js and 1 other location - About 55 mins to fix
              src/js/tether.js on lines 278..282

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

              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 4 locations. Consider refactoring.
              Open

                  if (elementAttach.left) {
                    this.add.push(
                      `${getClass('element-attached', classes, classPrefix)}-${
                        elementAttach.left
                      }`
              Severity: Major
              Found in src/js/tether.js and 3 other locations - About 40 mins to fix
              src/js/tether.js on lines 314..320
              src/js/tether.js on lines 328..334
              src/js/tether.js on lines 335..341

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

              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 4 locations. Consider refactoring.
              Open

                  if (targetAttach.left) {
                    this.add.push(
                      `${getClass('target-attached', classes, classPrefix)}-${
                        targetAttach.left
                      }`
              Severity: Major
              Found in src/js/tether.js and 3 other locations - About 40 mins to fix
              src/js/tether.js on lines 314..320
              src/js/tether.js on lines 321..327
              src/js/tether.js on lines 328..334

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

              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 4 locations. Consider refactoring.
              Open

                  if (elementAttach.top) {
                    this.add.push(
                      `${getClass('element-attached', classes, classPrefix)}-${
                        elementAttach.top
                      }`
              Severity: Major
              Found in src/js/tether.js and 3 other locations - About 40 mins to fix
              src/js/tether.js on lines 321..327
              src/js/tether.js on lines 328..334
              src/js/tether.js on lines 335..341

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

              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 4 locations. Consider refactoring.
              Open

                  if (targetAttach.top) {
                    this.add.push(
                      `${getClass('target-attached', classes, classPrefix)}-${
                        targetAttach.top
                      }`
              Severity: Major
              Found in src/js/tether.js and 3 other locations - About 40 mins to fix
              src/js/tether.js on lines 314..320
              src/js/tether.js on lines 321..327
              src/js/tether.js on lines 335..341

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

              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 (
                        next.page.left >= offsetPosition.left + offsetBorder.left &&
                        next.page.right >= offsetPosition.right
                      ) {
                        // We're within the visible part of the target's scroll parent
              Severity: Minor
              Found in src/js/tether.js and 1 other location - About 35 mins to fix
              src/js/tether.js on lines 525..548

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

              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 (
                      next.page.top >= offsetPosition.top + offsetBorder.top &&
                      next.page.bottom >= offsetPosition.bottom
                    ) {
                      if (
              Severity: Minor
              Found in src/js/tether.js and 1 other location - About 35 mins to fix
              src/js/tether.js on lines 529..547

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

              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