Showing 7 of 51 total issues
File utilities.spec.js
has 420 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
'use strict';
import chai from 'chai';
import {
constructInterestObj,
constructTrendingObj,
Function getInterestResults
has 82 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function getInterestResults(request) {
return (searchType, obj) => {
const map = {
'Auto complete': {
path: `/trends/api/autocomplete/${encodeURIComponent(obj.keyword)}`,
File utilities.js
has 287 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
'use strict';
export function isLessThan7Days(date1, date2) {
return (Math.abs(date2 - date1) / (24 * 60 * 60 * 1000)) < 7;
}
Function getTrendingResults
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function getTrendingResults(request) {
return (searchType, obj) => {
const searchTypeMap = {
'Daily trends': {
path: '/trends/api/dailytrends',
Function constructTrendingObj
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function constructTrendingObj(obj, cbFunc) {
if (typeof obj === 'function') cbFunc = obj;
if (!obj || !!obj && typeof obj !== 'object' || Array.isArray(obj)) {
obj = new Error('Must supply an object');
Function constructTrendingObj
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
Open
export function constructTrendingObj(obj, cbFunc) {
if (typeof obj === 'function') cbFunc = obj;
if (!obj || !!obj && typeof obj !== 'object' || Array.isArray(obj)) {
obj = new Error('Must supply an object');
- 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 constructInterestObj
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
Open
export function constructInterestObj(obj, cbFunc) {
if (typeof obj === 'function') cbFunc = obj;
obj = validateObj(obj, cbFunc);
- 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"