Showing 120 of 355 total issues
Function render
has 73 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
const mapLegend = (
<MapLegend
{...this.props}
{...this.state}
Function render
has 71 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
return (
<div id={"table"}>
<BootstrapTable
data={this.props.data}
Function SingleTimeSliceGraph
has 71 lines of code (exceeds 25 allowed). Consider refactoring. Open
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() {
Function assignDataToYAxis
has 66 lines of code (exceeds 25 allowed). Consider refactoring. Open
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"),
Function dataToLongTermAverageGraph
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
Open
function dataToLongTermAverageGraph(data, contexts = []) {
// blank graph data object to be populated - holds data values
// and individual-timeseries-level display options.
let c3Data = {
columns: [],
- 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 dataToLongTermAverageGraph
has 64 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function dataToLongTermAverageGraph(data, contexts = []) {
// blank graph data object to be populated - holds data values
// and individual-timeseries-level display options.
let c3Data = {
columns: [],
Function getData
has 63 lines of code (exceeds 25 allowed). Consider refactoring. Open
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
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
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
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.
*
Function AnomalyAnnualCycleGraph
has 60 lines of code (exceeds 25 allowed). Consider refactoring. Open
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.
File DualMapController.js
has 265 lines of code (exceeds 250 allowed). Consider refactoring. Open
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
Function SingleContextGraph
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export default function SingleContextGraph(props) {
function getMetadata() {
const {
ensemble_name,
experiment,
Function DualVariableResponseGraph
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export default function DualVariableResponseGraph(props) {
function getMetadata() {
const {
model_id,
experiment,
Function timeseriesToTimeseriesGraph
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function timeseriesToTimeseriesGraph(metadata, ...data) {
// blank graph data object to be populated - holds data values
// and individual-timeseries-level display options.
let c3Data = {
columns: [],
Function refreshValues
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
refreshValues: function () {
/*
* Source new values from the ncWMS server. Possible future breakage due to
* using layer._url and layer._map.
*/
File smoke.js
has 260 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import React from "react";
import ReactDOM from "react-dom";
import DualMapController from "../DualMapController";
import SingleMapController from "../SingleMapController";
import PrecipMapController from "../PrecipMapController";
Function PercentileLongTermAveragesGraph
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
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"];
Function dataToGraphSpec
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function dataToGraphSpec(meta, data) {
// Convert `data` (described by `meta`) to a graph specification compatible
// with `DataGraph`.
let graph = timeseriesToAnnualCycleGraph(meta, ...data);
Function render
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render: function () {
var statsData = this.state.statsData
? this.state.statsData
: this.blankStatsData;