Showing 70 of 92 total issues
Function sum
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
export default function sum(object: Record<PropertyKey, TextNumber | boolean | Function>): number {
let result = 0
for (const key in object) {
let value = object[key]
if (value instanceof Function) {
- 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 readdirP
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
async function* readdirP(dir: string): AsyncGenerator<string> {
for (const entry of await fs.readdir(dir, { withFileTypes: true })) {
if (entry.isDirectory()) {
for await (const sub of readdirP(path.join(dir, entry.name))) {
yield sub
- 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
Consider simplifying this complex logical expression. Open
} else if (
isLastCharUpper &&
isLastLastCharUpper &&
/[A-Za-z]/.test(character) &&
character.toLowerCase() === character
Function pathToObject
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
paths: string = '',
value: any = null,
object: Record<PropertyKey, any> = {},
divider: string = '.',
replaceOnExist: boolean = true
Function number
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
value: TextNumber,
decimals: number = 2,
decPoint: string = '.',
thousandsSeparator: string = ',',
clearDecimals: boolean = false
Function main
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
async function main(): Promise<void> {
for await (const entry of readdirP(path.relative(process.cwd(), path.join(__dirname, '..', 'dist/esm')))) {
const match = /^(.*)(\.(js|js\.map|d\.ts))$/.exec(entry)
if (match == null) {
continue
- 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 preserveCamelCase
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
const preserveCamelCase = (value: string): string => {
let isLastCharLower = false
let isLastCharUpper = false
let isLastLastCharUpper = 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 trimAny
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
export function trimAny(str: string, chars: string | string[]) {
let start = 0,
end = str.length
const charsArray: string[] = typeof chars === 'string' ? [chars] : chars
- 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 false
Avoid too many return
statements within this function. Open
return false
Avoid too many return
statements within this function. Open
return objectsEqual(first, second)
Avoid too many return
statements within this function. Open
return ('' + first).valueOf() === ('' + second).valueOf()
Avoid too many return
statements within this function. Open
return true
Avoid too many return
statements within this function. Open
return false
Avoid too many return
statements within this function. Open
return false
Avoid too many return
statements within this function. Open
return false
Avoid too many return
statements within this function. Open
return false
Avoid too many return
statements within this function. Open
return values(value)
Avoid too many return
statements within this function. Open
return false
Avoid too many return
statements within this function. Open
return item