pwaleczek/redis.pubsub

View on GitHub

Showing 7 of 7 total issues

Function setup has 32 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function setup(_config, _options) {
  switch (typeof _config) {
    case 'object':
      config = _config;
      break;
Severity: Minor
Found in lib/redis-pub-sub.js - About 1 hr to fix

    Function onQuery has 30 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function onQuery(query, filter, callback) {
      if (!this._sub) {
        throw new Error('Can\'t subscribe without a client!');
        return;
      }
    Severity: Minor
    Found in lib/redis-pub-sub.js - About 1 hr to fix

      Function PubSub has 28 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      var PubSub = function (/* polymorphic */) {
        var _this = this;
      
        // determine if using simple mode
        this.simple = !!(arguments[0] === 'simple') || false;
      Severity: Minor
      Found in lib/redis-pub-sub.js - About 1 hr to fix

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

        Query.prototype.add = function (query, fn) {
          var id = common.gensym();
          var compiled = compile(query);
          var list = this._list;
        
        
        Severity: Minor
        Found in lib/query.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

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

        function cleanUp(callback) {
          var _this = this;
        
          callback = callback || function () {};
        
        
        Severity: Minor
        Found in lib/redis-pub-sub.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 onQuery has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

        function onQuery(query, filter, callback) {
          if (!this._sub) {
            throw new Error('Can\'t subscribe without a client!');
            return;
          }
        Severity: Minor
        Found in lib/redis-pub-sub.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 PubSub has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

        var PubSub = function (/* polymorphic */) {
          var _this = this;
        
          // determine if using simple mode
          this.simple = !!(arguments[0] === 'simple') || false;
        Severity: Minor
        Found in lib/redis-pub-sub.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