Showing 38 of 77 total issues
Function crudRequest
has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring. Open
function crudRequest(crudAction, options) {
const {
dispatch,
xhrOptions = {},
transformData,
- 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 getPathParts
has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring. Open
export default function getPathParts(path) {
const parts = [];
let i = 0;
let nextDot, nextOpenBracket, openQuote, nextCloseBracket;
- 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 crudRequest
has 114 lines of code (exceeds 25 allowed). Consider refactoring. Open
function crudRequest(crudAction, options) {
const {
dispatch,
xhrOptions = {},
transformData,
Function resourceReducer
has 112 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default function resourceReducer(resourceType, options = {}) {
const { plugins = [], initialState = {} } = options;
const defaultInitialState = generateDefaultInitialState();
const initial = {
...defaultInitialState,
Function resourceReducer
has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring. Open
export default function resourceReducer(resourceType, options = {}) {
const { plugins = [], initialState = {} } = options;
const defaultInitialState = generateDefaultInitialState();
const initial = {
...defaultInitialState,
- 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 default
has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring. Open
export default function(state, action, { initialResourceMeta }, updatedMeta) {
const resources = action.resources;
const resourcesIsUndefined = typeof resources === 'undefined';
const hasResources = resources && resources.length;
- 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 delSucceed
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
function delSucceed(state, action, { initialResourceMeta }) {
const resources = action.resources;
let requestKey, requestName;
if (action.request && typeof action.request === '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
Function default
has 81 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default function(crudAction, requestStatus) {
return function(state, action, { initialResourceMeta } = {}) {
const resources = action.resources;
const mergeMeta = action.mergeMeta;
Function httpStatusCodes
has 77 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default function httpStatusCodes(resourceType) {
return function(state, action) {
const typeToCheck = action.resourceType || action.resourceName;
if (typeToCheck !== resourceType) {
return state;
Function default
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
export default function(resourceSlice, filter, options) {
if (process.env.NODE_ENV !== 'production') {
// We use duck typing to try and differentiate between a user passing the entire state tree
// in as `resourceSlice` (which was the original getResources API).
// eslint-disable-next-line no-inner-declarations
- 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 reducer
has 72 lines of code (exceeds 25 allowed). Consider refactoring. Open
return function reducer(state = initial, action) {
if (process.env.NODE_ENV !== 'production') {
if (
action.type === 'REQUEST_PENDING' ||
action.type === 'REQUEST_IDLE' ||
Function getStatus
has 68 lines of code (exceeds 25 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') {
Function upsertResources
has 60 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default function upsertResources(
resources,
newResources,
mergeResources
) {
Function req
has 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
const req = xhr(xhrOptions, (err, res, body) => {
const statusCode = res ? res.statusCode : null;
if (req.aborted) {
const abortedAction = {
...actionDefaults,
Function default
has 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default function(resourceSlice, filter, options) {
if (process.env.NODE_ENV !== 'production') {
// We use duck typing to try and differentiate between a user passing the entire state tree
// in as `resourceSlice` (which was the original getResources API).
// eslint-disable-next-line no-inner-declarations
Function createActionCreators
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
const createActionCreators = (crudType, actionDefaults = {}) => {
const { resourceName, resourceType } = actionDefaults;
const typeToUse = resourceType || resourceName;
const uppercaseCrud =
typeof crudType === 'string' ? crudType.toUpperCase() : '';
Function getSingleStatus
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
function getSingleStatus(state, statusLocation, treatIdleAsPending) {
const splitPath = getPathParts(statusLocation);
let status;
let currentVal = state;
Function render
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
const { state } = this.props;
const searchStatus = getStatus(
state,
'books.requests.readUserBooks.status',
Function reset
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
function reset(resourceType, options = {}) {
return function(state, action) {
const typeToUse = action.resourceType || action.resourceName;
if (
action.type !== actionTypes.RESET_RESOURCE ||
Function getPathParts
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default function getPathParts(path) {
const parts = [];
let i = 0;
let nextDot, nextOpenBracket, openQuote, nextCloseBracket;