adamgruber/mochawesome-report-generator

View on GitHub

Showing 14 of 22 total issues

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

  render() {
    const {
      suite,
      showPassed,
      showFailed,
Severity: Minor
Found in src/client/components/nav-menu/nav-menu-item.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 render has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
Open

  render() {
    const { test, enableCode } = this.props;
    const {
      uuid,
      title,
Severity: Minor
Found in src/client/components/test/test.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 render has 129 lines of code (exceeds 75 allowed). Consider refactoring.
Open

  render() {
    const { test, enableCode } = this.props;
    const {
      uuid,
      title,
Severity: Major
Found in src/client/components/test/test.js - About 3 hrs to fix

    Function render has 122 lines of code (exceeds 75 allowed). Consider refactoring.
    Open

      render() {
        const {
          results,
          closeSideNav,
          reportTitle,
    Severity: Major
    Found in src/client/components/nav-menu/nav-menu.js - About 2 hrs to fix

      Function render has 104 lines of code (exceeds 75 allowed). Consider refactoring.
      Open

        render() {
          const { className, suite, enableChart, enableCode } = this.props;
          const { expanded } = this.state;
          const {
            root,
      Severity: Major
      Found in src/client/components/suite/suite.js - About 2 hrs to fix

        Function render has 96 lines of code (exceeds 75 allowed). Consider refactoring.
        Open

          render() {
            const {
              suite,
              showPassed,
              showFailed,
        Severity: Major
        Found in src/client/components/nav-menu/nav-menu-item.js - About 1 hr to fix

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

            render() {
              const { className, suite, enableChart, enableCode } = this.props;
              const { expanded } = this.state;
              const {
                root,
          Severity: Minor
          Found in src/client/components/suite/suite.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 validateFile has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

          function validateFile(file) {
            let data;
            let err = null;
          
            // Try to read and parse the file
          Severity: Minor
          Found in src/bin/cli-main.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

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

            render() {
              const { className, code, lang, label, showLabel } = this.props;
              const isDiff = lang === 'diff';
              const isInlineDiff = isDiff && isArray(code);
              const shouldHighlight = this.shouldHighlight();
          Severity: Minor
          Found in src/client/components/test/code-snippet.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

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

          function _getUserOption(userOptions, optToGet, isBool) {
            const envVar = `MOCHAWESOME_${optToGet.toUpperCase()}`;
            if (userOptions && typeof userOptions[optToGet] !== 'undefined') {
              return isBool && typeof userOptions[optToGet] === 'string'
                ? userOptions[optToGet] === 'true'
          Severity: Minor
          Found in src/lib/options.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 getFilename has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

          function getFilename({ reportDir, reportFilename, timestamp }, reportData) {
            const DEFAULT_FILENAME = 'mochawesome';
            const NAME_REPLACE = '[name]';
            const STATUS_REPLACE = '[status]';
            const DATETIME_REPLACE = '[datetime]';
          Severity: Minor
          Found in src/lib/main.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 (
                  <CodeSnippet
                    className={cx('code-snippet')}
                    code={content}
                    highlight={false}
          Severity: Major
          Found in src/client/components/test/context.js - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                return (
                  <CodeSnippet
                    className={cx('code-snippet')}
                    code={code}
                    highlight={highlight}
            Severity: Major
            Found in src/client/components/test/context.js - About 30 mins to fix

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

                constructor(data = {}, config = {}) {
                  Object.assign(this, {
                    devMode: !!config.dev,
                    enableChart: !!config.enableCharts,
                    enableCode: !!config.enableCode,
              Severity: Minor
              Found in src/client/js/reportStore.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

              Severity
              Category
              Status
              Source
              Language