RubyLouvre/anu

View on GitHub
packages/render/server/Renderer.js

Summary

Maintainability
F
6 days
Test Coverage

Function resolve has a Cognitive Complexity of 80 (exceeds 5 allowed). Consider refactoring.
Open

function resolve(child, context) {
    while (isValidElement(child)) {
        // Safe because we just checked it's an element.
        let element = child;
        let Component = element.type;
Severity: Minor
Found in packages/render/server/Renderer.js - About 1 day 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

File Renderer.js has 464 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/**
 * Copyright (c) 2013-present, Facebook, Inc.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
Severity: Minor
Found in packages/render/server/Renderer.js - About 7 hrs to fix

    Function render has 141 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        render(child, context, parentNamespace) {
            var t  = typeNumber(child)
            if (t === 3 || t === 4) {
                const text = '' + child;
                if (text === '') {
    Severity: Major
    Found in packages/render/server/Renderer.js - About 5 hrs to fix

      Function resolve has 107 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function resolve(child, context) {
          while (isValidElement(child)) {
              // Safe because we just checked it's an element.
              let element = child;
              let Component = element.type;
      Severity: Major
      Found in packages/render/server/Renderer.js - About 4 hrs to fix

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

            render(child, context, parentNamespace) {
                var t  = typeNumber(child)
                if (t === 3 || t === 4) {
                    const text = '' + child;
                    if (text === '') {
        Severity: Minor
        Found in packages/render/server/Renderer.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 processChild has 93 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            function processChild(element, Component) {
                let publicContext = processContext(Component, context);
        
                let queue = [];
                let replace = false;
        Severity: Major
        Found in packages/render/server/Renderer.js - About 3 hrs to fix

          Function renderDOM has 46 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              renderDOM(element, context, parentNamespace) {
                  const tag = element.type.toLowerCase();
          
                  let namespace = parentNamespace;
                  if (parentNamespace === Namespaces.html) {
          Severity: Minor
          Found in packages/render/server/Renderer.js - About 1 hr to fix

            Function read has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
            Open

                read(bytes) {
                    if (this.exhausted) {
                        return null;
                    }
            
            
            Severity: Minor
            Found in packages/render/server/Renderer.js - 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

            Function read has 33 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                read(bytes) {
                    if (this.exhausted) {
                        return null;
                    }
            
            
            Severity: Minor
            Found in packages/render/server/Renderer.js - About 1 hr to fix

              Function renderDOM has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Open

                  renderDOM(element, context, parentNamespace) {
                      const tag = element.type.toLowerCase();
              
                      let namespace = parentNamespace;
                      if (parentNamespace === Namespaces.html) {
              Severity: Minor
              Found in packages/render/server/Renderer.js - About 55 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 deeply nested control flow statements.
              Open

                                      if (partialState != null) {
                                          if (dontMutate) {
                                              dontMutate = false;
                                              nextState = Object.assign({}, nextState, partialState);
                                          } else {
              Severity: Major
              Found in packages/render/server/Renderer.js - About 45 mins to fix

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

                function getNonChildrenInnerMarkup(props) {
                    const innerHTML = props.dangerouslySetInnerHTML;
                    if (innerHTML != null) {
                        if (innerHTML.__html != null) {
                            return innerHTML.__html;
                Severity: Minor
                Found in packages/render/server/Renderer.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 packages/render/server/Renderer.js - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                                  return '';
                  Severity: Major
                  Found in packages/render/server/Renderer.js - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                                    return '';
                    Severity: Major
                    Found in packages/render/server/Renderer.js - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                                              return '';
                      Severity: Major
                      Found in packages/render/server/Renderer.js - About 30 mins to fix

                        Avoid too many return statements within this function.
                        Open

                                                    return '';
                        Severity: Major
                        Found in packages/render/server/Renderer.js - About 30 mins to fix

                          Avoid too many return statements within this function.
                          Open

                                          return this.renderDOM(nextElement, context, parentNamespace);
                          Severity: Major
                          Found in packages/render/server/Renderer.js - About 30 mins to fix

                            Avoid too many return statements within this function.
                            Open

                                                        return '';
                            Severity: Major
                            Found in packages/render/server/Renderer.js - About 30 mins to fix

                              There are no issues that match your filters.

                              Category
                              Status