Showing 8 of 8 total issues
Function object
has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring. Open
export const object = (input: { [key: string]: any }, node: AstNode, interpreter): MatchResult => {
const restNode: AstNode = getRest(node.value) as AstNode;
// tslint:disable-next-line:max-line-length
if (
- 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 object
has 74 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const object = (input: { [key: string]: any }, node: AstNode, interpreter): MatchResult => {
const restNode: AstNode = getRest(node.value) as AstNode;
// tslint:disable-next-line:max-line-length
if (
Function list
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const list = (input: any[], node: AstNode, interpreter): MatchResult => {
const restNode = getRest(node.value);
if (
!is(input, 'Array') ||
Function apiFactory
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
function apiFactory() {
let casesList = [];
let elseFn = () => undefined;
let catchFn = defaultCatchFn;
Function list
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
export const list = (input: any[], node: AstNode, interpreter): MatchResult => {
const restNode = getRest(node.value);
if (
!is(input, 'Array') ||
- 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 makeMatchFunc
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
function makeMatchFunc(casesList: any[], elseFn, catchFn) {
return (...values) => {
const { matchedFn, matchedArgs } = casesList.reduce(
(state, { pattern, predicate, guard = defaultGuardFn }) => {
if (state.done) {
Function sequence
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
export const sequence = (input: any[], node: AstNode, interpreter): MatchResult => {
let currentIndex = 0;
const result = node.value.map((it: AstNode) => {
if (it.type === AstType.SEQUENCE) {
- 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 isType
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export const isType = (value: any, { typeOf }: any) => {
if (typeof typeOf === 'undefined' || typeOf === null) {
return true;
}
- 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"