Showing 107 of 240 total issues
Function DashboardWidgetDatagroupTimeSeriesPage
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
const DashboardWidgetDatagroupTimeSeriesPage = props => {
const { slice } = props;
const { widget, dashboard } = slice;
let metadata = {
- 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
Method check_values_numericality
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def check_values_numericality
if values.present?
values.each do |k, v|
if v.present?
unless v.is_a? Numeric
- 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
Method slices
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def slices(widget, limit: 0)
arr = []
period_start = series_end&.beginning_of_month
- 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 Field
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
const Field = props => {
const {
id,
classNames,
label,
- 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
Method check_frequency
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def check_frequency
if data_table&.period.present?
case data_table.period
when 'month'
query = data_table.data_rows.within_interval(
- 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 convertData
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
function convertData(data) {
if (!data || !data.length) {
return null;
} else {
let tempData = data.map((c, i) =>
- 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
Method initialize
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def initialize(widget, period, period_start, period_end, groups, data_rows=nil, row_label=nil)
Function convertDataForLine
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
function convertDataForLine(_data, _range) {
let data = _data;
let range = _range || 13;
if (data && data.length) {
for (let i = 0; i < data.length; i++) {
- 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
Method slices
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def slices(widget, limit: 0)
puts 'RUNNING SLICES METHOD IN DATA TABLE DECORATOR ++++++++++++++++++++++++++++++++++'
# Jon todo: this needs to differentiate between custom and month slices, same as the data table class function
# For custom rows which will probably have the same month date, return a new slice with one row for each
- 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
Method update
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def update(options={}, &block)
if params.dig(:widget, :options).present?
begin
resource.options = JSON.parse params[:widget].delete(:options)
rescue JSON::ParserError => e
- 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 hasNegativeValue
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
const hasNegativeValue = function hasNegativeValue(series) {
let hasNegative = false;
for (let i = 0; i < series.length; i++) {
for (let j = 0; j < series[i].length; j++) {
if (series[i][j].y < 0) {
- 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
Method parse_values
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def parse_values
if params.dig(:data_row, :values).present?
begin
return JSON.parse params[:data_row].delete :values
rescue JSON::ParserError => e
- 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
Method create_full
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def create_full
dashboard = Dashboard.new dashboard_params
dashboard.notes = params[:notes].as_json
dashboard.published_at = Time.now
dashboard.save!
- 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
Method create_kpis
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def create_kpis
data_table = DataTable.create({
:dashboard_id => @dashboard.id,
:options => {
:period => 'month',
- 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 handleGaEvent
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
eventCategory,
eventAction,
eventLabel,
eventValue,
fieldsObject,
Function formatData
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
const formatData = function(value, _prefix, _suffix, rounded, isMoney) {
Function TrafficLight
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
const TrafficLight = ({
dateSeriesEnd,
datePublished,
type,
units,
- 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
Method summary
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def summary
num_rows = data_table&.data_rows&.count || 0
if num_rows > 1 && datasets.count == 1 # Only for sparklines
date = data_table.previous.row_date.to_formatted_s :month_year
- 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 requirablePropType
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
const requirablePropType = testFn => {
function testProperty(props, propName, componentName) {
var propVal = props[propName];
var propIsEmpty = [undefined, null, ''].indexOf(propVal) > -1;
//extract very last argument to see if this is required
- 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
Method update
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def update(options={}, &block)
if params.dig(:dashboard, :notes).present?
begin
resource.notes = JSON.parse params[:dashboard].delete(:notes)
rescue JSON::ParserError => e
- 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"