Showing 130 of 215 total issues
Function failResult
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
failResult(condition: Code, successAction?: () => void, failAction?: () => void): void {
this.gen.if(condition)
if (failAction) failAction()
else this.error()
if (successAction) {
- 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 value
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
value(nameOrPrefix: ValueScopeName | string, value: NameValue): ValueScopeName {
if (value.ref === undefined) throw new Error("CodeGen: ref must be passed in value")
const name = this.toName(nameOrPrefix) as ValueScopeName
const {prefix} = name
const valueKey = value.key ?? value.ref
- 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 validatePropertyDeps
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
export function validatePropertyDeps(
cxt: KeywordCxt,
propertyDeps: {[K in string]?: string[]} = cxt.schema
): void {
const {gen, data, it} = cxt
- 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 validateTuple
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
export function validateTuple(
cxt: KeywordCxt,
extraItems: string,
schArr: AnySchema[] = cxt.schema
): void {
- 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 code
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
code(cxt: KeywordCxt) {
const {gen, parentSchema, it} = cxt
if (parentSchema.then === undefined && parentSchema.else === undefined) {
checkStrictMode(it, '"if" without "then" and "else" is ignored')
}
- 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 constructor
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
constructor(it: SchemaObjCxt, def: AddedKeywordDefinition, keyword: string) {
validateKeywordUsage(it, def, keyword)
this.gen = it.gen
this.allErrors = it.allErrors
this.keyword = keyword
- 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 ucs2length
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
export default function ucs2length(str: string): number {
const len = str.length
let length = 0
let pos = 0
let value: number
- 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 getJsonPointer.call(this, p, schOrRef)
Avoid too many return
statements within this function. Open
return
Avoid too many return
statements within this function. Open
return
Avoid too many return
statements within this function. Open
return str
Avoid too many return
statements within this function. Open
return undefined
Avoid too many return
statements within this function. Open
return +numStr
Avoid too many return
statements within this function. Open
if (typeof b == "string" && b[0] === '"' && !(a instanceof Name)) return `"${a}${b.slice(1)}`
Avoid too many return
statements within this function. Open
return
Avoid too many return
statements within this function. Open
return undefined
Avoid too many return
statements within this function. Open
if (cond === false || !this.nodes.length) return undefined
Avoid too many return
statements within this function. Open
return this
Avoid too many return
statements within this function. Open
return new SchemaEnv({schema, schemaId, root, baseId})
Avoid too many return
statements within this function. Open
if (b[0] === '"') return a.slice(0, -1) + b.slice(1)