Showing 95 of 189 total issues
Avoid deeply nested control flow statements. Open
if (columnsUsed > maxColumnsUsed) {
maxColumnsUsed = columnsUsed;
}
Avoid deeply nested control flow statements. Open
if (!aComposite.showMembers) {
filteredMetrics.push(index);
} else {
keepMetrics.push(index);
}
Function addValueToTextMappingText
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
const addValueToTextMappingText = (
allValueMappings: ValueMapping[],
valueToTextMapping: ValueMap,
value: TimeSeriesValue
) => {
- 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
Avoid deeply nested control flow statements. Open
if (appendLabels.length > 0) {
// sort them first
appendLabels.sort();
hintValue += '{' + appendLabels.join('') + '}';
}
Function constructor
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
constructor(
width: number,
height: number,
numColumns: number,
numRows: number,
- 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
Avoid deeply nested control flow statements. Open
if (aMetric.alias && aMetric.alias.length > 0) {
seriesItem.displayName = resolveMemberAliasTemplates(aMetric.alias, matches);
}
Avoid deeply nested control flow statements. Open
for (const aLabel in aField.labels) {
if (aLabel !== '__name__') {
appendLabels.push(`${aLabel}="${aField.labels[aLabel]}"`);
}
}
Avoid deeply nested control flow statements. Open
if (formatted.suffix) {
data[index].valueFormatted += formatted.suffix;
}
Avoid deeply nested control flow statements. Open
if (formatted.prefix) {
data[index].valueFormatted = formatted.prefix + data[index].valueFormatted;
}
Avoid deeply nested control flow statements. Open
for (const aMember of Object.keys(v)) {
const x = v[aMember];
let member: CompositeMetric = {
seriesMatch: x.seriesName,
order: memberIndex,
Avoid deeply nested control flow statements. Open
if (aField.state) {
copiedField.state = Object.assign({}, aField.state);
}
Function GetDecimalsForValue
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
function GetDecimalsForValue(value: any, panelDecimals: any): { decimals: number; scaledDecimals: any } {
if (lodashIsNumber(panelDecimals)) {
return { decimals: panelDecimals, scaledDecimals: null };
}
- 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
Avoid deeply nested control flow statements. Open
for (const threshold of v) {
const migratedThreshold: PolystatThreshold = {
value: threshold.value,
state: threshold.state,
color: threshold.color,
Avoid deeply nested control flow statements. Open
if (value) {
extractedTxt += extractedTxt.length > 0 ? ' ' + value.toString() : value.toString();
}
Avoid deeply nested control flow statements. Open
if (formatted.suffix) {
data[index].valueFormatted += ` ${formatted.suffix}`;
}
Avoid deeply nested control flow statements. Open
if (formatted.prefix) {
data[index].valueFormatted = `{$formatted.prefix} ${data[index].valueFormatted}`;
}
Avoid deeply nested control flow statements. Open
if (valueRounded !== null) {
data[index].valueRounded = valueRounded;
}
Function getTextSizeForWidth
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
function getTextSizeForWidth(text: string, font: any, width: number, minFontPx: number, maxFontPx: number) {
Function addRangeToTextMappingText
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
const addRangeToTextMappingText = (
allValueMappings: ValueMapping[],
rangeToTextMapping: RangeMap,
value: TimeSeriesValue
) => {
- 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 getMappedValue
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
export function getMappedValue(valueMappings: LegacyValueMapping[], value: any): LegacyValueMapping {
// intentional use of deprecated function for v8 compat
// eslint-disable-next-line deprecation/deprecation
const emptyResult = { type: LegacyMappingType.ValueToText, value: '', text: '', from: '', to: '', id: 0 };
if (!valueMappings?.length) {
- 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"