kristok/node-pgq

View on GitHub

Showing 11 of 18 total issues

Function PgQDatabaseApi has 133 lines of code (exceeds 25 allowed). Consider refactoring.
Open

var PgQDatabaseApi = function(config) {
    var self = this;

    var initialize = function(dbConString) {
        self.db = db(dbConString);
Severity: Major
Found in lib/dbapi.js - About 5 hrs to fix

    Function exports has 120 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    module.exports = function(config) {
        var self = new EventEmitter();
    
        var initialize = function(config) {
            var requiredParams = {
    Severity: Major
    Found in lib/consumer.js - About 4 hrs to fix

      Function Ticker has 88 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      var Ticker = function(config) {
          var self = new EventEmitter(),
              sec = 100;
      
          var initialize = function(config) {
      Severity: Major
      Found in lib/ticker.js - About 3 hrs to fix

        Function exports has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
        Open

        module.exports = function(conString) {
            var self = {
                conString: conString
            };
        
        Severity: Minor
        Found in lib/db.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 Ticker has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
        Open

        var Ticker = function(config) {
            var self = new EventEmitter(),
                sec = 100;
        
            var initialize = function(config) {
        Severity: Minor
        Found in lib/ticker.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 exports has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
        Open

        module.exports = function(config) {
            var self = new EventEmitter();
        
            var initialize = function(config) {
                var requiredParams = {
        Severity: Minor
        Found in lib/consumer.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 exports has 29 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        module.exports = function(conString) {
            var self = {
                conString: conString
            };
        
        Severity: Minor
        Found in lib/db.js - About 1 hr to fix

          Function exports has 26 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          module.exports = function(api, setup, callback) {
              async.series([
          
                  function checkIfPgQSchemaExists(next) {
                      setup.emit('log', 'checking if pgq schema already exists');
          Severity: Minor
          Found in lib/installpgq.js - About 1 hr to fix

            Consider simplifying this complex logical expression.
            Open

                    if (config && config.database) {
                        self.tickerPeriod = config.tickerPeriod || 1 * sec;
                        self.maintenancePeriod = config.maintenancePeriod || 120 * sec;
                        self.retryPeriod = config.retryPeriod || 30 * sec;
                        self.logDebug = config.logDebug || false;
            Severity: Major
            Found in lib/ticker.js - About 40 mins to fix

              Function exports has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

              module.exports = function(api, setup, callback) {
                  async.series([
              
                      function checkIfPgQSchemaExists(next) {
                          setup.emit('log', 'checking if pgq schema already exists');
              Severity: Minor
              Found in lib/installpgq.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

              Function PgQDatabaseApi has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

              var PgQDatabaseApi = function(config) {
                  var self = this;
              
                  var initialize = function(dbConString) {
                      self.db = db(dbConString);
              Severity: Minor
              Found in lib/dbapi.js - About 25 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