Showing 120 of 355 total issues
File InformationItems.js
has 700 lines of code (exceeds 250 allowed). Consider refactoring. Open
// Central resource for LabelWithInfo and Information items used throughout
// the app.
import React from "react";
import { Link } from "react-router-dom";
File util-test.js
has 501 lines of code (exceeds 250 allowed). Consider refactoring. Open
/********************************************************
* util-test.js - tests for the functions in util.js
*
* There is one test (sometimes multiple parts) for each
* function in ../util.js. The tests have the same names as
File chart-generators.js
has 498 lines of code (exceeds 250 allowed). Consider refactoring. Open
/* **********************************************************************
* chart-generators.js - functions that generate a C3 chart specification
* object from backend query results and metadata describing the query.
*
* The three primary functions in this file are:
Function DualAnnualCycleGraph
has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring. Open
export default function DualAnnualCycleGraph({
model_id,
experiment,
variable_id,
meta,
- Read upRead up
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 render
has 136 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
const filteredMetaVariable = this.filterMetaBy(
"model",
"scenario",
"variable",
File chart-generator-tests.js
has 382 lines of code (exceeds 250 allowed). Consider refactoring. Open
/* ***************************************************************
* chart-generator-tests.js - tests for chart generation functions
*
* One test (sometimes with multiple parts) for each function in
* chart-generator-tests.js. The tests have the same names and are
Function render
has 122 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
const filteredMetaVariable = this.filterMetaBy(
"model",
"scenario",
"variable",
Function render
has 113 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
const filteredMeta = this.filterMetaBy("model", "scenario", "variable");
const filteredPercentileMeta = this.filterPercentileMetaBy(
"model",
"scenario",
Function render
has 108 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
const filteredMeta = this.filterMetaBy("model", "scenario", "variable");
const modelContextMetadata = this.filterMetaBy("scenario", "variable");
const model_id = this.representativeValue("model", "model_id");
Function render
has 102 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
const metaToKeyedData = (m) => ({
key: `${m.ensemble_member} ${m.start_date}-${m.end_date}`,
...m,
});
File util.js
has 335 lines of code (exceeds 250 allowed). Consider refactoring. Open
/***********************************************************
* util.js - a collection of data-handling functions
***********************************************************/
import moment from "moment/moment";
Function makeVariableResponseGraph
has 90 lines of code (exceeds 25 allowed). Consider refactoring. Open
function makeVariableResponseGraph(x, y, graph) {
let c3Data = {};
const seriesNameContains = function (series, keyword) {
return caseInsensitiveStringSearch(series[0], keyword);
Function makeAnomalyGraph
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
function makeAnomalyGraph(base, variable_id, graph) {
//anomalies for some variables are typically expressed as percentages.
//if this is a single variable graph, check the variable configuration
//to see if this is one of them; if so, display percentages on the chart.
const displayPercent =
- Read upRead up
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 assignDataToYAxis
has a Cognitive Complexity of 24 (exceeds 5 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"),
- Read upRead up
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 render
has 82 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
// TODO: Add positioning for autoset
const dataLayers = DataMap.layerTypes.map(
(layerType) =>
File sample-API-results.js
has 302 lines of code (exceeds 250 allowed). Consider refactoring. Open
/*********************************************************************
* sample-API-results.js - sample data for testing.
*
* A collection of objects representing sample results from the
* climate explorer backend API, used to test data validation, graph
Function render
has 79 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
const mapLegend = (
<MapLegend
{...this.props}
{...this.state}
Function render
has 78 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
// TODO: Extract this to a separate component
const LayerVisibilityButton = ({ layerVisibility, onClick }) => (
<Button bsSize={"xsmall"} onClick={onClick}>
<Glyphicon glyph={layerVisibility ? "eye-open" : "eye-close"} />
Function makeAnomalyGraph
has 76 lines of code (exceeds 25 allowed). Consider refactoring. Open
function makeAnomalyGraph(base, variable_id, graph) {
//anomalies for some variables are typically expressed as percentages.
//if this is a single variable graph, check the variable configuration
//to see if this is one of them; if so, display percentages on the chart.
const displayPercent =
Function exportDataToWorksheet
has 74 lines of code (exceeds 25 allowed). Consider refactoring. Open
var exportDataToWorksheet = function (
datatype,
metadata,
data,
format,