g13013/node-app-next

View on GitHub

Showing 7 of 7 total issues

Function middlewareFor has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

function middlewareFor(ctx, key) {
  return function* contextSetupMiddleware(next) {
    if (typeof ctx === 'function') {
      if (!key) {
        throw new TypeError('Cannot set function context for route witout key name');
Severity: Minor
Found in lib/middlewares/context_provider.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 connectionString has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

  set connectionString (conStr) {
    if (conStr) {
      try {
        var uri = url.parse(conStr);
      } catch(err) {
Severity: Minor
Found in lib/db_adapter.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 loadFrom has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

  loadFrom (folder) {
    var modulesDir = fs.existsSync(`${folder}/node_modules`) ? `${folder}/node_modules` : folder;
    var usePrefix = this.prefix && folder !== modulesDir;
    for (let node of new FsNode(modulesDir)) {
      if (!node.isDirectory || /^\./.test(node.basename)) {
Severity: Minor
Found in lib/modules_map.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 constructor has 28 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  constructor (config) {
    super();
    var homeDir = process.env.HOME;
    var dir = process.cwd();
    var descriptor = new this.ModuleDescriptor(process.cwd());
Severity: Minor
Found in lib/application.js - About 1 hr to fix

    Function setupTransports has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

      static setupTransports (config, transports) {
        transports = transports || Logger.transports;
    
        if (typeof config !== 'object') {
          return transports;
    Severity: Minor
    Found in lib/logger.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 serverErrorHandlerMiddleware has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

    function * serverErrorHandlerMiddleware(next) {
      Object.defineProperty(this, 'errors', {value: []});
    
      try {
        yield next;
    Severity: Minor
    Found in lib/middlewares/server_error_handler.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 constructor has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

      constructor (options, prefix) {
        if (typeof options === 'string') {
          prefix = options;
          options = null;
        }
    Severity: Minor
    Found in lib/logger.js - About 35 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