Showing 8 of 11 total issues
Function parseJsonApiSimpleResourceData
has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring. Open
function parseJsonApiSimpleResourceData<TEntity, TExtraOptions>(
data: ResourceObject,
included: ExistingResourceObject[],
options: Options<TExtraOptions>,
useCache: 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 parseJsonApiSimpleResourceData
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
function parseJsonApiSimpleResourceData<TEntity, TExtraOptions>(
data: ResourceObject,
included: ExistingResourceObject[],
options: Options<TExtraOptions>,
useCache: boolean,
Function serializeEntity
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
function serializeEntity<TEntity, TExtraOptions>(
entity: TEntity,
transformer: Transformer<TEntity, TExtraOptions>,
included: boolean,
options: Options<TExtraOptions>,
Function serializeEntity
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
function serializeEntity<TEntity, TExtraOptions>(
entity: TEntity,
transformer: Transformer<TEntity, TExtraOptions>,
included: boolean,
options: Options<TExtraOptions>,
- 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 changeCase
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
export function changeCase(originalAttributes: AttributesObject, caseType: CaseType, deep = false): AttributesObject {
const caseFunction = caseTypes[caseType]
if (!caseFunction) {
throw new Error('Invalid case type: ' + caseType)
- 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 serializeRelation
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
function serializeRelation<TEntity = unknown, TExtraOptions = unknown>(
context: Context<TEntity, TExtraOptions>,
includedByType: IncludedRecord,
): ResourceIdentifierObject | undefined {
const { input: entity, options, transformer, included } = context
- 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 serializeEntity
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
entity: TEntity,
transformer: Transformer<TEntity, TExtraOptions>,
included: boolean,
options: Options<TExtraOptions>,
includedByType: IncludedRecord,
Function serializeContext
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
function serializeContext<TEntity, TExtraOptions = unknown>(context: Context<TEntity, TExtraOptions>): DocumentObject {
if (!context.input) {
// eslint-disable-next-line unicorn/no-null
return { data: null }
}
- 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"