Showing 45 of 71 total issues
File sync.ts
has 495 lines of code (exceeds 250 allowed). Consider refactoring. Open
import pLimit from 'p-limit'
import ms from 'ms'
import type {
Action,
Payload,
Function getAll
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
export default async function getAll(
action: Action,
{ dispatch }: ActionHandlerResources
): Promise<Response> {
const { pageSize, noLoopCheck = false } = action.payload
- 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 createDispatch
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
export default function createDispatch({
handlers = {},
schemas = new Map(),
services = {},
middleware = [],
- 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 setMeta
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default async function setMeta(
action: Action,
resources: ActionHandlerResources
): Promise<Response> {
const {
Function setUpdatedDatesAndType
has 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
async function setUpdatedDatesAndType(params: Partial<ActionParams>) {
const {
retrieve,
updatedAfter,
updatedSince,
Function getMeta
has 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default async function getMeta(
action: Action,
resources: ActionHandlerResources
): Promise<Response> {
debug('Action: GET_META')
Function dispatch
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
pProgress(async (setProgress) => {
debug('Dispatch: %o', originalAction)
if (!originalAction) {
return {
status: 'noaction',
Function prepareValidator
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
export default function prepareValidator(
conditions: ValidateObject[] | undefined,
mapOptions: MapOptions,
defaultErrorStatus = 'badrequest',
breakByDefault = 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"
Further reading
Function authorizeDataBase
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
const authorizeDataBase = (
schemas: Map<string, Schema>,
isToService: boolean,
) =>
function authorizeData(action: Action, allowRaw = false): Action {
- 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 authorizeData
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
function authorizeData(action: Action, allowRaw = false): Action {
if (isRootIdent(action.meta?.ident)) {
return action
}
Function mutateIncomingAction
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
async function mutateIncomingAction(action: Action, getService: GetService) {
const { sourceService } = action.payload
if (typeof sourceService !== 'string') {
return { action }
}
Function authorizeItem
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
(
schemas: Map<string, Schema>,
actionType: string,
allowRaw: boolean,
ident?: Ident,
- 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 setData
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
async function setData(
dispatch: HandlerDispatch,
data: TypedData[],
{ alwaysSet = false, maxPerSet, setMember, ...params }: ActionParams,
doQueueSet: boolean,
- 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 authorizeAction
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
function authorizeAction(action: Action): Action {
const {
payload: { type },
response: { status } = {},
meta: { ident } = {},
Function getIdent
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default async function getIdent(
action: Action,
resources: ActionHandlerResources,
): Promise<Response> {
const { ident } = action.meta || {}
Function prepareValidator
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default function prepareValidator(
conditions: ValidateObject[] | undefined,
mapOptions: MapOptions,
defaultErrorStatus = 'badrequest',
breakByDefault = false,
Function generateErrorAndReason
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
const generateErrorAndReason = (
reason: string,
data: unknown,
isToService: boolean,
service?: 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 syncHandler
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
export default async function syncHandler(
inputAction: Action,
{ dispatch, setProgress }: ActionHandlerResources,
): Promise<Response> {
setProgress(0)
- 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 getDates
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
function getDates(
shouldHaveCreatedAt: boolean,
shouldHaveUpdatedAt: boolean,
createdAt: unknown,
updatedAt: unknown,
- 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 mergeOptions
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function mergeOptions(a: PreparedOptions, b: PreparedOptions) {
const transporterOptions = deepClone({
...removeIncoming(a.transporter),
...removeIncoming(b.transporter),
})