webdriverio/wdio-spec-reporter

View on GitHub

Showing 5 of 9 total issues

File reporter.js has 266 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import events from 'events'
import chalk from 'chalk'
import humanizeDuration from 'humanize-duration'

const DURATION_OPTIONS = {
Severity: Minor
Found in lib/reporter.js - About 2 hrs to fix

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

        constructor (baseReporter, config, options = {}) {
            super()
    
            this.chalk = chalk
            this.baseReporter = baseReporter
    Severity: Minor
    Found in lib/reporter.js - About 2 hrs to fix

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

          getBrowserCombo (caps, verbose = true) {
              const device = caps.deviceName
              const browser = caps.browserName || caps.browser
              const version = caps.version || caps.platformVersion || caps.browser_version
              const platform = caps.os ? (caps.os + ' ' + caps.os_version) : (caps.platform || caps.platformName)
      Severity: Minor
      Found in lib/reporter.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 getSuiteResult has 31 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          getSuiteResult (runner) {
              const cid = runner.cid
              const stats = this.baseReporter.stats
              const results = stats.runners[cid]
              const preface = `[${this.getBrowserCombo(results.capabilities, false)} #${cid}]`
      Severity: Minor
      Found in lib/reporter.js - About 1 hr to fix

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

            getResultList (cid, suites, preface = '') {
                let output = ''
        
                for (const specUid in suites) {
                    // Remove "before all" tests from the displayed results
        Severity: Minor
        Found in lib/reporter.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