tunnckoCore/benz

View on GitHub

Showing 6 of 6 total issues

Function factory has a Cognitive Complexity of 52 (exceeds 5 allowed). Consider refactoring.
Open

module.exports = function factory (self, method) {
  method = method === 'series' ? 'mapSeries' : method
  method = method === 'parallel' ? 'map' : method

  return function _factory_ (fns, exts) {
Severity: Minor
Found in lib/factory.js - About 1 day 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 factory has 64 lines of code (exceeds 25 allowed). Consider refactoring.
Open

module.exports = function factory (self, method) {
  method = method === 'series' ? 'mapSeries' : method
  method = method === 'parallel' ? 'map' : method

  return function _factory_ (fns, exts) {
Severity: Major
Found in lib/factory.js - About 2 hrs to fix

Function _factory_ has 60 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  return function _factory_ (fns, exts) {
    if (kindOf(fns) === 'function') {
      fns = [fns]
    }
    if (kindOf(fns) !== 'array' && kindOf(fns) !== 'object') {
Severity: Major
Found in lib/factory.js - About 2 hrs to fix

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

    function complete () {
      var argz = handleArguments(arguments)
      var results = []

      nowAndLater[method](fns, iterator, extensions, lastCallback(context, argz.callback))
Severity: Minor
Found in lib/factory.js - About 1 hr to fix

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

Benz.prototype._defaultOptions = function _defaultOptions () {
  if (!this.hasOption('context') || !isObject(this.option('context'))) {
    this.option('context', null)
  }
  if (!this.hasOption('promise') || !this.isBoolean('promise')) {
Severity: Minor
Found in index.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 _defaultOptions has 28 lines of code (exceeds 25 allowed). Consider refactoring.
Open

Benz.prototype._defaultOptions = function _defaultOptions () {
  if (!this.hasOption('context') || !isObject(this.option('context'))) {
    this.option('context', null)
  }
  if (!this.hasOption('promise') || !this.isBoolean('promise')) {
Severity: Minor
Found in index.js - About 1 hr to fix
Severity
Category
Status
Source
Language