AlfonsoFilho/match-ish

View on GitHub

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 (
Severity: Minor
Found in src/ast-nodes/object.ts - About 5 hrs to fix

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 (
Severity: Major
Found in src/ast-nodes/object.ts - About 2 hrs to fix

    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') ||
    Severity: Minor
    Found in src/ast-nodes/list.ts - About 1 hr to fix

      Function apiFactory has 36 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function apiFactory() {
        let casesList = [];
        let elseFn = () => undefined;
        let catchFn = defaultCatchFn;
      
      
      Severity: Minor
      Found in src/api.ts - About 1 hr to fix

        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') ||
        Severity: Minor
        Found in src/ast-nodes/list.ts - About 1 hr to fix

        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) {
        Severity: Minor
        Found in src/api.ts - About 1 hr to fix

          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) {
          Severity: Minor
          Found in src/ast-nodes/sequence.ts - About 35 mins to fix

          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;
            }
          
          
          Severity: Minor
          Found in src/helpers.ts - About 25 mins to fix

          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

          Severity
          Category
          Status
          Source
          Language