pacificclimate/climate-explorer-frontend

View on GitHub
src/core/__tests__/chart-formatter-tests.js

Summary

Maintainability
D
3 days
Test Coverage

File chart-formatter-tests.js has 252 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/******************************************************************
 * chart-formatter-tests.js - tests for chart formatting functions
 *
 * One test (sometimes with multiple parts) for each function in
 * chart-formatters.js. The tests have the same names and are in
Severity: Minor
Found in src/core/__tests__/chart-formatter-tests.js - About 2 hrs to fix

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

      it("pads a graph by adding space at the bottom", function () {
        let currentMin = graph.axis.y.min;
        graph = cf.padYAxis(graph, "y", "bottom", 1);
        expect(graph.axis.y.min).toBeDefined();
        if (currentMin !== undefined) {
    Severity: Major
    Found in src/core/__tests__/chart-formatter-tests.js and 1 other location - About 4 hrs to fix
    src/core/__tests__/chart-formatter-tests.js on lines 223..230

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

    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

      it("pads a graph by adding space at the top", function () {
        let currentMax = graph.axis.y.max;
        graph = cf.padYAxis(graph, "y", "top", 1);
        expect(graph.axis.y.max).toBeDefined();
        if (currentMax !== undefined) {
    Severity: Major
    Found in src/core/__tests__/chart-formatter-tests.js and 1 other location - About 4 hrs to fix
    src/core/__tests__/chart-formatter-tests.js on lines 231..238

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

    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

      it("associates data series for a 1-axis graph", function () {
        expect(cf.getDataSeriesByAxis(oneAxis, "y").length).toBe(3);
        expect(cf.getDataSeriesByAxis(oneAxis, "y2").length).toBe(0);
        expect(cf.getDataSeriesByAxis(oneAxis, "fakeaxis").length).toBe(0);
      });
    Severity: Major
    Found in src/core/__tests__/chart-formatter-tests.js and 1 other location - About 3 hrs to fix
    src/core/__tests__/chart-formatter-tests.js on lines 189..193

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

    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

      it("associates data series for a 2-axis graph", function () {
        expect(cf.getDataSeriesByAxis(twoAxes, "y").length).toBe(1);
        expect(cf.getDataSeriesByAxis(twoAxes, "y2").length).toBe(1);
        expect(cf.getDataSeriesByAxis(twoAxes, "fakeaxis").length).toBe(0);
      });
    Severity: Major
    Found in src/core/__tests__/chart-formatter-tests.js and 1 other location - About 3 hrs to fix
    src/core/__tests__/chart-formatter-tests.js on lines 184..188

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

    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

      it("retains data series in the legend", function () {
        const showAll = function (series) {
          return false;
        };
        graph = cf.hideSeriesInLegend(graph, showAll);
    Severity: Major
    Found in src/core/__tests__/chart-formatter-tests.js and 1 other location - About 1 hr to fix
    src/core/__tests__/chart-formatter-tests.js on lines 101..107

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

    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

      it("removes data series from the lengend", function () {
        const hideAll = function (series) {
          return true;
        };
        graph = cf.hideSeriesInLegend(graph, hideAll);
    Severity: Major
    Found in src/core/__tests__/chart-formatter-tests.js and 1 other location - About 1 hr to fix
    src/core/__tests__/chart-formatter-tests.js on lines 108..114

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

    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

      it("rejects horizontal padding directions", function () {
        func = function () {
          cf.padYAxis(graph, "y", "left", -1);
        };
        expect(func).toThrow();
    Severity: Major
    Found in src/core/__tests__/chart-formatter-tests.js and 2 other locations - About 1 hr to fix
    src/core/__tests__/chart-formatter-tests.js on lines 205..210
    src/core/__tests__/chart-formatter-tests.js on lines 211..216

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

    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

      it("rejects negative padding", function () {
        func = function () {
          cf.padYAxis(graph, "y", "top", -1);
        };
        expect(func).toThrow();
    Severity: Major
    Found in src/core/__tests__/chart-formatter-tests.js and 2 other locations - About 1 hr to fix
    src/core/__tests__/chart-formatter-tests.js on lines 211..216
    src/core/__tests__/chart-formatter-tests.js on lines 217..222

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

    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

      it("rejects nonexistant axes", function () {
        func = function () {
          cf.padYAxis(graph, "y1", "top", -1);
        };
        expect(func).toThrow();
    Severity: Major
    Found in src/core/__tests__/chart-formatter-tests.js and 2 other locations - About 1 hr to fix
    src/core/__tests__/chart-formatter-tests.js on lines 205..210
    src/core/__tests__/chart-formatter-tests.js on lines 217..222

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

    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 (let i = 0; i < 3; i++) {
          if (series[0].search(resolutions[i]) != -1) {
            return i;
          }
        }
    Severity: Major
    Found in src/core/__tests__/chart-formatter-tests.js and 1 other location - About 1 hr to fix
    src/components/graphs/SingleAnnualCycleGraph.js on lines 49..53

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

    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