cucumber/cucumber-js

View on GitHub

Showing 231 of 231 total issues

Identical blocks of code found in 3 locations. Consider refactoring.
Open

        this.testCase.steps[1] = {
          actionLocation: { line: 3, uri: 'steps.js' },
          sourceLocation: { line: 4, uri: 'a.feature' },
          result: { status: Status.PENDING },
        }
Severity: Major
Found in src/formatter/helpers/issue_helpers_spec.js and 2 other locations - About 1 hr to fix
src/formatter/helpers/issue_helpers_spec.js on lines 171..175
src/formatter/helpers/issue_helpers_spec.js on lines 213..217

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 67.

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

    this.beforeHookDefinitions.forEach(definition => {
      const actionLocation = { uri: definition.uri, line: definition.line }
      steps.push({ actionLocation })
    })
Severity: Major
Found in src/runtime/test_case_runner.js and 1 other location - About 1 hr to fix
src/runtime/test_case_runner.js on lines 85..88

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 66.

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

    this.afterHookDefinitions.forEach(definition => {
      const actionLocation = { uri: definition.uri, line: definition.line }
      steps.push({ actionLocation })
    })
Severity: Major
Found in src/runtime/test_case_runner.js and 1 other location - About 1 hr to fix
src/runtime/test_case_runner.js on lines 66..69

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 66.

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

    describe('raw', () => {
      it('returns a 2-D array', function() {
        expect(this.dataTable.raw()).to.eql([
          ['row 1 col 1', 'row 1 col 2'],
          ['row 2 col 1', 'row 2 col 2'],
Severity: Major
Found in src/models/data_table_spec.js and 1 other location - About 1 hr to fix
src/models/data_table_spec.js on lines 23..30

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 65.

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

    describe('rows', () => {
      it('returns a 2-D array without the header', function() {
        expect(this.dataTable.rows()).to.eql([
          ['row 1 col 1', 'row 1 col 2'],
          ['row 2 col 1', 'row 2 col 2'],
Severity: Major
Found in src/models/data_table_spec.js and 1 other location - About 1 hr to fix
src/models/data_table_spec.js on lines 56..63

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 65.

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 constructor has 36 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  constructor({
    eventBroadcaster,
    skip,
    testCase,
    supportCodeLibrary,
Severity: Minor
Found in src/runtime/test_case_runner.js - About 1 hr to fix

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

      getStepData({
        isBeforeHook,
        stepLineToKeywordMap,
        stepLineToPickledStepMap,
        testStep,
    Severity: Minor
    Found in src/formatter/json_formatter.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 getStepData has 34 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      getStepData({
        isBeforeHook,
        stepLineToKeywordMap,
        stepLineToPickledStepMap,
        testStep,
    Severity: Minor
    Found in src/formatter/json_formatter.js - About 1 hr to fix

      Function getAmbiguousStepException has 34 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export function getAmbiguousStepException(stepDefinitions) {
        const table = new Table({
          chars: {
            bottom: '',
            'bottom-left': '',
      Severity: Minor
      Found in src/runtime/helpers.js - About 1 hr to fix

        Function runFeature has 34 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function runFeature() {
          $output.empty()
          $('a[href="#output-tab"]').tab('show')
        
          const eventBroadcaster = new EventEmitter()
        Severity: Minor
        Found in example/index.js - About 1 hr to fix

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

            shouldCauseFailure(status) {
              return (
                _.includes([Status.AMBIGUOUS, Status.FAILED, Status.UNDEFINED], status) ||
                (status === Status.PENDING && this.options.strict)
              )
          Severity: Major
          Found in src/runtime/index.js and 1 other location - About 1 hr to fix
          src/runtime/parallel/master.js on lines 126..131

          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 61.

          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

            shouldCauseFailure(status) {
              return (
                _.includes([Status.AMBIGUOUS, Status.FAILED, Status.UNDEFINED], status) ||
                (status === Status.PENDING && this.options.strict)
              )
          Severity: Major
          Found in src/runtime/parallel/master.js and 1 other location - About 1 hr to fix
          src/runtime/index.js on lines 78..83

          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 61.

          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 build has 32 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            build({ comment, generatedExpressions, functionName, stepParameterNames }) {
              let functionKeyword = 'function '
              if (this.snippetInterface === 'async-await') {
                functionKeyword = 'async ' + functionKeyword
              } else if (this.snippetInterface === 'generator') {

            Function formatStep has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
            Open

            function formatStep({
              colorFns,
              isBeforeHook,
              keyword,
              keywordType,
            Severity: Minor
            Found in src/formatter/helpers/issue_helpers.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

                      it('outputs the step definition without durations', function() {
                        expect(this.output).to.eql(
                          '┌────────────────┬──────────┬─────────────┐\n' +
                            '│ Pattern / Text │ Duration │ Location    │\n' +
                            '├────────────────┼──────────┼─────────────┤\n' +
            Severity: Major
            Found in src/formatter/usage_formatter_spec.js and 1 other location - About 1 hr to fix
            src/formatter/usage_formatter_spec.js on lines 138..148

            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 60.

            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

                      it('outputs the step definition with durations in desending order', function() {
                        expect(this.output).to.eql(
                          '┌────────────────┬──────────┬─────────────┐\n' +
                            '│ Pattern / Text │ Duration │ Location    │\n' +
                            '├────────────────┼──────────┼─────────────┤\n' +
            Severity: Major
            Found in src/formatter/usage_formatter_spec.js and 1 other location - About 1 hr to fix
            src/formatter/usage_formatter_spec.js on lines 110..120

            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 60.

            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 formatDataTable has 31 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function formatDataTable(arg) {
              const rows = arg.rows.map(row =>
                row.cells.map(cell =>
                  cell.value.replace(/\\/g, '\\\\').replace(/\n/g, '\\n')
                )
            Severity: Minor
            Found in src/formatter/helpers/issue_helpers.js - About 1 hr to fix

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

                      this.eventBroadcaster.emit('test-step-finished', {
                        index: 0,
                        testCase: this.testCase,
                        result: {
                          exception:
              Severity: Major
              Found in src/formatter/summary_formatter_spec.js and 1 other location - About 1 hr to fix
              src/formatter/progress_bar_formatter_spec.js on lines 133..143

              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 59.

              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

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

                      this.eventBroadcaster.emit('test-step-finished', {
                        index: 0,
                        testCase: this.testCase,
                        result: {
                          exception:
              Severity: Major
              Found in src/formatter/progress_bar_formatter_spec.js and 1 other location - About 1 hr to fix
              src/formatter/summary_formatter_spec.js on lines 97..107

              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 59.

              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 features has 29 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  const features = _.map(groupedTestCases, (group, uri) => {
                    const gherkinDocument = this.eventDataCollector.gherkinDocumentMap[uri]
                    const featureData = this.getFeatureData(gherkinDocument.feature, uri)
                    const stepLineToKeywordMap = getStepLineToKeywordMap(gherkinDocument)
                    const scenarioLineToDescriptionMap = getScenarioLineToDescriptionMap(
              Severity: Minor
              Found in src/formatter/json_formatter.js - About 1 hr to fix
                Severity
                Category
                Status
                Source
                Language