pacificclimate/climate-explorer-frontend

View on GitHub

Showing 120 of 355 total issues

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

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

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

              function nameAPICallParametersFunction(contexts) {
                let variation = [];
                const exemplarContext = contexts[0];
              
                for (let context of contexts) {
              Severity: Minor
              Found in src/core/chart-generators.js - About 1 hr to fix

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

                  render() {
                    return (
                      <div className={styles.timeslider}>
                        <Slider
                          step={1}
                Severity: Minor
                Found in src/components/TimeSlider/TimeSlider.js - About 1 hr to fix

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

                    function assignColoursByGroup(
                      graph,
                      segmentor,
                      colourList = category10Colours,
                    ) {
                    Severity: Minor
                    Found in src/core/chart-formatters.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

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

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

                      Function getMetadata has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

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

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

                            loadGraph() {
                              // Fetch data for graph, then convert it to a graph spec and set state
                              // accordingly.
                          
                              if (!shouldLoadData(this.props, this.displayNoDataMessage)) {

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

                                function getMetadata(dataSpec) {
                                  // Find and return metadata matching the data specification (`dataSpec`):
                                  // model_id, experiment, variable_id, start_date, end_date, ensemble_member
                                  // for monthly, seasonal and annual timescales.
                                  // Variable, model, and experiment are supplied by the graph's parent, but
                              Severity: Minor
                              Found in src/components/graphs/DualAnnualCycleGraph.js - About 1 hr to fix

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

                                  render() {
                                    return (
                                      <div className={styles.selectorframe}>
                                        <ControlLabel
                                          className={
                                Severity: Minor
                                Found in src/components/Selector/Selector.js - About 1 hr to fix

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

                                    render() {
                                      const center = _.pick(this.props.origin, "lat", "lng");
                                      return (
                                        <Map
                                          crs={this.props.crs}
                                  Severity: Minor
                                  Found in src/components/CanadaBaseMap/CanadaBaseMap.js - About 1 hr to fix

                                    Function getStats has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                    export function getStats() {
                                      return Promise.resolve({
                                        data: {
                                          foo: {
                                            min: 0.06095475000006445,
                                    Severity: Minor
                                    Found in src/data-services/__mocks__/ce-backend.js - About 1 hr to fix

                                      Function createTimeseriesWorksheetSummaryCells has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                                      Open

                                      var createTimeseriesWorksheetSummaryCells = function (metadata, dataSpec) {
                                        var rows = [];
                                        var header = [
                                          "Model",
                                          "Emissions Scenario",
                                      Severity: Minor
                                      Found in src/core/export.js - About 1 hr to fix
                                        Severity
                                        Category
                                        Status
                                        Source
                                        Language