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 = {
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')
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 = {
- 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 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)) {
- 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 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)) {
Function select
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
function select(matchesSelector) {
return function matches(node) {
if (!node) {
return []
}
Function matches
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
return function matches(node) {
if (!node) {
return []
}
if (isArray(node)) {
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
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)) {
Function getContent
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
function getContent(thing) {
if (!thing) {
return ''
}
if (isString(thing)) {
- 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 ''
Avoid too many return
statements within this function. Open
return thing.map(getContent).join('')