pacificclimate/climate-explorer-frontend

View on GitHub

Showing 358 of 358 total issues

Function fetchData has 33 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  fetchData() {
    if (!this.state.timeOfYear) {
      // Don't fetch data when ToY hasn't settled yet.
      return;
    }
Severity: Minor
Found in src/components/StatisticalSummaryTable/StatisticalSummaryTable.js - About 1 hr to fix

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

            <Row>
              <FullWidthCol>
                <FilteredDatasetsSummary
                  model_id={model_id}
                  experiment={experiment}
    src/components/app-controllers/SingleAppController/SingleAppController.js on lines 147..156

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

      it("rejects Workzeug error messages", function () {
        const func = () => {
          util.validateUnstructuredTimeseriesData({
            data: `<html>
            <head>
    Severity: Major
    Found in src/core/__tests__/util-test.js and 4 other locations - About 1 hr to fix
    src/core/__tests__/util-test.js on lines 108..117
    src/core/__tests__/util-test.js on lines 141..150
    src/core/__tests__/util-test.js on lines 189..198
    src/core/__tests__/util-test.js on lines 249..258

    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

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

            <Row>
              <FullWidthCol>
                <FilteredDatasetsSummary
                  model_id={model_id}
                  experiment={experiment}
    src/components/app-controllers/FloodAppController/FloodAppController.js on lines 164..173

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

      it("rejects Workzeug error messages", function () {
        const func = () => {
          util.validateLongTermAverageData({
            data: `<html>
               <head>
    Severity: Major
    Found in src/core/__tests__/util-test.js and 4 other locations - About 1 hr to fix
    src/core/__tests__/util-test.js on lines 141..150
    src/core/__tests__/util-test.js on lines 189..198
    src/core/__tests__/util-test.js on lines 249..258
    src/core/__tests__/util-test.js on lines 295..304

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

      it("rejects Workzeug error messages", function () {
        const func = () => {
          util.validateStatsData({
            data: `<html>
            <head>
    Severity: Major
    Found in src/core/__tests__/util-test.js and 4 other locations - About 1 hr to fix
    src/core/__tests__/util-test.js on lines 108..117
    src/core/__tests__/util-test.js on lines 189..198
    src/core/__tests__/util-test.js on lines 249..258
    src/core/__tests__/util-test.js on lines 295..304

    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

      min: (a) => {
        assert(_.isArrayLike(a), "_.min(): argument is not an array");
        assert(_.every(a, _.isNumber), "_.min(): argument contains non-numbers");
        return orig.min(a);
      },
    Severity: Major
    Found in src/core/lodash.mixins.js and 1 other location - About 1 hr to fix
    src/core/lodash.mixins.js on lines 20..24

    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

              <A
                show={this.state.show}
                open={this.open}
                close={this.close}
                controls={this.controls()}
    Severity: Major
    Found in src/HOCs/compAcontrolsB.js and 1 other location - About 1 hr to fix
    src/HOCs/compAcontrolsB.js on lines 98..104

    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

      max: (a) => {
        assert(_.isArrayLike(a), "_.max(): argument is not an array");
        assert(_.every(a, _.isNumber), "_.max(): argument contains non-numbers");
        return orig.max(a);
      },
    Severity: Major
    Found in src/core/lodash.mixins.js and 1 other location - About 1 hr to fix
    src/core/lodash.mixins.js on lines 27..31

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

      it("rejects Workzeug error messages", function () {
        const func = () => {
          util.validateAnnualCycleData({
            data: `<html>
            <head>
    Severity: Major
    Found in src/core/__tests__/util-test.js and 4 other locations - About 1 hr to fix
    src/core/__tests__/util-test.js on lines 108..117
    src/core/__tests__/util-test.js on lines 141..150
    src/core/__tests__/util-test.js on lines 249..258
    src/core/__tests__/util-test.js on lines 295..304

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

      it("rejects Workzeug error messages", function () {
        const func = () => {
          util.validateUnstructuredTimeseriesData({
            data: `<html>
            <head>
    Severity: Major
    Found in src/core/__tests__/util-test.js and 4 other locations - About 1 hr to fix
    src/core/__tests__/util-test.js on lines 108..117
    src/core/__tests__/util-test.js on lines 141..150
    src/core/__tests__/util-test.js on lines 189..198
    src/core/__tests__/util-test.js on lines 295..304

    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

              <B
                show={this.state.show}
                open={this.open}
                close={this.close}
                controls={this.controls()}
    Severity: Major
    Found in src/HOCs/compAcontrolsB.js and 1 other location - About 1 hr to fix
    src/HOCs/compAcontrolsB.js on lines 91..97

    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

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

            <Row>
              <HalfWidthCol>
                <FlowArrow pullUp />
              </HalfWidthCol>
              <HalfWidthCol>
    src/components/app-controllers/DualAppController/DualAppController.js on lines 190..197
    src/components/app-controllers/FloodAppController/FloodAppController.js on lines 175..182
    src/components/app-controllers/SingleAppController/SingleAppController.js on lines 158..165

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

    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

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

            <Row>
              <HalfWidthCol>
                <FlowArrow pullUp />
              </HalfWidthCol>
              <HalfWidthCol>
    src/components/app-controllers/DualAppController/DualAppController.js on lines 190..197
    src/components/app-controllers/PrecipAppController/PrecipAppController.js on lines 179..186
    src/components/app-controllers/SingleAppController/SingleAppController.js on lines 158..165

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

    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 shortestUniqueTimeseriesNamingFunction has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

    function shortestUniqueTimeseriesNamingFunction(metadata, data) {
      if (metadata.length === 0) {
        throw new Error("No data to show");
      }
    
    
    Severity: Minor
    Found in src/core/chart-generators.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

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

            <Row>
              <HalfWidthCol>
                <FlowArrow pullUp />
              </HalfWidthCol>
              <HalfWidthCol>
    src/components/app-controllers/FloodAppController/FloodAppController.js on lines 175..182
    src/components/app-controllers/PrecipAppController/PrecipAppController.js on lines 179..186
    src/components/app-controllers/SingleAppController/SingleAppController.js on lines 158..165

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

    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

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

            <Row>
              <HalfWidthCol>
                <FlowArrow pullUp />
              </HalfWidthCol>
              <HalfWidthCol>
    src/components/app-controllers/DualAppController/DualAppController.js on lines 190..197
    src/components/app-controllers/FloodAppController/FloodAppController.js on lines 175..182
    src/components/app-controllers/PrecipAppController/PrecipAppController.js on lines 179..186

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

    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 autoscale has 31 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      autoscale: function () {
        /*
         * Get min/max for current view then update layer params
         */
        // TODO: https://github.com/pacificclimate/climate-explorer-frontend/issues/124

      Function render has 31 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        render() {
          const controlsWidth = this.props.hideTimeOfYearSelector ? 12 : 6;
          return (
            <React.Fragment>
              <Row>

        Function registerValidSW has 31 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function registerValidSW(swUrl, config) {
          navigator.serviceWorker
            .register(swUrl)
            .then((registration) => {
              registration.onupdatefound = () => {
        Severity: Minor
        Found in src/serviceWorker.js - About 1 hr to fix
          Severity
          Category
          Status
          Source
          Language