Showing 7 of 7 total issues
Function _patch
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
export const _patch = (
lockfile: TLockfileObject,
report: TAuditReport,
{ flags, bins }: TContext,
lockfileType: TLockfileType,
- 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 audit
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const audit = (
flags: TFlags,
temp: string,
bins: Record<string, string>,
): TAuditReport => {
Function format
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const format = (lockfile: TLockfileObject): string => {
const keymap = Object.entries(lockfile).reduce<Record<string, any>>(
(m, [k, { resolution }]) => {
const entry = m[resolution] || (m[resolution] = [])
entry.push(k)
Function formatFlags
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
export const formatFlags = (flags: TFlags, ...picklist: string[]): string[] =>
Object.keys(flags).reduce<string[]>((memo, key: string) => {
const omitlist = ['_', '--']
const value = flags[key]
const flag = formatFlag(key)
- 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 audit
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const audit = (
flags: TFlags,
temp: string,
bins: Record<string, string>,
): TAuditReport => {
Function printRuntimeDigest
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
export const printRuntimeDigest: TCallback = ({
temp,
cwd,
flags,
bins,
- 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 mapFlags
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
export const mapFlags = (flags: TFlags, mapping: TFlagsMapping): TFlags =>
reduce(
flags,
(memo: TFlags, value: any, key: string) => {
const repl = mapping[key]
- 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"