pacificclimate/climate-explorer-frontend

View on GitHub

Showing 97 of 339 total issues

Function dataToGraphSpec has 46 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: Minor
Found in src/components/graphs/DualAnnualCycleGraph.js - About 1 hr to fix

    Function PercentileLongTermAveragesGraph has 45 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) {
    Severity: Minor
    Found in src/components/graphs/PercentileLongTermAveragesGraph.js - About 1 hr to fix

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

      export default function SingleContextGraph(props) {
        function getMetadata() {
          const {
            ensemble_name, experiment, variable_id, area, contextMeta, model_id
          } = props;
      Severity: Minor
      Found in src/components/graphs/SingleContextGraph.js - About 1 hr to fix

        Function makeVariableResponseGraph has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
        Open

        function makeVariableResponseGraph (x, y, graph) {
          let c3Data = {};
        
          const seriesNameContains = function (series, keyword) {
            return caseInsensitiveStringSearch(series[0], keyword);
        Severity: Minor
        Found in src/core/chart-transformers.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 refreshValues has 42 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: Minor
        Found in src/core/leaflet-ncwms-colorbar.js - About 1 hr to fix

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

            render() {
              const faqs = T.get(this.context, 'help.faq.items');
          
              if (!_.isArray(faqs)) {
                return null;
          Severity: Minor
          Found in src/components/guidance-content/help/FAQ.js - About 1 hr to fix

            Function shortestUniqueTimeseriesNamingFunction has 42 lines of code (exceeds 25 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

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

                render() {
                  return (
                    <Panel>
                      <Panel.Heading>
                        <Panel.Title>
              Severity: Minor
              Found in src/components/StatisticalSummaryTable/StatisticalSummaryTable.js - About 1 hr to fix

                Function generateDataCellsFromC3Graph has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                var generateDataCellsFromC3Graph = function(graph, seriesLabel="Time Series", variable="") {
                  var headers = [];
                  var rows = [];
                  var column_labels = [seriesLabel];
                
                
                Severity: Minor
                Found in src/core/export.js - About 1 hr to fix

                  Function fillContainer has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    fillContainer: function () {
                      Object.assign(this.container.style, {
                        position: 'relative',
                        width: this.options.width + 'px',
                        height: this.options.height + 'px',
                  Severity: Minor
                  Found in src/components/NcWMSColorbarControl/LeafletNcWMSColorbarControl.js - About 1 hr to fix

                    Function allDefinedObject has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                    Open

                    var allDefinedObject = function (obj) {
                      for(let att in obj) {
                        if(typeof obj[att] == "undefined") {
                          return false;
                        }
                    Severity: Minor
                    Found in src/core/__test_data__/test-validators.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 getAllTimestamps has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                    Open

                    function getAllTimestamps(data) {
                      let allTimes = [];
                    
                      const addSeries = function (seriesData) {
                        for (let timestamp in seriesData) {
                    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

                    Function timeseriesToAnnualCycleGraph has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    function timeseriesToAnnualCycleGraph(metadata, ...data) {
                      // 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 1 hr to fix

                      Function onAdd has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        onAdd: function () {
                          // Container element
                          this.container = L.DomUtil.create('div', 'leaflet-control');
                      
                          Object.assign(this.container.style, {
                      Severity: Minor
                      Found in src/core/leaflet-ncwms-colorbar.js - About 1 hr to fix

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

                          getData: function (props) {
                            if(this.multiYearMeanSelected(props)) { //load Annual Cycle graph
                              this.setAnnualCycleGraphNoDataMessage("Loading Data");
                        
                              var monthlyMetadata = _.find(props.meta,{

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

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

                            Function DualTimeSeriesGraph has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

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

                              Function refreshValues has a Cognitive Complexity of 12 (exceeds 5 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: Minor
                              Found in src/components/NcWMSColorbarControl/LeafletNcWMSColorbarControl.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 makeTimeSliceGraph has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                              function makeTimeSliceGraph (timestamp, graph) {
                                let slicedData = [];
                                let timestamps = [];
                                let sliceIndex = -1;
                              
                              
                              Severity: Minor
                              Found in src/core/chart-transformers.js - About 1 hr to fix

                                Function loadMap has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                  loadMap(
                                    props,
                                    dataSpec,
                                    newVariable = false,
                                    newComparand = false
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language