pacificclimate/climate-explorer-frontend

View on GitHub

Showing 355 of 355 total issues

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

  render() {
    const mapLegend = (
      <MapLegend
        {...this.props}
        {...this.state}
Severity: Major
Found in src/components/map-controllers/DualMapController/DualMapController.js - About 3 hrs to fix

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

            <Panel.Heading>
              <Panel.Title>
                <Row>
                  <Col lg={2}>{mapPanelLabel}</Col>
                  <Col lg={10}>{mapLegend}</Col>
    src/components/map-controllers/DualMapController/DualMapController.js on lines 308..315

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

    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

      static propTypes = {
        model_id: PropTypes.string.isRequired,
        experiment: PropTypes.string.isRequired,
        variable_id: PropTypes.string.isRequired,
        meta: PropTypes.array.isRequired,
    src/components/map-controllers/DualMapController/DualMapController.js on lines 54..63

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

    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

            <Panel.Heading>
              <Panel.Title>
                <Row>
                  <Col lg={2}>{mapPanelLabel}</Col>
                  <Col lg={10}>{mapLegend}</Col>
    src/components/map-controllers/PrecipMapController/PrecipMapController.js on lines 272..279

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

    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

      static propTypes = {
        model_id: PropTypes.string.isRequired,
        experiment: PropTypes.string.isRequired,
        variable_id: PropTypes.string.isRequired,
        meta: PropTypes.array.isRequired,
    src/components/map-controllers/PrecipMapController/PrecipMapController.js on lines 55..64

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

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

      render() {
        // TODO: Extract this to a separate component
        const LayerVisibilityButton = ({ layerVisibility, onClick }) => (
          <Button bsSize={"xsmall"} onClick={onClick}>
            <Glyphicon glyph={layerVisibility ? "eye-open" : "eye-close"} />
    Severity: Major
    Found in src/components/LayerOpacityControl/LayerOpacityControl.js - About 3 hrs to fix

      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

              <tr>
                <td>rcp45/ssp245</td>
                <td>
                  <a
                    href="https://climate-scenarios.canada.ca/?page=scen-rcp"
      Severity: Major
      Found in src/components/guidance-content/info/InformationItems.js and 1 other location - About 3 hrs to fix
      src/components/guidance-content/info/InformationItems.js on lines 335..355

      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

              <tr>
                <td>rcp26/ssp126</td>
                <td>
                  <a
                    href="https://climate-scenarios.canada.ca/?page=scen-rcp"
      Severity: Major
      Found in src/components/guidance-content/info/InformationItems.js and 1 other location - About 3 hrs to fix
      src/components/guidance-content/info/InformationItems.js on lines 356..376

      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

      Function makeAnomalyGraph has 76 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function makeAnomalyGraph(base, variable_id, graph) {
        //anomalies for some variables are typically expressed as percentages.
        //if this is a single variable graph, check the variable configuration
        //to see if this is one of them; if so, display percentages on the chart.
        const displayPercent =
      Severity: Major
      Found in src/core/chart-transformers.js - About 3 hrs to fix

        Function exportDataToWorksheet has 74 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        var exportDataToWorksheet = function (
          datatype,
          metadata,
          data,
          format,
        Severity: Major
        Found in src/core/export.js - About 2 hrs to fix

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

            render() {
              const mapLegend = (
                <MapLegend
                  {...this.props}
                  {...this.state}

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

                      <HalfWidthCol>
                        <DualMapController
                          model_id={model_id}
                          experiment={experiment}
                          variable_id={variable_id}
            src/components/app-controllers/PrecipAppController/PrecipAppController.js on lines 189..200

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

            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

                      <HalfWidthCol>
                        <PrecipMapController
                          model_id={model_id}
                          experiment={experiment}
                          variable_id={variable_id}
            src/components/app-controllers/DualAppController/DualAppController.js on lines 200..211

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

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

              render() {
                return (
                  <div id={"table"}>
                    <BootstrapTable
                      data={this.props.data}
            Severity: Major
            Found in src/components/DataTable/DataTable.js - About 2 hrs to fix

              Function SingleTimeSliceGraph has 71 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              export default function SingleTimeSliceGraph(props) {
                //TODO: this is 100% identical to SingleContextGraph.getMetadata(),
                //as this graph uses a subset of that one's data. Combine if possible for
                //https://github.com/pacificclimate/climate-explorer-frontend/issues/139.
                function getMetadata() {
              Severity: Major
              Found in src/components/graphs/SingleTimeSliceGraph.js - About 2 hrs to fix

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

                    if (reuseColorscalerange && this.layer.wmsParams.colorscalerange) {
                      //  Use colorscalerange if defined on the layer
                      this.min = +this.layer.wmsParams.colorscalerange.split(",")[0];
                      this.max = +this.layer.wmsParams.colorscalerange.split(",")[1];
                      this.redraw();
                src/core/leaflet-ncwms-colorbar.js on lines 95..149

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

                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 (this.layer.wmsParams.colorscalerange) {
                      // Use colorscalerange if defined on the layer
                      this.min = +this.layer.wmsParams.colorscalerange.split(",")[0];
                      this.max = +this.layer.wmsParams.colorscalerange.split(",")[1];
                      this.redraw();
                Severity: Major
                Found in src/core/leaflet-ncwms-colorbar.js and 1 other location - About 2 hrs to fix
                src/components/NcWMSColorbarControl/LeafletNcWMSColorbarControl.js on lines 117..191

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

                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

                  if (metadata.comparand_id && metadata.comparand_id !== metadata.variable_id) {
                    header.push("Comparand ID");
                    header.push("Comparand Name");
                    values.push(metadata.comparand_id);
                    values.push(metadata.comparandMeta[0].variable_name);
                Severity: Major
                Found in src/core/export.js and 1 other location - About 2 hrs to fix
                src/core/export.js on lines 210..215

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

                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