cucumber/cucumber-js

View on GitHub

Showing 27 issues of 232 total

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

import TestCaseHookDefinition from '../models/test_case_hook_definition'
import TestCaseRunner from './test_case_runner'
import Status from '../status'
import StepRunner from './step_runner'
import { EventEmitter } from 'events'
Severity: Major
Found in src/runtime/test_case_runner_spec.js - About 1 day to fix

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

    import JsonFormatter from './json_formatter'
    import Status from '../status'
    import EventEmitter from 'events'
    import Gherkin from 'gherkin'
    import { EventDataCollector } from './helpers'
    Severity: Minor
    Found in src/formatter/json_formatter_spec.js - About 4 hrs to fix

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

      import PickleFilter from './pickle_filter'
      
      describe('PickleFilter', function() {
        describe('matches', function() {
          beforeEach(function() {
      Severity: Minor
      Found in src/pickle_filter_spec.js - About 3 hrs to fix

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

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

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

          import getColorFns from './get_color_fns'
          import ProgressBarFormatter from './progress_bar_formatter'
          import Status from '../status'
          import { EventEmitter } from 'events'
          import Gherkin from 'gherkin'
          Severity: Minor
          Found in src/formatter/progress_bar_formatter_spec.js - About 2 hrs to fix

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

              static async run({ argsArray, thisArg, fn, timeoutInMilliseconds }) {
                const callbackPromise = new Promise(function(resolve, reject) {
                  argsArray.push(function(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(function(resolve, reject) {
                    argsArray.push(function(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 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 build has 38 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 build has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

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

                      Function run has 36 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: Minor
                      Found in src/cli/index.js - About 1 hr to fix

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

                              handleStepResult(stepResult) {
                                const step = stepResult.step
                                const status = stepResult.status
                            
                                const currentStep = {
                            Severity: Minor
                            Found in src/formatter/json_formatter.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 => {
                                  return row.cells.map(cell => {
                                    return 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 getStepData has 29 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 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

                                    Severity
                                    Category
                                    Status