senecajs/seneca

View on GitHub

Showing 177 of 189 total issues

Function make_tasks has a Cognitive Complexity of 119 (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 2 days 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 119 (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 2 days 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 98 (exceeds 5 allowed). Consider refactoring.
Open

function resolve_options(callmodule, defaults, orig_initial) {
    let optionShape = Gubu(defaults);
    const sourcemap = {
        argv: {},
        env: {},
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 resolve_options has a Cognitive Complexity of 95 (exceeds 5 allowed). Consider refactoring.
Open

function resolve_options(callmodule: any, defaults: any, orig_initial: any) {
  let optionShape = Gubu(defaults)

  const sourcemap: any = {
    argv: {},
Severity: Minor
Found in lib/options.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

Similar blocks of code found in 2 locations. Consider refactoring.
Open

    root$.order.outward = new Ordu({
        name: 'outward',
        debug: !!start_opts.debug.ordu || !!start_opts.order.outward.debug,
    })
        .add(outward_1.Outward.outward_make_error)
Severity: Major
Found in seneca.js and 1 other location - About 1 day to fix
seneca.js on lines 602..615

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 221.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

    root$.order.add = new Ordu({
        name: 'add',
        debug: !!start_opts.debug.ordu || !!start_opts.order.add.debug,
    })
        .add(Add.task.translate)
Severity: Major
Found in seneca.js and 1 other location - About 1 day to fix
seneca.js on lines 633..646

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 221.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

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 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 jsonic_strify has a Cognitive Complexity of 50 (exceeds 5 allowed). Consider refactoring.
Open

function jsonic_strify(val: any, opts: any, depth: number) {
  depth++
  if (null == val) return 'null'

  var type = Object.prototype.toString.call(val).charAt(8)
Severity: Minor
Found in lib/common.ts - 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 jsonic_strify has a Cognitive Complexity of 50 (exceeds 5 allowed). Consider refactoring.
Open

function jsonic_strify(val, opts, depth) {
    depth++;
    if (null == val)
        return 'null';
    var type = Object.prototype.toString.call(val).charAt(8);
Severity: Minor
Found in lib/common.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 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 build_test_log has a Cognitive Complexity of 48 (exceeds 5 allowed). Consider refactoring.
Open

function build_test_log(seneca: any, data: any) {
  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.ts - 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

Similar blocks of code found in 2 locations. Consider refactoring.
Open

  root$.order.inward = new Ordu({
    name: 'inward',
    debug: !!start_opts.debug.ordu || !!start_opts.order.inward.debug,
  })
    .add(Inward.inward_msg_modify)
Severity: Major
Found in seneca.ts and 1 other location - About 6 hrs to fix
seneca.ts on lines 824..837

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 168.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

  root$.order.outward = new Ordu({
    name: 'outward',
    debug: !!start_opts.debug.ordu || !!start_opts.order.outward.debug,
  })
    .add(Outward.outward_make_error)
Severity: Major
Found in seneca.ts and 1 other location - About 6 hrs to fix
seneca.ts on lines 806..819

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 168.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Function flat_logger has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring.
Open

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

  var level_str = (entry.level_name + '').toUpperCase()
Severity: Minor
Found in lib/logging.ts - 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 flat_logger has a Cognitive Complexity of 35 (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();
    if (level_str.length < 5) {
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 make_seneca has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
Open

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

Severity: Minor
Found in seneca.ts - 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 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;
    // Create a new root Seneca instance.
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

Similar blocks of code found in 2 locations. Consider refactoring.
Open

function action_listen(this: any, msg: any, reply: any) {
  const seneca = this

  const config = Object.assign({}, msg.config, {
    role: 'transport',
Severity: Major
Found in lib/transport.ts and 1 other location - About 2 hrs to fix
lib/transport.ts on lines 222..235

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 89.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

function action_listen(msg, reply) {
    const seneca = this;
    const config = Object.assign({}, msg.config, {
        role: 'transport',
        hook: 'listen',
Severity: Major
Found in lib/transport.js and 1 other location - About 2 hrs to fix
lib/transport.js on lines 179..188

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 89.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Severity
Category
Status
Source
Language