pacificclimate/climate-explorer-frontend

View on GitHub

Showing 120 of 355 total issues

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

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

    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

        Function assignDataToYAxis has 66 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function assignDataToYAxis(graph, seriesMetadata, groupByUnits = false) {
          // get sorting algorithm, if the chart already has one.
          const sortingParams = {
            y: axisSortingParams(graph, "y"),
            y2: axisSortingParams(graph, "y2"),
        Severity: Major
        Found in src/core/chart-generators.js - About 2 hrs to fix

          Function dataToLongTermAverageGraph has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
          Open

          function dataToLongTermAverageGraph(data, contexts = []) {
            // blank graph data object to be populated - holds data values
            // and individual-timeseries-level display options.
            let c3Data = {
              columns: [],
          Severity: Minor
          Found in src/core/chart-generators.js - About 2 hrs 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

          Function dataToLongTermAverageGraph has 64 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function dataToLongTermAverageGraph(data, contexts = []) {
            // blank graph data object to be populated - holds data values
            // and individual-timeseries-level display options.
            let c3Data = {
              columns: [],
          Severity: Major
          Found in src/core/chart-generators.js - About 2 hrs to fix

            Function getData has 63 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              getData: function (props) {
                if (this.multiYearMeanSelected(props)) {
                  //load Annual Cycle graph
                  this.setAnnualCycleGraphNoDataMessage("Loading Data");
            
            

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

                render() {
                  // TODO: Improve returned item
                  if (!_.allDefined(this.props, "model_id", "experiment", "variable_id")) {
                    return "Readying...";
                  }

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

                  render() {
                    function countsByGroup(meta, grouper) {
                      const groupedByPropName = _.groupBy(meta, grouper);
                      const countsByPropValue = _.map(groupedByPropName, (group, key) => ({
                        key,

                  File chart-transformers.js has 267 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  /************************************************************************
                   * chart-transformers.js - functions that accept a C3 chart specification
                   *   for a timeseries chart and alter the data to produce a different
                   *   type of chart.
                   *
                  Severity: Minor
                  Found in src/core/chart-transformers.js - About 2 hrs to fix

                    Function AnomalyAnnualCycleGraph has 60 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    export default function AnomalyAnnualCycleGraph(props) {
                      function getDateRangeMetadatas(start = undefined, end = undefined) {
                        // returns metadata for all datasets whose model, experiment, and variable
                        // match the values specified in props, and whose start year is greater
                        //than start, and whose end year is less than end.
                    Severity: Major
                    Found in src/components/graphs/AnomalyAnnualCycleGraph.js - About 2 hrs to fix

                      File DualMapController.js has 265 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      /*************************************************************************
                       * DualMapController - displays two variables on the map at once
                       *
                       * This controller coordinates a map displaying two layers at once:
                       *   * A raster layer with colour shading reflecting values
                      Severity: Minor
                      Found in src/components/map-controllers/DualMapController/DualMapController.js - About 2 hrs to fix

                        Function SingleContextGraph has 58 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        export default function SingleContextGraph(props) {
                          function getMetadata() {
                            const {
                              ensemble_name,
                              experiment,
                        Severity: Major
                        Found in src/components/graphs/SingleContextGraph.js - About 2 hrs to fix

                          Function DualVariableResponseGraph has 58 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          export default function DualVariableResponseGraph(props) {
                            function getMetadata() {
                              const {
                                model_id,
                                experiment,
                          Severity: Major
                          Found in src/components/graphs/DualVariableResponseGraph.js - About 2 hrs to fix

                            Function timeseriesToTimeseriesGraph has 57 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            function timeseriesToTimeseriesGraph(metadata, ...data) {
                              // blank graph data object to be populated - holds data values
                              // and individual-timeseries-level display options.
                              let c3Data = {
                                columns: [],
                            Severity: Major
                            Found in src/core/chart-generators.js - About 2 hrs to fix

                              Function refreshValues has 57 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                refreshValues: function () {
                                  /*
                                   * Source new values from the ncWMS server. Possible future breakage due to
                                   * using layer._url and layer._map.
                                   */
                              Severity: Major
                              Found in src/components/NcWMSColorbarControl/LeafletNcWMSColorbarControl.js - About 2 hrs to fix

                                File smoke.js has 260 lines of code (exceeds 250 allowed). Consider refactoring.
                                Open

                                import React from "react";
                                import ReactDOM from "react-dom";
                                import DualMapController from "../DualMapController";
                                import SingleMapController from "../SingleMapController";
                                import PrecipMapController from "../PrecipMapController";
                                Severity: Minor
                                Found in src/components/map-controllers/__tests__/smoke.js - About 2 hrs to fix

                                  Function PercentileLongTermAveragesGraph has 55 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                  export default function PercentileLongTermAveragesGraph(props) {
                                    function getMetadata(timeOfYear) {
                                      // get a list of all available percentiles
                                      function parsePercentile(metad) {
                                        const clim_stat = metad["climatological_statistic"];
                                  Severity: Major
                                  Found in src/components/graphs/PercentileLongTermAveragesGraph.js - About 2 hrs to fix

                                    Function dataToGraphSpec has 55 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                      function dataToGraphSpec(meta, data) {
                                        // Convert `data` (described by `meta`) to a graph specification compatible
                                        // with `DataGraph`.
                                    
                                        let graph = timeseriesToAnnualCycleGraph(meta, ...data);
                                    Severity: Major
                                    Found in src/components/graphs/DualAnnualCycleGraph.js - About 2 hrs to fix

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

                                        render: function () {
                                          var statsData = this.state.statsData
                                            ? this.state.statsData
                                            : this.blankStatsData;
                                      
                                      
                                        Severity
                                        Category
                                        Status
                                        Source
                                        Language