gabrielbull/react-router-server

View on GitHub

Showing 15 of 29 total issues

Function renderPass has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
Open

const renderPass = (context, element, staticMarkup = false) => {
  context.callback = () => {
    if (context.finishedLoadingModules && !context.statesRenderPass) {
      context.statesRenderPass = true;
      context.renderResult = renderPass(context, element, staticMarkup);
Severity: Minor
Found in src/renderer/renderPass.js - About 5 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 fetchState has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
Open

const fetchState = (mapStateToProps, mapActionsToProps) => WrappedComponent => {
  return class extends Component {
    static contextTypes = {
      reactRouterServerAsyncRenderer: () => null,
      reactRouterServerServerState: () => null,
Severity: Minor
Found in src/components/fetchState.jsx - 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 fetchState has 68 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const fetchState = (mapStateToProps, mapActionsToProps) => WrappedComponent => {
  return class extends Component {
    static contextTypes = {
      reactRouterServerAsyncRenderer: () => null,
      reactRouterServerServerState: () => null,
Severity: Major
Found in src/components/fetchState.jsx - About 2 hrs to fix

    Function componentWillMount has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

      componentWillMount() {
        const { reactRouterServerAsyncRenderer } = this.context;
        this._componentIsMounted = true;
    
        if (isNode()) {
    Severity: Minor
    Found in src/components/Module.jsx - About 2 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 renderPass has 45 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    const renderPass = (context, element, staticMarkup = false) => {
      context.callback = () => {
        if (context.finishedLoadingModules && !context.statesRenderPass) {
          context.statesRenderPass = true;
          context.renderResult = renderPass(context, element, staticMarkup);
    Severity: Minor
    Found in src/renderer/renderPass.js - About 1 hr to fix

      Function fetchModuleInformation has 35 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      const fetchModuleInformation = modules => {
        return new Promise((resolve) => {
          const prevWebpackJsonp = webpackJsonp;
          const finalModules = {};
          let fileLoading = 0;
      Severity: Minor
      Found in src/module/preload.js - About 1 hr to fix

        Consider simplifying this complex logical expression.
        Open

          if (
            (typeof stats === 'undefined' || !stats) ||
            (!stats.modules || Object.prototype.toString.call(stats.modules) !== '[object Array]') ||
            (!stats.chunks || Object.prototype.toString.call(stats.chunks) !== '[object Array]') ||
            (!stats.entrypoints || typeof stats.entrypoints !== 'object')
        Severity: Critical
        Found in src/utils/validateStats.js - About 1 hr to fix

          Function componentWillMount has 30 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            componentWillMount() {
              const { reactRouterServerAsyncRenderer } = this.context;
              this._componentIsMounted = true;
          
              if (isNode()) {
          Severity: Minor
          Found in src/components/Module.jsx - About 1 hr to fix

            Function extractModule has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

            function extractModule(module, stats) {
              if (module.info.type === 'webpack') {
                const match = findModule(module, stats.chunks);
                return match ? parseWebpack(match, stats.publicPath || '') : match;
              } else if (module.info.type === 'systemImportTransformer') {
            Severity: Minor
            Found in src/stats/extractModules.js - About 45 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 findModule has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

            function findModule(module, chunks) {
              const match = chunks.find(chunk => module.info.id == chunk.id);
              if (match) return match;
              for (let i = 0, len = chunks.length; i < len; ++i) {
                if (chunks[i].modules) {
            Severity: Minor
            Found in src/stats/extractModules.js - About 45 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 getWebpackId has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

            export const getWebpackId = loadFunc => {
              let matches = loadFunc.match(/\/\* System\.import \*\/\(([^\)]*)\)/);
              if (typeof matches === 'object' && matches !== null && typeof matches[1] !== 'undefined') {
                return matches[1];
              }
            Severity: Minor
            Found in src/module/info.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 matches[1];
            Severity: Major
            Found in src/module/info.js - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                return null;
              Severity: Major
              Found in src/module/info.js - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                    return matches[1];
                Severity: Major
                Found in src/module/info.js - About 30 mins to fix

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

                    constructor(props) {
                      super();
                      if (props.context.fetchStateResults) {
                        this.fetchStateResults = { ...props.context.fetchStateResults };
                        for (let prop in this.fetchStateResults) {
                  Severity: Minor
                  Found in src/components/AsyncRenderer.jsx - 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