dsathyakumar/a11y-auditor

View on GitHub
lib/axs/axsUtils.js

Summary

Maintainability
F
1 wk
Test Coverage

File axsUtils.js has 557 lines of code (exceeds 250 allowed). Consider refactoring.
Open

// jshint ignore: start
/***************************************************************************************
 * dependency injection for rules creation
 * @param
 * @return an object with exposed functions
Severity: Major
Found in lib/axs/axsUtils.js - About 1 day to fix

    Function findTextAlternatives has a Cognitive Complexity of 50 (exceeds 5 allowed). Consider refactoring.
    Open

        findTextAlternatives: function(a, b, c, d) {
            var e = c || !1;
            c = this.asElement(a);
            if (!c || !d && this.isElementOrAncestorHidden(c)) {
                return null;
    Severity: Minor
    Found in lib/axs/axsUtils.js - About 7 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 getAriaPropertyValue has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
    Open

        getAriaPropertyValue: function(a, b, c) {
            var d = a.replace(/^aria-/, ''),
                e = enums.ariaPropertiesEnum[d],
                d = {
                    name: a,
    Severity: Minor
    Found in lib/axs/axsUtils.js - About 4 hrs to fix

    Cognitive Complexity

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

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

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

    Further reading

    Function findTextAlternatives has 86 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        findTextAlternatives: function(a, b, c, d) {
            var e = c || !1;
            c = this.asElement(a);
            if (!c || !d && this.isElementOrAncestorHidden(c)) {
                return null;
    Severity: Major
    Found in lib/axs/axsUtils.js - About 3 hrs to fix

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

          getTextFromHostLanguageAttributes: function(a, b, c, d) {
              if (this.matchSelector(a, 'img') && a.hasAttribute('alt')) {
                  var e = {
                      type: 'string',
                      valid: !0
      Severity: Minor
      Found in lib/axs/axsUtils.js - 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 getAriaProperties has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
      Open

          getAriaProperties: function(a) {
              var b = {},
                  c = this.getGlobalAriaProperties(a),
                  d;
              for (d in enums.ariaPropertiesEnum) {
      Severity: Minor
      Found in lib/axs/axsUtils.js - 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

      exports has 26 functions (exceeds 20 allowed). Consider refactoring.
      Open

      module.exports = {
      
          getTextFromHostLanguageAttributes: function(a, b, c, d) {
              if (this.matchSelector(a, 'img') && a.hasAttribute('alt')) {
                  var e = {
      Severity: Minor
      Found in lib/axs/axsUtils.js - About 3 hrs to fix

        Function getAriaPropertyValue has 67 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            getAriaPropertyValue: function(a, b, c) {
                var d = a.replace(/^aria-/, ''),
                    e = enums.ariaPropertiesEnum[d],
                    d = {
                        name: a,
        Severity: Major
        Found in lib/axs/axsUtils.js - About 2 hrs to fix

          Function getTextFromHostLanguageAttributes has 47 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              getTextFromHostLanguageAttributes: function(a, b, c, d) {
                  if (this.matchSelector(a, 'img') && a.hasAttribute('alt')) {
                      var e = {
                          type: 'string',
                          valid: !0
          Severity: Minor
          Found in lib/axs/axsUtils.js - About 1 hr to fix

            Function getAriaProperties has 36 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                getAriaProperties: function(a) {
                    var b = {},
                        c = this.getGlobalAriaProperties(a),
                        d;
                    for (d in enums.ariaPropertiesEnum) {
            Severity: Minor
            Found in lib/axs/axsUtils.js - About 1 hr to fix

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

                  checkForAria: function(el) {
                      if (!el) {
                          return null;
                      }
                      var tagName = el.tagName;
              Severity: Minor
              Found in lib/axs/axsUtils.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 matchSelector has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
              Open

                  matchSelector: function(a, b) {
                      return a.matches ? a.matches(b) : a.webkitMatchesSelector ? a.webkitMatchesSelector(b) : a.mozMatchesSelector
                          ? a.mozMatchesSelector(b) : a.msMatchesSelector ? a.msMatchesSelector(b) : !true;
                  },
              Severity: Minor
              Found in lib/axs/axsUtils.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

              Consider simplifying this complex logical expression.
              Open

                      if (e && this.elementIsAriaWidget(c)) {
                          e = c.getAttribute('role');
                          'textbox' == e && c.textContent && 0 < c.textContent.length && (b.controlValue = {
                              text: c.textContent
                          });
              Severity: Major
              Found in lib/axs/axsUtils.js - About 40 mins to fix

                Consider simplifying this complex logical expression.
                Open

                        if (this.matchSelector(a,
                                'input:not([type="hidden"]):not([disabled]), select:not([disabled]), textarea:not([disabled]), button:not([disabled]), video:not([disabled])') &&
                            !d) {
                            if (a.hasAttribute('id')) {
                                d = document.querySelectorAll('label[for="' + a.id + '"]');
                Severity: Major
                Found in lib/axs/axsUtils.js - About 40 mins to fix

                  Function _addAllPropertiesToSet has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                  function _addAllPropertiesToSet(a, b, c) {
                      var d = a[b];
                      if (d) {
                          for (var e = 0; e < d.length; e++) {
                              c[d[e]] = !0;
                  Severity: Minor
                  Found in lib/axs/axsUtils.js - 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 getRoles has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                      getRoles: function(a, b) {
                          if (!a || a.nodeType !== Node.ELEMENT_NODE || !a.hasAttribute('role') && !b) {
                              return null;
                          }
                          var c = a.getAttribute('role');
                  Severity: Minor
                  Found in lib/axs/axsUtils.js - 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 composedParentNode has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                      composedParentNode: function(a) {
                          if (!a) {
                              return null;
                          }
                          if (a.nodeType === Node.DOCUMENT_FRAGMENT_NODE) {
                  Severity: Minor
                  Found in lib/axs/axsUtils.js - 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 function.
                  Open

                              return d;
                  Severity: Major
                  Found in lib/axs/axsUtils.js - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                                return d;
                    Severity: Major
                    Found in lib/axs/axsUtils.js - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                                  return b;
                      Severity: Major
                      Found in lib/axs/axsUtils.js - About 30 mins to fix

                        Avoid too many return statements within this function.
                        Open

                                return d;
                        Severity: Major
                        Found in lib/axs/axsUtils.js - About 30 mins to fix

                          Avoid too many return statements within this function.
                          Open

                                  return _res;
                          Severity: Major
                          Found in lib/axs/axsUtils.js - About 30 mins to fix

                            Avoid too many return statements within this function.
                            Open

                                    return 0 < a.length ? this.composedParentNode(a[a.length - 1]) : null;
                            Severity: Major
                            Found in lib/axs/axsUtils.js - About 30 mins to fix

                              Avoid too many return statements within this function.
                              Open

                                              return d.reason = c.reason, d;
                              Severity: Major
                              Found in lib/axs/axsUtils.js - About 30 mins to fix

                                Avoid too many return statements within this function.
                                Open

                                            return d;
                                Severity: Major
                                Found in lib/axs/axsUtils.js - About 30 mins to fix

                                  Function isElementHidden has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                  Open

                                      isElementHidden: function(a) {
                                          if (!(a instanceof a.ownerDocument.defaultView.HTMLElement)) {
                                              return !1;
                                          }
                                          if (a.hasAttribute('chromevoxignoreariahidden')) {
                                  Severity: Minor
                                  Found in lib/axs/axsUtils.js - 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 3 locations. Consider refactoring.
                                  Open

                                              return c = this.isPossibleValue(b.toLowerCase(), enums.mixedValuesEnum, a), c.valid
                                                  ? (d.valid = !0, d.value = c.value) : (d.valid = !1, d.value = b, d.reason = c.reason), d;
                                  Severity: Major
                                  Found in lib/axs/axsUtils.js and 2 other locations - About 1 hr to fix
                                  lib/axs/axsUtils.js on lines 434..435
                                  lib/axs/axsUtils.js on lines 450..451

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

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

                                              return c = this.isValidBoolean(b), c.valid ? (d.valid = !0, d.value = c.value)
                                                  : (d.valid = !1, d.value = b, d.reason = c.reason), d;
                                  Severity: Major
                                  Found in lib/axs/axsUtils.js and 2 other locations - About 1 hr to fix
                                  lib/axs/axsUtils.js on lines 434..435
                                  lib/axs/axsUtils.js on lines 447..448

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

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

                                              return c = this.isValidTokenValue(a, b.toLowerCase()), c.valid ? (d.valid = !0, d.value = c.value)
                                                  : (d.valid = !1, d.value = b, d.reason = c.reason), d;
                                  Severity: Major
                                  Found in lib/axs/axsUtils.js and 2 other locations - About 1 hr to fix
                                  lib/axs/axsUtils.js on lines 447..448
                                  lib/axs/axsUtils.js on lines 450..451

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

                                  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 (a.hasAttribute(e)) {
                                                  var f = a.getAttribute(e);
                                                  c[e] = this.getAriaPropertyValue(e, f, a);
                                              }
                                  Severity: Minor
                                  Found in lib/axs/axsUtils.js and 1 other location - About 50 mins to fix
                                  lib/axs/axsUtils.js on lines 571..574

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

                                  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 (a.hasAttribute(c)) {
                                                  var d = a.getAttribute(c);
                                                  b[c] = this.getAriaPropertyValue(c, d, a);
                                              }
                                  Severity: Minor
                                  Found in lib/axs/axsUtils.js and 1 other location - About 50 mins to fix
                                  lib/axs/axsUtils.js on lines 534..537

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

                                  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

                                              b.controlValue && (f = b.controlValue, a ? f.unused = !0 : a = f.text);
                                  Severity: Minor
                                  Found in lib/axs/axsUtils.js and 1 other location - About 35 mins to fix
                                  lib/axs/axsUtils.js on lines 313..313

                                  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

                                              b.controlValue && (f = b.controlValue, a ? f.unused = !0 : a = f.text);
                                  Severity: Minor
                                  Found in lib/axs/axsUtils.js and 1 other location - About 35 mins to fix
                                  lib/axs/axsUtils.js on lines 278..278

                                  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

                                          return a instanceof b.HTMLButtonElement || a instanceof b.HTMLInputElement ||
                                          a instanceof b.HTMLSelectElement || a instanceof b.HTMLTextAreaElement ? !0 : !1;
                                  Severity: Minor
                                  Found in lib/axs/axsUtils.js and 1 other location - About 30 mins to fix
                                  lib/utils/accessibilityUtils.js on lines 176..179

                                  Duplicated Code

                                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                  Tuning

                                  This issue has a mass of 45.

                                  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