cucumber/cucumber-js

View on GitHub

Showing 26 of 225 total issues

File test_case_runner_spec.js has 561 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import { afterEach, beforeEach, describe, it } from 'mocha'
import { expect } from 'chai'
import sinon from 'sinon'
import TestCaseHookDefinition from '../models/test_case_hook_definition'
import TestCaseRunner from './test_case_runner'
Severity: Major
Found in src/runtime/test_case_runner_spec.js - About 1 day to fix

    File json_formatter_spec.js has 356 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import { beforeEach, describe, it } from 'mocha'
    import { expect } from 'chai'
    import JsonFormatter from './json_formatter'
    import Status from '../status'
    import EventEmitter from 'events'
    Severity: Minor
    Found in src/formatter/json_formatter_spec.js - About 4 hrs to fix

      File pickle_filter_spec.js has 316 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      import { beforeEach, describe, it } from 'mocha'
      import { expect } from 'chai'
      import PickleFilter from './pickle_filter'
      
      describe('PickleFilter', () => {
      Severity: Minor
      Found in src/pickle_filter_spec.js - About 3 hrs to fix

        Function parse has 88 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          static parse(argv) {
            const program = new Command(path.basename(argv[1]))
        
            program
              .usage('[options] [<GLOB|DIR|FILE[:LINE]>...]')
        Severity: Major
        Found in src/cli/argv_parser.js - About 3 hrs to fix

          File progress_bar_formatter_spec.js has 292 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          import { beforeEach, describe, it } from 'mocha'
          import { expect } from 'chai'
          import { createMock } from './test_helpers'
          import sinon from 'sinon'
          import getColorFns from './get_color_fns'
          Severity: Minor
          Found in src/formatter/progress_bar_formatter_spec.js - About 3 hrs to fix

            Function run has 65 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              static async run({ argsArray, thisArg, fn, timeoutInMilliseconds }) {
                const callbackPromise = new Promise((resolve, reject) => {
                  argsArray.push((error, result) => {
                    if (error) {
                      reject(error)
            Severity: Major
            Found in src/user_code_runner.js - About 2 hrs to fix

              Function run has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
              Open

                static async run({ argsArray, thisArg, fn, timeoutInMilliseconds }) {
                  const callbackPromise = new Promise((resolve, reject) => {
                    argsArray.push((error, result) => {
                      if (error) {
                        reject(error)
              Severity: Minor
              Found in src/user_code_runner.js - 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 run has 54 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                async run() {
                  await validateInstall(this.cwd)
                  const configuration = await this.getConfiguration()
                  if (configuration.listI18nLanguages) {
                    this.stdout.write(I18n.getLanguages())
              Severity: Major
              Found in src/cli/index.js - About 2 hrs to fix

                Function logUsage has 43 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  logUsage() {
                    const usage = getUsage({
                      stepDefinitions: this.supportCodeLibrary.stepDefinitions,
                      eventDataCollector: this.eventDataCollector,
                    })
                Severity: Minor
                Found in src/formatter/usage_formatter.js - About 1 hr to fix

                  Function build has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    async build() {
                      const listI18nKeywordsFor = this.options.i18nKeywords
                      const listI18nLanguages = !!this.options.i18nLanguages
                      const unexpandedFeaturePaths = await this.getUnexpandedFeaturePaths()
                      let featurePaths = []
                  Severity: Minor
                  Found in src/cli/configuration_builder.js - About 1 hr to fix

                    Function onTestRunFinished has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      onTestRunFinished() {
                        const groupedTestCases = {}
                        _.each(this.eventDataCollector.testCaseMap, testCase => {
                          const { sourceLocation: { uri } } = testCase
                          if (!groupedTestCases[uri]) {
                    Severity: Minor
                    Found in src/formatter/json_formatter.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 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

                        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 getStepData has 32 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 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 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

                                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

                                  Function formatStep has a Cognitive Complexity of 10 (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

                                  Function run has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                                  Open

                                  async function run({
                                    defaultTimeout,
                                    hookParameter,
                                    parameterTypeRegistry,
                                    step,
                                  Severity: Minor
                                  Found in src/runtime/step_runner.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

                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language