cucumber/cucumber-js

View on GitHub

Showing 44 of 232 total issues

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

      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

        File issue_helpers_spec.js has 282 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 getColorFns from '../get_color_fns'
        import Status from '../../status'
        Severity: Minor
        Found in src/formatter/helpers/issue_helpers_spec.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 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 onTestRunFinished has 42 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              onTestRunFinished() {
                const groupedTestCases = {}
                _.each(this.eventDataCollector.testCaseMap, testCase => {
                  const {
                    sourceLocation: { uri },
            Severity: Minor
            Found in src/formatter/json_formatter.js - About 1 hr to fix

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

                          async initializeFormatters({
                            eventBroadcaster,
                            formatOptions,
                            formats,
                            supportCodeLibrary,
                        Severity: Minor
                        Found in src/cli/index.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 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

                            Function getColorFns has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            export default function getColorFns(enabled) {
                              if (enabled) {
                                return {
                                  [Status.AMBIGUOUS]: ::colors.red,
                                  [Status.FAILED]: ::colors.red,
                            Severity: Minor
                            Found in src/formatter/get_color_fns.js - About 1 hr to fix

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