cyclejs/cycle-core

View on GitHub
dom/src/hyperscript-helpers.ts

Summary

Maintainability
C
1 day
Test Coverage

File hyperscript-helpers.ts has 434 lines of code (exceeds 250 allowed). Consider refactoring.
Open

// tslint:disable:max-file-line-count
import {h, VNode, VNodeData} from 'snabbdom';

function isValidString(param: any): boolean {
  return typeof param === 'string' && param.length > 0;
Severity: Minor
Found in dom/src/hyperscript-helpers.ts - About 6 hrs to fix

    Function createTagFunction has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

    function createTagFunction(tagName: string): Function {
      return function hyperscript(a: any, b?: any, c?: any): VNode {
        const hasA = typeof a !== 'undefined';
        const hasB = typeof b !== 'undefined';
        const hasC = typeof c !== 'undefined';
    Severity: Minor
    Found in dom/src/hyperscript-helpers.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

    Avoid too many return statements within this function.
    Open

          return h(tagName, a);
    Severity: Major
    Found in dom/src/hyperscript-helpers.ts - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

            return h(tagName, a, b);
      Severity: Major
      Found in dom/src/hyperscript-helpers.ts - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

              return h(tagName, {});
        Severity: Major
        Found in dom/src/hyperscript-helpers.ts - About 30 mins to fix

          There are no issues that match your filters.

          Category
          Status