RubyLouvre/anu

View on GitHub
packages/render/dom/DOMRenderer.js

Summary

Maintainability
B
6 hrs
Test Coverage

Function createElement has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
Open

export function createElement(vnode) {
    let p = vnode.return;
    let { type, props, ns } = vnode;
    switch (type) {
        case '#text':
Severity: Minor
Found in packages/render/dom/DOMRenderer.js - About 3 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 createElement has 54 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export function createElement(vnode) {
    let p = vnode.return;
    let { type, props, ns } = vnode;
    switch (type) {
        case '#text':
Severity: Major
Found in packages/render/dom/DOMRenderer.js - About 2 hrs to fix

    Function unstable_renderSubtreeIntoContainer has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        unstable_renderSubtreeIntoContainer(instance, vnode, root, callback) {
            //看root上面有没有根虚拟DOM,没有就创建
            let container = createContainer(root),
                fiber = get(instance),
                backup;
    Severity: Minor
    Found in packages/render/dom/DOMRenderer.js - 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

    There are no issues that match your filters.

    Category
    Status