Showing 62 of 189 total issues
Function CompositeItem
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
export const CompositeItem: React.FC<CompositeItemProps> = (props: CompositeItemProps) => {
const [composite, _setComposite] = useState(props.composite);
const getDisplayMode = (displayMode: string) => {
const keys = DisplayModes.keys();
for (const aKey of keys) {
- 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 config
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
const config = async (env): Promise<Configuration> => {
const baseConfig: Configuration = {
cache: {
type: 'filesystem',
buildDependencies: {
- 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 getProcessedDataFrames
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
export function getProcessedDataFrames(results?: DataQueryResponseData[]): DataFrame[] {
if (!results || !isArray(results)) {
return [];
}
- 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 (columnsUsed > maxColumnsUsed) {
maxColumnsUsed = columnsUsed;
}
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);
}
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 (aField.state) {
copiedField.state = Object.assign({}, aField.state);
}
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 (value) {
extractedTxt += extractedTxt.length > 0 ? ' ' + value.toString() : value.toString();
}
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 (aMetric.alias && aMetric.alias.length > 0) {
seriesItem.displayName = resolveMemberAliasTemplates(aMetric.alias, matches);
}
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 (valueRounded !== null) {
data[index].valueRounded = valueRounded;
}
Function getTextSizeForWidthAndHeight
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
text: string,
font: any,
width: number,
height: number,
minFontPx: number,
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
if (appendLabels.length > 0) {
// sort them first
appendLabels.sort();
hintValue += '{' + appendLabels.join('') + '}';
}
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 (formatted.suffix) {
data[index].valueFormatted += ` ${formatted.suffix}`;
}
Avoid deeply nested control flow statements. Open
for (const threshold of v) {
const migratedThreshold: PolystatThreshold = {
value: threshold.value,
state: threshold.state,
color: threshold.color,