pacificclimate/climate-explorer-frontend

View on GitHub

Showing 97 of 339 total issues

Function padYAxis has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

function padYAxis (graph, axis = "y", direction = "top", padding = 1) {
  if(padding <= 0) {
    throw new Error("Error: Graph axis padding value must be greater than 0");
  }
  
Severity: Minor
Found in src/core/chart-formatters.js - About 55 mins 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 a Cognitive Complexity of 8 (exceeds 5 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 45 mins 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 nameAPICallParametersFunction has a Cognitive Complexity of 8 (exceeds 5 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 45 mins 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 axisSortingParams has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

function axisSortingParams(graph, yAxis) {
  let params = {
    units: '',
    groupBy: { type: '', value: '' },
  };
Severity: Minor
Found in src/core/chart-generators.js - About 45 mins 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 exportDataToWorksheet has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

var exportDataToWorksheet = function(datatype, metadata, data, format, selection) {
Severity: Minor
Found in src/core/export.js - About 35 mins to fix

    Function getDatasetIdentifiers has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

      props, state, varSymbol, relevantMeta, encodedVarTimeIdx
    Severity: Minor
    Found in src/components/map-controllers/map-helpers.js - About 35 mins to fix

      Function SingleAnnualCycleGraph has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

      export default function SingleAnnualCycleGraph(props) {
        function getMetadata(dataSpec) {
          // Find and return metadata matching the parameters in the dataSpec:
          // model_id, experiment, variable_id (supplied by parent)
          // start_date, end_date, ensemble_name (chosen by this component)
      Severity: Minor
      Found in src/components/graphs/SingleAnnualCycleGraph.js - About 35 mins 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 hideTicksByRange has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

      function hideTicksByRange(graph, axis = "y", min, max) {
        const oldFormatFunction = graph.axis[axis].tick.format;
        const axisSeries = getDataSeriesByAxis(graph, axis);
        
        //if a range is not supplied, generate one from the data
      Severity: Minor
      Found in src/core/chart-formatters.js - About 35 mins 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 timestampToTimeOfYear has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

      export function timestampToTimeOfYear(
        timestamp, resolution='monthly', disambiguateYear = true
      ) {
        const year = disambiguateYear ? ' '.concat(timestampToYear(timestamp)) : '';
        const month = moment(timestamp, moment.ISO_8601).utc().format('MMMM');
      Severity: Minor
      Found in src/core/util.js - About 35 mins 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 DualVariableResponseGraph has a Cognitive Complexity of 7 (exceeds 5 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 35 mins 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 getDataUnits has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

      export function getDataUnits(data, variable_id) {
        const units = data.units;
        const userFriendlyUnits = getVariableOptions(variable_id, "userFriendlyUnits");
        if(userFriendlyUnits) {
          for(let i = 0; i < userFriendlyUnits.length; i++) {
      Severity: Minor
      Found in src/core/util.js - About 25 mins 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 allDefinedArray has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

      var allDefinedArray = function (array) {
        var height = array.length;
        var width = array[0].length;
        for(var i = 0; i < height; i++) {
          for(var j = 0; j < height; j++) {
      Severity: Minor
      Found in src/core/__test_data__/test-validators.js - About 25 mins 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 fadeSeriesByRank has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

      function fadeSeriesByRank (graph, ranker) {
      
        let rankDictionary = {};
      
        for(let column of graph.data.columns) {
      Severity: Minor
      Found in src/core/chart-formatters.js - About 25 mins 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 a Cognitive Complexity of 6 (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/core/leaflet-ncwms-colorbar.js - About 25 mins 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 findMatchingMetadata has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

      function findMatchingMetadata(example, difference, meta) {
        // Given a dataset's metadata and a "difference" listing of attribute values pairs,
        // returns metadata for another dataset that:
        // - matches all attribute/value pairs in the "difference object"
        // - matches the original dataset for any attributes not in "difference"
      Severity: Minor
      Found in src/components/graphs/graph-helpers.js - About 25 mins 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 validateLongTermAverageData has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

      export function validateLongTermAverageData(response) {
        if (_.isEmpty(response.data) || (typeof response.data === 'string')) {
          throw new Error('Error: long term data unavailable for this model.');
        }
        for (const run in response.data) {
      Severity: Minor
      Found in src/core/util.js - About 25 mins 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 timeseriesToTimeseriesGraph has a Cognitive Complexity of 6 (exceeds 5 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: Minor
      Found in src/core/chart-generators.js - About 25 mins 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

      Severity
      Category
      Status
      Source
      Language