senecajs/seneca

View on GitHub

Showing 72 of 109 total issues

Function make_tasks has a Cognitive Complexity of 99 (exceeds 5 allowed). Consider refactoring.
Open

function make_tasks(): any {
  return {
    // TODO: args validation?
    args: (spec: TaskSpec) => {
      let args: any[] = [...spec.ctx.args]
Severity: Minor
Found in lib/plugin.ts - 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 make_tasks has a Cognitive Complexity of 99 (exceeds 5 allowed). Consider refactoring.
Open

function make_tasks() {
    return {
        // TODO: args validation?
        args: (spec) => {
            let args = [...spec.ctx.args];
Severity: Minor
Found in lib/plugin.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 resolve_options has a Cognitive Complexity of 88 (exceeds 5 allowed). Consider refactoring.
Open

module.exports = function resolve_options(callmodule, defaults, orig_initial) {
  var sourcemap = {
    argv: {},
    env: {},
    default_file: {},
Severity: Minor
Found in lib/options.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 make_intern has a Cognitive Complexity of 61 (exceeds 5 allowed). Consider refactoring.
Open

function make_intern() {
  return {
    // TODO: explicit tests for these operators

    op: {
Severity: Minor
Found in lib/plugin.ts - 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 make_intern has a Cognitive Complexity of 61 (exceeds 5 allowed). Consider refactoring.
Open

function make_intern() {
    return {
        // TODO: explicit tests for these operators
        op: {
            seneca_plugin: (tr, ctx, data) => {
Severity: Minor
Found in lib/plugin.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 makedie has a Cognitive Complexity of 57 (exceeds 5 allowed). Consider refactoring.
Open

function makedie(instance, ctxt) {
    ctxt = Object.assign(ctxt, instance.die ? instance.die.context : {});
    let diecount = 0;
    let die = function (err) {
        let so = instance.options();
Severity: Minor
Found in lib/common.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 makedie has a Cognitive Complexity of 57 (exceeds 5 allowed). Consider refactoring.
Open

function makedie(instance: any, ctxt: any) {
  ctxt = Object.assign(ctxt, instance.die ? instance.die.context : {})

  let diecount = 0

Severity: Minor
Found in lib/common.ts - 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 build_test_log has a Cognitive Complexity of 48 (exceeds 5 allowed). Consider refactoring.
Open

function build_test_log(seneca, data) {
  var logstr
  var time = data.when - seneca.start_time
  var exports = seneca.private$.exports
  var debug_opts = exports && exports.options && exports.options.debug
Severity: Minor
Found in lib/logging.js - About 7 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 flat_logger has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring.
Open

function flat_logger(entry) {
  let opts = this.options()
  var datalen = opts.debug.datalen || 111

  var level_str = (entry.level_name + '').toUpperCase()
Severity: Minor
Found in lib/logging.js - About 5 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 api_prior has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring.
Open

exports.api_prior = function () {
  const opts = this.options()
  if (null == this.private$.act) {
    // TODO: should be a top level api method: seneca.fail
    throw this.util.error('no_prior_action', { args: arguments })
Severity: Minor
Found in lib/prior.js - About 5 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 make_seneca has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
Open

function make_seneca(initial_opts) {
  // Create a private context.
  var private$ = make_private()
  private$.error = error

Severity: Minor
Found in seneca.js - About 4 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 build_log_spec has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

function build_log_spec(self) {
  var options = self.options()
  var orig_logspec = options.log

  // Canonize logspec into a standard object structure
Severity: Minor
Found in lib/logging.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 act_error has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

intern.act_error = function (instance, ctx, data) {
  var duration = ctx.duration
  var act_callpoint = ctx.callpoint
  var actdef = ctx.actdef || {}
  var origmsg = ctx.origmsg
Severity: Minor
Found in lib/outward.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 make_use has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

function make_use(ordu: any, callpoint: any) {
  let seq = { index: 0 }

  return function use(this: any) {
    let self = this
Severity: Minor
Found in lib/plugin.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

Function client has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

exports.client = function (callpoint) {
  return function api_client() {
    var private$ = this.private$
    var argsarr = Array.prototype.slice.call(arguments)
    var self = this
Severity: Minor
Found in lib/api.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 make_use has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

function make_use(ordu, callpoint) {
    let seq = { index: 0 };
    return function use() {
        let self = this;
        let args = [...arguments];
Severity: Minor
Found in lib/plugin.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 make_plugin_key has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

function make_plugin_key(plugin: any, origtag: any) {
  if (null == plugin) {
    throw error('missing_plugin_name')
  }

Severity: Minor
Found in lib/common.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

Function make_plugin_key has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

function make_plugin_key(plugin, origtag) {
    if (null == plugin) {
        throw error('missing_plugin_name');
    }
    let name = null == plugin.name ? plugin : plugin.name;
Severity: Minor
Found in lib/common.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 constructor has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    constructor(instance, opts, origmsg, origreply) {
        this.start = Date.now();
        this.mi = '';
        this.tx = '';
        this.id = '';
Severity: Minor
Found in lib/meta.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 build_log has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

function build_log(self) {
  var logspec = build_log_spec(self)

  // shortcut for direct access (avoids seneca.options() call)
  self.private$.logspec = logspec
Severity: Minor
Found in lib/logging.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