Showing 128 of 341 total issues

Avoid too many return statements within this function.
Open

  return newVNode
Severity: Major
Found in packages/nerv/src/clone-element.ts - About 30 mins to fix

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

    function setStyle (domStyle, style, value) {
      if (isNullOrUndef(value) || (isNumber(value) && isNaN(value))) {
        domStyle[style] = ''
        return
      }
    Severity: Minor
    Found in packages/nerv/src/vdom/patch.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

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

    export function render (
      vnode: VirtualNode,
      container: Element,
      callback?: Function
    ) {
    Severity: Minor
    Found in packages/nerv/src/render.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

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

    export default function createClass<P, S> (
      obj: ComponentSpec<P, S>
    ): ClassicComponentClass<P, S> {
      class BoundClass extends Component<P, S> {
        static defaultProps
    Severity: Minor
    Found in packages/nerv-create-class/src/index.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

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

    export function ensureVirtualNode (rendered: any): VText | VVoid | VNode {
      if (isNumber(rendered) || isString(rendered)) {
        return createVText(rendered)
      } else if (isInvalid(rendered)) {
        return createVoid()
    Severity: Minor
    Found in packages/nerv/src/lifecycle.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

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

      handleCommitFiberRoot (vnode) {
        const inst = getInstance(vnode)
    
        if (this.instMap.has(inst)) {
          this.update(vnode)
    Severity: Minor
    Found in packages/nerv-devtools/src/renderer.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

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

      forEach (
        children: Array<VirtualChildren | any>,
        fn: IterateFn,
        ctx: any
      ): void {
    Severity: Minor
    Found in packages/nerv/src/children.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

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

    function attachEventToDocument (d, eventName, delegatedRoots) {
      const eventHandler = (event) => {
        const items = delegatedRoots.items
        const count = items.size
        if (count > 0) {
    Severity: Minor
    Found in packages/nerv/src/event.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