pacificclimate/climate-explorer-frontend

View on GitHub

Showing 358 of 358 total issues

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

  render() {
    // Setting `Router.basename` correctly is a little tricky, for two reasons:
    //
    // 1. Dynamic deployment to different URLs.
    // 2. Correctly handling requests containing client-side routes.
Severity: Minor
Found in src/components/App/App.js - About 1 hr to fix

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

      save: function (format) {
        switch (format) {
          case "wkt":
            saveAs(
              new Blob([this.toWKT()], { type: "text/plain;charset=utf-8" }),
    Severity: Minor
    Found in src/core/geo.js - About 1 hr to fix

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

        const ymax = y.max
          ? y.max
          : _.max(
              _.map(getDataSeriesByAxis(graph, "y"), (series) =>
                _.max(seriesData(series)),
      Severity: Major
      Found in src/core/chart-formatters.js and 3 other locations - About 1 hr to fix
      src/core/chart-formatters.js on lines 324..330
      src/core/chart-formatters.js on lines 338..344
      src/core/chart-formatters.js on lines 345..351

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

      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

        const ymin = y.min
          ? y.min
          : _.min(
              _.map(getDataSeriesByAxis(graph, "y"), (series) =>
                _.min(seriesData(series)),
      Severity: Major
      Found in src/core/chart-formatters.js and 3 other locations - About 1 hr to fix
      src/core/chart-formatters.js on lines 331..337
      src/core/chart-formatters.js on lines 338..344
      src/core/chart-formatters.js on lines 345..351

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

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

      export function parseWatershedTableData(data, area) {
        let avus = [];
        // convert the WKT point from the API call to geoJSON
        const point = WKTPointToGeoJSONPoint(area);
        function prec(num) {
      Severity: Minor
      Found in src/core/util.js - About 1 hr to fix

        Function timestampToTimeOfYear has 30 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export function timestampToTimeOfYear(
          timestamp,
          resolution = "monthly",
          disambiguateYear = true,
        ) {
        Severity: Minor
        Found in src/core/util.js - About 1 hr to fix

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

            const y2max = y2.max
              ? y2.max
              : _.max(
                  _.map(getDataSeriesByAxis(graph, "y2"), (series) =>
                    _.max(seriesData(series)),
          Severity: Major
          Found in src/core/chart-formatters.js and 3 other locations - About 1 hr to fix
          src/core/chart-formatters.js on lines 324..330
          src/core/chart-formatters.js on lines 331..337
          src/core/chart-formatters.js on lines 338..344

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

          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

            const y2min = y2.min
              ? y2.min
              : _.min(
                  _.map(getDataSeriesByAxis(graph, "y2"), (series) =>
                    _.min(seriesData(series)),
          Severity: Major
          Found in src/core/chart-formatters.js and 3 other locations - About 1 hr to fix
          src/core/chart-formatters.js on lines 324..330
          src/core/chart-formatters.js on lines 331..337
          src/core/chart-formatters.js on lines 345..351

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

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

            render() {
              return (
                <Modal show={this.props.controls[1].show()}>
                  <Modal.Header closeButton>
                    <Modal.Title>Import Polygon</Modal.Title>
          Severity: Minor
          Found in src/components/GeoLoader/GeoLoaderMainDialog.js - About 1 hr to fix

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

              render() {
                return (
                  <React.Fragment>
                    <Row>
                      <Col lg={6} md={6} sm={6}>
            Severity: Minor
            Found in src/components/graphs/AnnualCycleGraph/AnnualCycleGraph.js - About 1 hr to fix

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

                render() {
                  return (
                    <div id={"table"}>
                      <BootstrapTable
                        data={this.props.data}
              Severity: Minor
              Found in src/components/AttributeValueTable/AttributeValueTable.js - About 1 hr to fix

                Function createZippedShapefile has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                function createZippedShapefile(gj, options) {
                  // Alternate to function `zip` in `shp-write/src/zip`, but with option to
                  // store files in root of zipped shapefile.
                  //
                  // All behaviour is the same as the original function, with the exception
                Severity: Minor
                Found in src/core/geo.js - About 1 hr to fix

                  Function SingleLongTermAveragesGraph has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  export default function SingleLongTermAveragesGraph(props) {
                    function getMetadata(timeOfYear) {
                      const metadataFromProps = _.pick(
                        props,
                        "ensemble_name",
                  Severity: Minor
                  Found in src/components/graphs/SingleLongTermAveragesGraph.js - About 1 hr to fix

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

                    export default function GeoloaderButton(props) {
                      return (
                        <Button bsSize="small" onClick={props.open} title={props.title}>
                          <Glyphicon glyph="open-file" />
                        </Button>
                    Severity: Major
                    Found in src/components/GeoLoader/GeoLoaderButton.js and 1 other location - About 1 hr to fix
                    src/components/GeoExporter/GeoExporterButton.js on lines 4..10

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

                    export default function (props) {
                      return (
                        <Button bsSize="small" onClick={props.open} title={props.title}>
                          <Glyphicon glyph="save-file" />
                        </Button>
                    Severity: Major
                    Found in src/components/GeoExporter/GeoExporterButton.js and 1 other location - About 1 hr to fix
                    src/components/GeoLoader/GeoLoaderButton.js on lines 4..10

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

                          if (!newVariable) {
                            params.palette = this.state.raster.palette;
                            params.logscale = this.state.raster.logscale;
                          }
                    src/components/map-controllers/DualMapController/DualMapController.js on lines 159..162

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

                          if (!newVariable) {
                            rasterParams.palette = this.state.raster.palette;
                            rasterParams.logscale = this.state.raster.logscale;
                          }
                    src/components/map-controllers/SingleMapController/SingleMapController.js on lines 117..120

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

                      function getMetadata() {
                        const {
                          model_id,
                          experiment,
                          variable_id,
                    Severity: Minor
                    Found in src/components/graphs/DualVariableResponseGraph.js - About 1 hr to fix

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

                        constructor(props) {
                          super(props);
                      
                          this.state = {
                            run: undefined,

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

                        export default function SingleTimeSeriesGraph(props) {
                          function getMetadata() {
                            const { model_id, experiment, variable_id, meta } = props;
                        
                            const primaryVariableMetadata = _.find(meta, {
                        Severity: Minor
                        Found in src/components/graphs/SingleTimeSeriesGraph.js - About 1 hr to fix
                          Severity
                          Category
                          Status
                          Source
                          Language