Showing 40 of 40 total issues
Function buildUpdateVariables
has a Cognitive Complexity of 44 (exceeds 5 allowed). Consider refactoring. Open
const buildUpdateVariables = (introspectionResults: IntrospectionResult) => (
resource: Resource,
aorFetchType: string,
params: UpdateParams,
fieldAliasResolver?: RAGqlPrismaFieldAliasResolver,
- 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 buildCreateVariables
has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring. Open
const buildCreateVariables = (introspectionResults: IntrospectionResult) => (
resource: Resource,
aorFetchType: string,
params: CreateParams,
fieldAliasResolver?: RAGqlPrismaFieldAliasResolver,
- 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 buildGetListVariables
has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring. Open
const buildGetListVariables = (introspectionResults: IntrospectionResult) => (
resource: Resource,
aorFetchType: string,
params: GetListParams,
) => {
- 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 sanitizeResource
has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring. Open
const sanitizeResource = (
introspectionResults: IntrospectionResult,
resource: Resource,
fieldAliasResolver?: RAGqlPrismaFieldAliasResolver,
) => (record: GqlRecord): any => {
- 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
File buildVariables.ts
has 454 lines of code (exceeds 400 allowed). Consider refactoring. Open
/* eslint-disable @typescript-eslint/camelcase */
import { IntrospectionField, IntrospectionInputObjectType, IntrospectionNamedTypeRef, IntrospectionObjectType } from 'graphql';
import get from 'lodash/get';
import isDate from 'lodash/isDate';
import isObject from 'lodash/isObject';
Function buildUpdateVariables
has 142 lines of code (exceeds 100 allowed). Consider refactoring. Open
const buildUpdateVariables = (introspectionResults: IntrospectionResult) => (
resource: Resource,
aorFetchType: string,
params: UpdateParams,
fieldAliasResolver?: RAGqlPrismaFieldAliasResolver,
Function buildFields
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
export const buildFields = (introspectionResults: IntrospectionResult) => (
fields: IntrospectionField[],
): FieldNode[] => {
return fields.reduce(
(acc: FieldNode[], field: IntrospectionField) => {
- 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 buildCreateVariables
has 105 lines of code (exceeds 100 allowed). Consider refactoring. Open
const buildCreateVariables = (introspectionResults: IntrospectionResult) => (
resource: Resource,
aorFetchType: string,
params: CreateParams,
fieldAliasResolver?: RAGqlPrismaFieldAliasResolver,
Avoid deeply nested control flow statements. Open
if (typeof nestedId === 'string') {
// XXX Handling a nested relationship field update. Must use connect on the updated id
return {
...subAcc,
[subFieldName]: { [PRISMA_CONNECT]: { id: nestedId } },
Function buildFieldsFromFragment
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
const buildFieldsFromFragment = (
fragment: DocumentNode | string,
resourceName: string,
fetchType: string,
): SelectionNode[] => {
- 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 { ...acc, [key]: params.filter[key] };
Avoid too many return
statements within this function. Open
return acc;
Avoid too many return
statements within this function. Open
return { ...acc, [key]: parseFloat(params.filter[key]) };
Avoid too many return
statements within this function. Open
return {
...acc,
where: {
id: value,
},
Avoid too many return
statements within this function. Open
return acc;
Avoid too many return
statements within this function. Open
return { ...acc, [key]: parseInt(params.filter[key]) };
Avoid too many return
statements within this function. Open
return {
...acc,
data: {
...acc.data,
[fieldName]: data,
Avoid too many return
statements within this function. Open
return {
...acc,
data: {
...acc.data,
[fieldName]: { [PRISMA_CONNECT]: { ...fieldsToConnect } },
Avoid too many return
statements within this function. Open
return {
...acc,
data: {
...acc.data,
[fieldName]: value,
Avoid too many return
statements within this function. Open
return {
...acc,
data: {
...acc.data,
[fieldName]: { [PRISMA_UPDATE]: { ...fieldsToUpdate } },