desaroger/pm2-hooks

View on GitHub

Showing 6 of 6 total issues

Function _parseRequest has a Cognitive Complexity of 55 (exceeds 5 allowed). Consider refactoring.
Open

    _parseRequest(req, route) {
        route = Object.assign({
            name: '<unknown>',
            type: 'auto',
            secret: false
Severity: Minor
Found in src/WebhookServer.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 _parseRequest has 116 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    _parseRequest(req, route) {
        route = Object.assign({
            name: '<unknown>',
            type: 'auto',
            secret: false
Severity: Major
Found in src/WebhookServer.js - About 4 hrs to fix

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

        _handleCall(req, res) {
            let self = this;
            this._parseBody(req, res, c(function* () {
                try {
                    // Mock
    Severity: Major
    Found in src/WebhookServer.js - About 2 hrs to fix

      File WebhookServer.js has 261 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      /**
       * Created by desaroger on 23/02/17.
       */
      
      const _ = require('lodash');
      Severity: Minor
      Found in src/WebhookServer.js - About 2 hrs to fix

        Function _parseProcess has 39 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            static _parseProcess(app) {
                // Check data
                if (!app || !app.pm2_env) {
                    return null;
                }
        Severity: Minor
        Found in src/Pm2Module.js - About 1 hr to fix

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

              static _parseProcess(app) {
                  // Check data
                  if (!app || !app.pm2_env) {
                      return null;
                  }
          Severity: Minor
          Found in src/Pm2Module.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

          Severity
          Category
          Status
          Source
          Language