senecajs/seneca

View on GitHub

Showing 162 of 174 total issues

Function resolve_config has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

intern.resolve_config = function(config: any, options: any) {
  var out = Object.assign({}, config)

  Object.keys(options).forEach((key) => {
    var value = options[key]
Severity: Minor
Found in lib/api.ts - About 55 mins 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 fail has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

function fail(this: any, ...args: any[]) {
  if (args.length <= 2) {
    return failIf(this, true, args[0], args[1])
  }

Severity: Minor
Found in lib/api.ts - About 55 mins 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 fail has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

function fail(...args) {
    if (args.length <= 2) {
        return failIf(this, true, args[0], args[1]);
    }
    if (args.length === 3) {
Severity: Minor
Found in lib/api.js - About 55 mins 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 3 locations. Consider refactoring.
Open

seneca.act('cmd:salestax,net:100,country:DE', function (err, result) {
  if (err) return console.error(err)
  console.log('DE: ' + result.total)
})
Severity: Major
Found in docs/examples/sales-tax/sales-tax-complex.js and 2 other locations - About 55 mins to fix
docs/examples/sales-tax/sales-tax-complex.js on lines 39..42
docs/examples/sales-tax/sales-tax-complex.js on lines 44..47

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 53.

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 3 locations. Consider refactoring.
Open

seneca.act('cmd:salestax,net:100,country:US,state:NY', function (err, result) {
  if (err) return console.error(err)
  console.log('US,NY: ' + result.total)
})
Severity: Major
Found in docs/examples/sales-tax/sales-tax-complex.js and 2 other locations - About 55 mins to fix
docs/examples/sales-tax/sales-tax-complex.js on lines 34..37
docs/examples/sales-tax/sales-tax-complex.js on lines 44..47

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 53.

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 3 locations. Consider refactoring.
Open

seneca.act('cmd:salestax,net:100,country:IE,category:reduced', function (err, result) {
  if (err) return console.error(err)
  console.log('IE: ' + result.total)
})
Severity: Major
Found in docs/examples/sales-tax/sales-tax-complex.js and 2 other locations - About 55 mins to fix
docs/examples/sales-tax/sales-tax-complex.js on lines 34..37
docs/examples/sales-tax/sales-tax-complex.js on lines 39..42

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 53.

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 handle_reply has 7 arguments (exceeds 4 allowed). Consider refactoring.
Open

    handle_reply: function (opts, meta, actctxt, actmsg, err, out, reply_meta) {
Severity: Major
Found in lib/act.js - About 50 mins to fix

    Function execute_action has 7 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        execspec: any,
        act_instance: any,
        opts: any,
        actctxt: any,
        msg: any,
    Severity: Major
    Found in lib/act.ts - About 50 mins to fix

      Function handle_reply has 7 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          opts: any,
          meta: any,
          actctxt: any,
          actmsg: any,
          err: any,
      Severity: Major
      Found in lib/act.ts - About 50 mins to fix

        Function walk has 7 arguments (exceeds 4 allowed). Consider refactoring.
        Open

                walk: function (Joi, start_joiobj, obj, path, opts, ctxt, mod) {
        Severity: Major
        Found in lib/plugin.js - About 50 mins to fix

          Function execute_action has 7 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              execute_action: function (execspec, act_instance, opts, actctxt, msg, meta, reply) {
          Severity: Major
          Found in lib/act.js - About 50 mins to fix

            Function walk has 7 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                  Joi: any,
                  start_joiobj: any,
                  obj: any,
                  path: any,
                  opts: any,
            Severity: Major
            Found in lib/plugin.ts - About 50 mins to fix

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

                var delegate_fixedargs = opts.strict.fixedargs
                  ? Object.assign({}, fixedargs, self.fixedargs)
                  : Object.assign({}, self.fixedargs, fixedargs)
              Severity: Minor
              Found in lib/api.ts and 1 other location - About 50 mins to fix
              lib/api.ts on lines 275..277

              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 51.

              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

                  var delegate_fixedmeta = opts.strict.fixedmeta
                      ? Object.assign({}, fixedmeta, self.fixedmeta)
                      : Object.assign({}, self.fixedmeta, fixedmeta);
              Severity: Minor
              Found in lib/api.js and 1 other location - About 50 mins to fix
              lib/api.js on lines 205..207

              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 51.

              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

                  var delegate_fixedargs = opts.strict.fixedargs
                      ? Object.assign({}, fixedargs, self.fixedargs)
                      : Object.assign({}, self.fixedargs, fixedargs);
              Severity: Minor
              Found in lib/api.js and 1 other location - About 50 mins to fix
              lib/api.js on lines 208..210

              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 51.

              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

                var delegate_fixedmeta = opts.strict.fixedmeta
                  ? Object.assign({}, fixedmeta, self.fixedmeta)
                  : Object.assign({}, self.fixedmeta, fixedmeta)
              Severity: Minor
              Found in lib/api.ts and 1 other location - About 50 mins to fix
              lib/api.ts on lines 271..273

              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 51.

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

              function inward_act_cache(spec) {
                  const ctx = spec.ctx;
                  const data = spec.data;
                  var so = ctx.options;
                  var meta = data.meta;
              Severity: Minor
              Found in lib/inward.js - About 45 mins 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 6 locations. Consider refactoring.
              Open

              var __importDefault = (this && this.__importDefault) || function (mod) {
                  return (mod && mod.__esModule) ? mod : { "default": mod };
              };
              Severity: Major
              Found in lib/options.js and 5 other locations - About 45 mins to fix
              lib/inward.js on lines 3..5
              lib/legacy.js on lines 3..5
              lib/logging.js on lines 3..5
              lib/prior.js on lines 3..5
              lib/transport.js on lines 3..5

              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 50.

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

              function outward_act_stats(spec) {
                  const ctx = spec.ctx;
                  const data = spec.data;
                  if (!ctx.actdef || ctx.cached$) {
                      return;
              Severity: Minor
              Found in lib/outward.js - About 45 mins 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 outward_act_stats has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

              function outward_act_stats(spec: any) {
                const ctx = spec.ctx
                const data = spec.data
              
                if (!ctx.actdef || ctx.cached$) {
              Severity: Minor
              Found in lib/outward.ts - About 45 mins 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