cucumber/cucumber-js

View on GitHub

Showing 43 of 187 total issues

File pickle_filter_spec.ts has 425 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import { beforeEach, describe, it } from 'mocha'
import { expect } from 'chai'
import PickleFilter from './pickle_filter'
import path from 'path'
import { parse } from '../test/gherkin_helpers'
Severity: Minor
Found in src/pickle_filter_spec.ts - About 6 hrs to fix

    File pickle_runner_spec.ts has 424 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import { afterEach, beforeEach, describe, it } from 'mocha'
    import { expect } from 'chai'
    import PickleRunner from './pickle_runner'
    import Status from '../status'
    import { EventEmitter } from 'events'
    Severity: Minor
    Found in src/runtime/pickle_runner_spec.ts - About 6 hrs to fix

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

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

        File pickle_runner.ts has 320 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        import _ from 'lodash'
        import { getAmbiguousStepException } from './helpers'
        import AttachmentManager from './attachment_manager'
        import StepRunner from './step_runner'
        import { messages, IdGenerator } from 'cucumber-messages'
        Severity: Minor
        Found in src/runtime/pickle_runner.ts - About 3 hrs to fix

          File progress_bar_formatter_spec.ts has 301 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          import { beforeEach, afterEach, describe, it } from 'mocha'
          import { expect } from 'chai'
          import sinon from 'sinon'
          import { EventEmitter } from 'events'
          import { EventDataCollector } from './helpers'
          Severity: Minor
          Found in src/formatter/progress_bar_formatter_spec.ts - About 3 hrs to fix

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

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

              File index.ts has 286 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              import _ from 'lodash'
              import { buildParameterType, getDefinitionLineAndUri } from './build_helpers'
              import { IdGenerator } from 'cucumber-messages'
              import TestCaseHookDefinition from '../models/test_case_hook_definition'
              import TestRunHookDefinition from '../models/test_run_hook_definition'
              Severity: Minor
              Found in src/support_code_library_builder/index.ts - About 2 hrs to fix

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

                  async run({
                    argsArray,
                    thisArg,
                    fn,
                    timeoutInMilliseconds,
                Severity: Major
                Found in src/user_code_runner.ts - About 2 hrs to fix

                  File json_formatter_spec.ts has 275 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  import { beforeEach, afterEach, describe, it } from 'mocha'
                  import { expect } from 'chai'
                  import { testFormatter } from '../../test/formatter_helpers'
                  import {
                    getJsonFormatterSupportCodeLibrary,
                  Severity: Minor
                  Found in src/formatter/json_formatter_spec.ts - About 2 hrs to fix

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

                      async run({
                        argsArray,
                        thisArg,
                        fn,
                        timeoutInMilliseconds,
                    Severity: Minor
                    Found in src/user_code_runner.ts - 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

                    File json_formatter.ts has 270 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    import _, { Dictionary } from 'lodash'
                    import Formatter from './'
                    import Status from '../status'
                    import { formatLocation, GherkinDocumentParser, PickleParser } from './helpers'
                    import { durationToNanoseconds } from '../time'
                    Severity: Minor
                    Found in src/formatter/json_formatter.ts - About 2 hrs to fix

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

                        logUsage(): void {
                          const usage = getUsage({
                            cwd: this.cwd,
                            stepDefinitions: this.supportCodeLibrary.stepDefinitions,
                            eventDataCollector: this.eventDataCollector,
                      Severity: Minor
                      Found in src/formatter/usage_formatter.ts - About 2 hrs to fix

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

                        async function runFeature(): Promise<boolean> {
                          $output.empty()
                          $('a[href="#output-tab"]').tab('show')
                        
                          const eventBroadcaster = new EventEmitter()
                        Severity: Minor
                        Found in example/index.ts - About 2 hrs to fix

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

                            onTestRunFinished(): void {
                              const groupedTestCaseAttempts: UriToTestCaseAttemptsMap = {}
                              _.each(
                                this.eventDataCollector.getTestCaseAttempts(),
                                (testCaseAttempt: ITestCaseAttempt) => {
                          Severity: Minor
                          Found in src/formatter/json_formatter.ts - About 2 hrs to fix

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

                              async run(): Promise<messages.ITestResult> {
                                this.emitTestCase()
                                for (let attempt = 0; attempt < this.maxAttempts; attempt++) {
                                  this.currentTestCaseStartedId = this.newId()
                                  this.eventBroadcaster.emit(
                            Severity: Minor
                            Found in src/runtime/pickle_runner.ts - About 1 hr to fix

                              Function getGherkinScenarioLocationMap has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                              Open

                              export function getGherkinScenarioLocationMap(
                                gherkinDocument: messages.IGherkinDocument
                              ): Dictionary<messages.ILocation> {
                                const map: Dictionary<messages.ILocation> = {}
                                for (const child of gherkinDocument.feature.children) {
                              Severity: Minor
                              Found in src/formatter/helpers/gherkin_document_parser.ts - 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 build has 46 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                async build(): Promise<IConfiguration> {
                                  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.ts - About 1 hr to fix

                                Function parseStep has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                                Open

                                function parseStep({
                                  isBeforeHook,
                                  gherkinStepMap,
                                  keyword,
                                  keywordType,
                                Severity: Minor
                                Found in src/formatter/helpers/test_case_attempt_parser.ts - 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 aroundTestStep has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                  async aroundTestStep(
                                    testStepId: string,
                                    attempt: number,
                                    runStepFn: () => Promise<messages.ITestResult>
                                  ): Promise<void> {
                                Severity: Minor
                                Found in src/runtime/pickle_runner.ts - About 1 hr to fix

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

                                    getStepData({
                                      isBeforeHook,
                                      gherkinStepMap,
                                      pickleStepMap,
                                      testStep,
                                  Severity: Minor
                                  Found in src/formatter/json_formatter.ts - About 1 hr to fix
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language