catarse/catarse.js

View on GitHub
legacy/spec/lib/mithril-query/mithril-query.js

Summary

Maintainability
F
4 days
Test Coverage

Function scan has 204 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function scan(render) {
  const states = {}
  const onremovers = []
  const renderNode = renderComponents(states, onremovers)
  const api = {
Severity: Major
Found in legacy/spec/lib/mithril-query/mithril-query.js - About 1 day to fix

    File mithril-query.js has 395 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    'use strict'
    
    const m = require('mithril/render/hyperscript')
    const cssauron = require('cssauron')
    const code = require('yields-keycode')
    Severity: Minor
    Found in legacy/spec/lib/mithril-query/mithril-query.js - About 5 hrs to fix

      Function scan has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
      Open

      function scan(render) {
        const states = {}
        const onremovers = []
        const renderNode = renderComponents(states, onremovers)
        const api = {
      Severity: Minor
      Found in legacy/spec/lib/mithril-query/mithril-query.js - About 4 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 renderComponents has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
      Open

      function renderComponents(states, onremovers) {
        function renderComponent(component, treePath) {
          if (isFunction(component.tag)) {
            component.instance = component.tag(component)
          } else if (isClass(component.tag)) {
      Severity: Minor
      Found in legacy/spec/lib/mithril-query/mithril-query.js - About 4 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 renderComponents has 60 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function renderComponents(states, onremovers) {
        function renderComponent(component, treePath) {
          if (isFunction(component.tag)) {
            component.instance = component.tag(component)
          } else if (isClass(component.tag)) {
      Severity: Major
      Found in legacy/spec/lib/mithril-query/mithril-query.js - About 2 hrs to fix

        Function select has 38 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          function select(matchesSelector) {
            return function matches(node) {
              if (!node) {
                return []
              }
        Severity: Minor
        Found in legacy/spec/lib/mithril-query/mithril-query.js - About 1 hr to fix

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

              return function matches(node) {
                if (!node) {
                  return []
                }
                if (isArray(node)) {
          Severity: Minor
          Found in legacy/spec/lib/mithril-query/mithril-query.js - About 1 hr to fix

            Function renderComponent has 29 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              function renderComponent(component, treePath) {
                if (isFunction(component.tag)) {
                  component.instance = component.tag(component)
                } else if (isClass(component.tag)) {
                  const Component = component.tag
            Severity: Minor
            Found in legacy/spec/lib/mithril-query/mithril-query.js - About 1 hr to fix

              Function renderNode has 27 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                return function renderNode(parent, node, treePath) {
                  if (!node) {
                    return ''
                  }
                  if (isArray(node)) {
              Severity: Minor
              Found in legacy/spec/lib/mithril-query/mithril-query.js - About 1 hr to fix

                Function getContent has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                function getContent(thing) {
                  if (!thing) {
                    return ''
                  }
                  if (isString(thing)) {
                Severity: Minor
                Found in legacy/spec/lib/mithril-query/mithril-query.js - 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

                Avoid too many return statements within this function.
                Open

                  return ''
                Severity: Major
                Found in legacy/spec/lib/mithril-query/mithril-query.js - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                      return thing.map(getContent).join('')
                  Severity: Major
                  Found in legacy/spec/lib/mithril-query/mithril-query.js - About 30 mins to fix

                    There are no issues that match your filters.

                    Category
                    Status