adamgruber/mochawesome-report-generator

View on GitHub

Showing 22 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

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

                  {!!skipped && (
                    <li className={cx('item', 'skipped')} title="Skipped">
                      <button
                        type="button"
                        onClick={() => onQuickFilterClick('showSkipped')}>
          Severity: Major
          Found in src/client/components/quick-summary/index.js and 1 other location - About 1 hr to fix
          src/client/components/quick-summary/index.js on lines 57..66

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 100.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

                  {!!pending && (
                    <li className={cx('item', 'pending')} title="Pending">
                      <button
                        type="button"
                        onClick={() => onQuickFilterClick('showPending')}>
          Severity: Major
          Found in src/client/components/quick-summary/index.js and 1 other location - About 1 hr to fix
          src/client/components/quick-summary/index.js on lines 67..76

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 100.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          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

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

                    <div className={cx('col', 'suites')} title="Suites">
                      <h1 className={cx('count')}>{suites}</h1>
                      <h4 className={cx('label')}>
                        {suites.length > 1 ? 'Suites' : 'Suite'}
                      </h4>
          Severity: Minor
          Found in src/client/components/summary/index.js and 1 other location - About 50 mins to fix
          src/client/components/summary/index.js on lines 35..40

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 97.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

                    <div className={cx('col', 'tests')} title="Tests">
                      <h1 className={cx('count')}>{testsRegistered}</h1>
                      <h4 className={cx('label')}>
                        {testsRegistered.length > 1 ? 'Tests' : 'Test'}
                      </h4>
          Severity: Minor
          Found in src/client/components/summary/index.js and 1 other location - About 50 mins to fix
          src/client/components/summary/index.js on lines 29..34

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 97.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          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

          Similar blocks of code found in 4 locations. Consider refactoring.
          Open

                      <ToggleSwitch
                        className={cx('control')}
                        label="Show Skipped"
                        labelClassName={cx('control-label')}
                        icon="stop"
          Severity: Major
          Found in src/client/components/nav-menu/nav-menu.js and 3 other locations - About 35 mins to fix
          src/client/components/nav-menu/nav-menu.js on lines 124..134
          src/client/components/nav-menu/nav-menu.js on lines 136..146
          src/client/components/nav-menu/nav-menu.js on lines 148..158

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 91.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 4 locations. Consider refactoring.
          Open

                      <ToggleSwitch
                        className={cx('control')}
                        label="Show Pending"
                        labelClassName={cx('control-label')}
                        icon="pause"
          Severity: Major
          Found in src/client/components/nav-menu/nav-menu.js and 3 other locations - About 35 mins to fix
          src/client/components/nav-menu/nav-menu.js on lines 124..134
          src/client/components/nav-menu/nav-menu.js on lines 136..146
          src/client/components/nav-menu/nav-menu.js on lines 160..170

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 91.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 4 locations. Consider refactoring.
          Open

                      <ToggleSwitch
                        className={cx('control')}
                        label="Show Failed"
                        labelClassName={cx('control-label')}
                        icon="close"
          Severity: Major
          Found in src/client/components/nav-menu/nav-menu.js and 3 other locations - About 35 mins to fix
          src/client/components/nav-menu/nav-menu.js on lines 124..134
          src/client/components/nav-menu/nav-menu.js on lines 148..158
          src/client/components/nav-menu/nav-menu.js on lines 160..170

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 91.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 4 locations. Consider refactoring.
          Open

                      <ToggleSwitch
                        className={cx('control')}
                        label="Show Passed"
                        labelClassName={cx('control-label')}
                        icon="check"
          Severity: Major
          Found in src/client/components/nav-menu/nav-menu.js and 3 other locations - About 35 mins to fix
          src/client/components/nav-menu/nav-menu.js on lines 136..146
          src/client/components/nav-menu/nav-menu.js on lines 148..158
          src/client/components/nav-menu/nav-menu.js on lines 160..170

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 91.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          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
            Severity
            Category
            Status
            Source
            Language