Showing 12 of 14 total issues
Function uriPart
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
const uriPart: Transformer = () => () => (value, state) =>
mapAny(function (value) {
if (value === null || value === undefined) {
return undefined
}
- 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 truncate
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
const truncate = (length?: number, postfix?: string) => {
if (typeof length === 'number') {
// Return truncate function if there is a specified length ...
const postfixLength = typeof postfix === 'string' ? postfix.length : 0
const cutLength = postfixLength < length ? length - postfixLength : length
- 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 castDate
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
export function castDate(
value: unknown,
zone?: string,
format?: string,
isSeconds = 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 prepareSize
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
const transformer: Transformer = function prepareSize() {
return () =>
function size(data) {
return isNumber(data)
? String(data).length
- 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 format
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
function format(props: Props) {
const { format: formatStr, path, ...modifiers } = props
const isSeconds = props.isSeconds === true // Make sure this is true and not just truthy
const setPath = typeof path === 'string' ? `>${path}` : undefined
const pathSetter = getPathOrData(setPath) // Works as a setter due to the `>`
- 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 castNumber
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
export const castNumber = (precision?: number) => {
const precisionProduct =
typeof precision === 'number' ? Math.pow(10, precision) : undefined
return function castNumber(value: unknown) {
- 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 modifyDate
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
date: DateTime,
add?: PeriodObject,
subtract?: PeriodObject,
set?: PeriodObject,
data?: unknown,
Function round
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
const transformer: Transformer = function round({
precision,
roundTowardsInfinity = false,
}: Props) {
const roundFn =
- 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 await pathSetter(dateTime.toSeconds())
Avoid too many return
statements within this function. Open
return undefined
Avoid too many return
statements within this function. Open
return numberOrUndefined(value.getTime())
Function replace
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
(from: string, to: string) =>
(rev = false) =>
function replace(data: unknown) {
if (typeof data !== 'string') {
return data
- 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"