Showing 11 of 11 total issues
Function fetchData
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
function fetchData (url, opts, cb) {
const originalUrl = opts.originalUrl
const charset = opts.charset
const jsonpUrlQueryParam = getUrlQueryParamByName(url, opts.jsonp)
const funcId = (jsonpUrlQueryParam === '?' ? false : jsonpUrlQueryParam) || opts.name || `__jsonp${timestamp++}`
- 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 exports
has 81 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = function (config) {
config.set({
// base path that will be used to resolve all patterns (eg. files, exclude)
basePath: '',
Function fetchData
has 66 lines of code (exceeds 25 allowed). Consider refactoring. Open
function fetchData (url, opts, cb) {
const originalUrl = opts.originalUrl
const charset = opts.charset
const jsonpUrlQueryParam = getUrlQueryParamByName(url, opts.jsonp)
const funcId = (jsonpUrlQueryParam === '?' ? false : jsonpUrlQueryParam) || opts.name || `__jsonp${timestamp++}`
Function jsonp
has 59 lines of code (exceeds 25 allowed). Consider refactoring. Open
function jsonp (url, opts, cb) {
if (isFunction(url)) {
cb = url
opts = {}
} else if (url && typeof url === 'object') {
Function jsonp
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
function jsonp (url, opts, cb) {
if (isFunction(url)) {
cb = url
opts = {}
} else if (url && typeof url === '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 fallback
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
function fallback (url, opts, cb) {
const backup = opts.backup
let backupWithParams
if (backup) {
if (typeof backup === 'string') {
Function getDataFromStore
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
function getDataFromStore ({ useStore, storeKey, storeCheck, storeCheckKey, storeSign, dataCheck }) {
useStore = useStore ? store.enabled : false
if (useStore) {
const storeData = store.get(storeKey)
storeCheck = storeCheck || storeCheckFn
- 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 fallback
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
function fallback (url, opts, cb) {
const backup = opts.backup
let backupWithParams
if (backup) {
if (typeof backup === 'string') {
- 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 too many return
statements within this function. Open
return new Promise((resolve, reject) => {
fetchData(urlWithParams, opts, (err, data) => {
if (err) {
cb(err)
return reject(err)
Function exports
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
module.exports = function (config) {
config.set({
// base path that will be used to resolve all patterns (eg. files, exclude)
basePath: '',
- 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 getDataFromStoreWithoutCheck
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
function getDataFromStoreWithoutCheck ({ useStore, storeKey, dataCheck }) {
useStore = useStore ? store.enabled : false
if (useStore) {
const storeData = store.get(storeKey)
if (!dataCheck || (storeData && dataCheck && dataCheck(storeData) !== false)) {
- 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"