18F/State-TalentMAP

View on GitHub
src/utilities.js

Summary

Maintainability
A
2 hrs
Test Coverage

Showing 3 of 3 total issues

Function focusByFirstOfHeader has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

export const focusByFirstOfHeader = (timeout = 1) => {
setTimeout(() => {
let element = document.getElementsByTagName('h1');
if (element) { element = element[1]; }
if (!element) { element = document.getElementsByTagName('h2')[0]; }
Severity: Minor
Found in src/utilities.js - About 1 hr to fix

Function propSort has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

export const propSort = (propName, nestedPropName) => (a, b) => {
let A = a[propName];
if (nestedPropName) { A = a[propName][nestedPropName]; }
A = A.toString().toLowerCase();
let B = b[propName];
Severity: Minor
Found in src/utilities.js - About 45 mins to fix

Function difference has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

export const difference = (base, object) => transform(object, (result, value, key) => {
/* eslint-disable no-param-reassign */
if (!isEqual(value, base[key])) {
result[key] = isObject(value) && isObject(base[key]) ?
difference(base[key], value) :
Severity: Minor
Found in src/utilities.js - About 35 mins to fix

There are no issues that match your filters.

Category
Status