18F/analytics.usa.gov

View on GitHub

Showing 104 of 104 total issues

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

    d3.selectAll(".top-download-page").on("click", function () {
      const link = this.href;
      const eventText = this.text;
      ga("send", "event", "Top-Download Page", link, eventText);
    });
Severity: Major
Found in js/lib/eventhandler.js and 3 other locations - About 1 hr to fix
js/lib/eventhandler.js on lines 5..9
js/lib/eventhandler.js on lines 11..15
js/lib/eventhandler.js on lines 23..27

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

    d3.selectAll(".top-download-file").on("click", function () {
      const link = this.href;
      const eventText = this.text;
      ga("send", "event", "Top-Download File", link, eventText);
    });
Severity: Major
Found in js/lib/eventhandler.js and 3 other locations - About 1 hr to fix
js/lib/eventhandler.js on lines 5..9
js/lib/eventhandler.js on lines 11..15
js/lib/eventhandler.js on lines 17..21

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

Function showValidationError has 28 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    showValidationError: function (question, error) {
      var questionDiv = question.closest(".question");
      var label = questionDiv.querySelector(".usa-label") || questionDiv.querySelector(".usa-legend");
      var questionNum = label.innerText;

Severity: Minor
Found in js/lib/touchpoints.js - About 1 hr to fix

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

          for (var i = 0; i < phoneElements.length; i++) {
            phoneElements[i].addEventListener('keyup', this.handlePhoneInput.bind(this), false);
          }
    Severity: Major
    Found in js/lib/touchpoints.js and 1 other location - About 1 hr to fix
    js/lib/touchpoints.js on lines 87..89

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

    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

          for (var i = 0; i < otherElements.length; i++) {
            otherElements[i].addEventListener('keyup', this.handleOtherOption.bind(this), false);
          }
    Severity: Major
    Found in js/lib/touchpoints.js and 1 other location - About 1 hr to fix
    js/lib/touchpoints.js on lines 91..93

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

    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

          selection
            .selectAll(".label")
            .each(function (d) {
              d.text = this.innerText;
            })
    Severity: Minor
    Found in js/lib/blocks.js and 1 other location - About 50 mins to fix
    js/lib/blocks.js on lines 266..272

    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

          selection
            .selectAll(".label")
            .each(function (d) {
              d.text = this.innerText;
            })
    Severity: Minor
    Found in js/lib/blocks.js and 1 other location - About 50 mins to fix
    js/lib/blocks.js on lines 239..245

    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

              Array.prototype.forEach.call(submitButtons, function (submitButton) {
                submitButton.addEventListener('click', that.handleSubmitClick.bind(that), false);
              })
    Severity: Minor
    Found in js/lib/touchpoints.js and 1 other location - About 45 mins to fix
    js/lib/touchpoints.js on lines 106..108

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

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Avoid deeply nested control flow statements.
    Open

                if (errors.hasOwnProperty(err)) {
                  alertErrorElementBody.innerHTML += err;
                  alertErrorElementBody.innerHTML += " ";
                  alertErrorElementBody.innerHTML += errors[err];
                  alertErrorElementBody.innerHTML += "<br />";
    Severity: Major
    Found in js/lib/touchpoints.js - About 45 mins to fix

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

              Array.prototype.forEach.call(submitButtons, function (submitButton) {
                submitButton.addEventListener('click', that.handleYesNoSubmitClick.bind(that), false);
              })
      Severity: Minor
      Found in js/lib/touchpoints.js and 1 other location - About 45 mins to fix
      js/lib/touchpoints.js on lines 111..113

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

      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 (formElement.querySelector('.touchpoints-form-body')) {
                var formBody = formElement.querySelector('.touchpoints-form-body');
                if (formBody) {
                  formBody.setAttribute("hidden", true);
                }
      Severity: Minor
      Found in js/lib/touchpoints.js and 1 other location - About 40 mins to fix
      js/lib/touchpoints.js on lines 427..432

      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 (formComponent.querySelector('.touchpoints-form-disclaimer')) {
                var formDisclaimer = formComponent.querySelector('.touchpoints-form-disclaimer');
                if (formDisclaimer) {
                  formDisclaimer.setAttribute("hidden", true);
                }
      Severity: Minor
      Found in js/lib/touchpoints.js and 1 other location - About 40 mins to fix
      js/lib/touchpoints.js on lines 421..426

      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 (requiredQuestionsNotice) {
              if (this.currentPageNumber == 1) {
                requiredQuestionsNotice.removeAttribute("hidden");
              } else {
                requiredQuestionsNotice.setAttribute("hidden", true);
      Severity: Minor
      Found in js/lib/touchpoints.js and 1 other location - About 40 mins to fix
      js/lib/touchpoints.js on lines 541..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 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 (instructions) {
              if (this.currentPageNumber == 1) {
                instructions.removeAttribute("hidden");
              } else {
                instructions.setAttribute("hidden", true);
      Severity: Minor
      Found in js/lib/touchpoints.js and 1 other location - About 40 mins to fix
      js/lib/touchpoints.js on lines 550..556

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

        timeSeries.series = function (fs) {
          if (!arguments.length) return series;
          series = d3.functor(fs);
          return timeSeries;
        };
      Severity: Major
      Found in js/lib/timeseries.js and 10 other locations - About 40 mins to fix
      js/lib/barchart.js on lines 52..56
      js/lib/barchart.js on lines 58..62
      js/lib/barchart.js on lines 64..68
      js/lib/barchart.js on lines 70..74
      js/lib/barchart.js on lines 76..80
      js/lib/renderblock.js on lines 93..97
      js/lib/renderblock.js on lines 99..103
      js/lib/timeseries.js on lines 134..138
      js/lib/timeseries.js on lines 140..144
      js/lib/timeseries.js on lines 146..150

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

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

        chart.bars = function (x) {
          if (!arguments.length) return bars;
          bars = d3.functor(x);
          return chart;
        };
      Severity: Major
      Found in js/lib/barchart.js and 10 other locations - About 40 mins to fix
      js/lib/barchart.js on lines 58..62
      js/lib/barchart.js on lines 64..68
      js/lib/barchart.js on lines 70..74
      js/lib/barchart.js on lines 76..80
      js/lib/renderblock.js on lines 93..97
      js/lib/renderblock.js on lines 99..103
      js/lib/timeseries.js on lines 128..132
      js/lib/timeseries.js on lines 134..138
      js/lib/timeseries.js on lines 140..144
      js/lib/timeseries.js on lines 146..150

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

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

        block.url = function (x) {
          if (!arguments.length) return url;
          url = d3.functor(x);
          return block;
        };
      Severity: Major
      Found in js/lib/renderblock.js and 10 other locations - About 40 mins to fix
      js/lib/barchart.js on lines 52..56
      js/lib/barchart.js on lines 58..62
      js/lib/barchart.js on lines 64..68
      js/lib/barchart.js on lines 70..74
      js/lib/barchart.js on lines 76..80
      js/lib/renderblock.js on lines 99..103
      js/lib/timeseries.js on lines 128..132
      js/lib/timeseries.js on lines 134..138
      js/lib/timeseries.js on lines 140..144
      js/lib/timeseries.js on lines 146..150

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

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

        chart.label = function (x) {
          if (!arguments.length) return label;
          label = d3.functor(x);
          return chart;
        };
      Severity: Major
      Found in js/lib/barchart.js and 10 other locations - About 40 mins to fix
      js/lib/barchart.js on lines 52..56
      js/lib/barchart.js on lines 64..68
      js/lib/barchart.js on lines 70..74
      js/lib/barchart.js on lines 76..80
      js/lib/renderblock.js on lines 93..97
      js/lib/renderblock.js on lines 99..103
      js/lib/timeseries.js on lines 128..132
      js/lib/timeseries.js on lines 134..138
      js/lib/timeseries.js on lines 140..144
      js/lib/timeseries.js on lines 146..150

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

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

        chart.format = function (x) {
          if (!arguments.length) return format;
          format = d3.functor(x);
          return chart;
        };
      Severity: Major
      Found in js/lib/barchart.js and 10 other locations - About 40 mins to fix
      js/lib/barchart.js on lines 52..56
      js/lib/barchart.js on lines 58..62
      js/lib/barchart.js on lines 64..68
      js/lib/barchart.js on lines 76..80
      js/lib/renderblock.js on lines 93..97
      js/lib/renderblock.js on lines 99..103
      js/lib/timeseries.js on lines 128..132
      js/lib/timeseries.js on lines 134..138
      js/lib/timeseries.js on lines 140..144
      js/lib/timeseries.js on lines 146..150

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

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

        block.transform = function (x) {
          if (!arguments.length) return transform;
          transform = d3.functor(x);
          return block;
        };
      Severity: Major
      Found in js/lib/renderblock.js and 10 other locations - About 40 mins to fix
      js/lib/barchart.js on lines 52..56
      js/lib/barchart.js on lines 58..62
      js/lib/barchart.js on lines 64..68
      js/lib/barchart.js on lines 70..74
      js/lib/barchart.js on lines 76..80
      js/lib/renderblock.js on lines 93..97
      js/lib/timeseries.js on lines 128..132
      js/lib/timeseries.js on lines 134..138
      js/lib/timeseries.js on lines 140..144
      js/lib/timeseries.js on lines 146..150

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

      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

      Severity
      Category
      Status
      Source
      Language