Showing 38 of 77 total issues
Function includedResources
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default function includedResources(resourceType, options = {}) {
return (state, action) => {
const { initialResourceMeta } = options;
const { includedResources, mergeMeta, mergeResources, type } = action;
Function setResourceMeta
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default function setResourceMeta(options) {
const {
resources,
newMeta,
meta,
Function upsertResources
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
export default function upsertResources(
resources,
newResources,
mergeResources
) {
- 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 getSingleStatus
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
function getSingleStatus(state, statusLocation, treatIdleAsPending) {
const splitPath = getPathParts(statusLocation);
let status;
let currentVal = state;
- 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 getUserBooks
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default function getUserBooks() {
return function(dispatch) {
dispatch({
type: actionTypes.READ_RESOURCES_PENDING,
resourceType: 'books',
Function selection
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
function selection(resourceType) {
return function(state, action) {
// Ignore actions that were dispatched for another resource type
const typeToUse = action.resourceType || action.resourceName;
if (typeToUse !== resourceType) {
Function request
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default function request(uri, options, cb) {
let params = {};
// This handles the `xhr(options, cb)` syntax
if (typeof uri === 'object') {
params = uri;
Function getStatus
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
export default function getStatus(state, statusLocations, treatIdleAsPending) {
if (!Array.isArray(statusLocations)) {
const status = getSingleStatus(state, statusLocations, treatIdleAsPending);
if (process.env.NODE_ENV !== 'production') {
- 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 getLatestBooks
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default function getLatestBooks() {
return function(dispatch) {
dispatch({
type: actionTypes.READ_RESOURCES_PENDING,
resourceType: 'books',
Function requestStatusesPlugin
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default function requestStatusesPlugin(resourceType, options = {}) {
const customInitialMeta = options.initialResourceMeta || {};
const optionsToSend = {
initialResourceMeta: {
...initialResourceMetaState,
Function request
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
export default function request(uri, options, cb) {
let params = {};
// This handles the `xhr(options, cb)` syntax
if (typeof uri === 'object') {
params = uri;
- 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 (typeof r !== 'string' && typeof r !== 'number') {
warning(
`A resource without an ID was passed to an action with type ` +
`${
action.type
Avoid deeply nested control flow statements. Open
if (
(!r.id && r.id !== 0) ||
(typeof r.id !== 'string' && typeof r.id !== 'number')
) {
warning(
Function upsertMeta
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
export default function upsertMeta(meta, newMeta, mergeMeta) {
if (!newMeta) {
return meta;
}
- 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 createActionCreators
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
const createActionCreators = (crudType, actionDefaults = {}) => {
const { resourceName, resourceType } = actionDefaults;
const typeToUse = resourceType || resourceName;
const uppercaseCrud =
typeof crudType === 'string' ? crudType.toUpperCase() : '';
- 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 state;
Avoid too many return
statements within this function. Open
return byId ? resourceArrayToObject(resourcesList) : resourcesList;
Function warning
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export default function warning(message, code) {
// This ensures that each warning type is only logged out one time
if (code) {
if (codeCache[code]) {
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"