rootslab/vapid

View on GitHub

Showing 66 of 66 total issues

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

var sendCommands = function () {
    var i = 0
        , client = null
        , pcmd = publisher.commands.publish
        ;
Severity: Major
Found in bench/spade-vapid-short-message-bench.js and 3 other locations - About 1 hr to fix
bench/spade-redis-long-message-bench.js on lines 52..59
bench/spade-redis-pubsub-short-message-bench.js on lines 43..50
bench/spade-vapid-pubsub-long-message-bench.js on lines 48..55

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

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

var sendCommands = function () {
    var i = 0
        , client = null
        , pcmd = publisher.commands.publish
        ;
Severity: Major
Found in bench/spade-vapid-pubsub-long-message-bench.js and 3 other locations - About 1 hr to fix
bench/spade-redis-long-message-bench.js on lines 52..59
bench/spade-redis-pubsub-short-message-bench.js on lines 43..50
bench/spade-vapid-short-message-bench.js on lines 45..52

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

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

                if ( patt && patt.length ) {
                    // check if subscriber already exists
                    if ( ! ~ patt.indexOf( sock.name ) ) {
                        patt.push( sock.name );
                        spatterns.push( pname );
Severity: Major
Found in lib/commands/pubsub.js and 1 other location - About 1 hr to fix
lib/commands/pubsub.js on lines 176..189

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

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

                if ( chan && chan.length ) {
                    // check if subscriber already exists
                    if ( ! ~ chan.indexOf( sock.name ) ) {
                        chan.push( sock.name );
                        schannels.push( cname );
Severity: Major
Found in lib/commands/pubsub.js and 1 other location - About 1 hr to fix
lib/commands/pubsub.js on lines 222..241

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

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 channels has 39 lines of code (exceeds 25 allowed). Consider refactoring.
Open

            channels : function ( command, args, sock ) {
                var me = this
                    , channels = me.pubsub.channels
                    , alen = args.length
                    , cmd = command[ 1 ]
Severity: Minor
Found in lib/commands/pubsub.js - About 1 hr to fix

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

            , resetSubscriptions = function ( sock, pubsub ) {
                var pchannels = pubsub.channels
                    , ppatterns = pubsub.patterns
                    , schannels = sock.pubsub.channels
                    , spatterns = sock.pubsub.patterns
    Severity: Minor
    Found in lib/vapid.js - About 1 hr to fix

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

              , psubscribe : function ( command, args, sock ) {
                  var me = this
                      , patterns = me.pubsub.patterns
                      , spatterns = null
                      , alen = args.length
      Severity: Minor
      Found in lib/commands/pubsub.js - About 1 hr to fix

        Function Rule has 37 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        exports.Rule = ( function () {
            var emitter = require('events').EventEmitter
                , util = require( 'util' )
                , Abaco = require( 'abaco' )
                , max = Math.max
        Severity: Minor
        Found in lib/parser/rules/rule.js - About 1 hr to fix

          Identical blocks of code found in 4 locations. Consider refactoring.
          Open

          var enqueue = function () {
              var me = this
                  ;
              me.commands.subscribe( channels, function () {
                  ++reply_messages;
          Severity: Major
          Found in bench/spade-redis-pubsub-short-message-bench.js and 3 other locations - About 1 hr to fix
          bench/spade-redis-long-message-bench.js on lines 61..70
          bench/spade-vapid-pubsub-long-message-bench.js on lines 57..66
          bench/spade-vapid-short-message-bench.js on lines 54..63

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

          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

          Identical blocks of code found in 4 locations. Consider refactoring.
          Open

          var enqueue = function () {
              var me = this
                  ;
              me.commands.subscribe( channels, function () {
                  ++reply_messages;
          Severity: Major
          Found in bench/spade-vapid-short-message-bench.js and 3 other locations - About 1 hr to fix
          bench/spade-redis-long-message-bench.js on lines 61..70
          bench/spade-redis-pubsub-short-message-bench.js on lines 52..61
          bench/spade-vapid-pubsub-long-message-bench.js on lines 57..66

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

          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

          Identical blocks of code found in 4 locations. Consider refactoring.
          Open

          var enqueue = function () {
              var me = this
                  ;
              me.commands.subscribe( channels, function () {
                  ++reply_messages;
          Severity: Major
          Found in bench/spade-vapid-pubsub-long-message-bench.js and 3 other locations - About 1 hr to fix
          bench/spade-redis-long-message-bench.js on lines 61..70
          bench/spade-redis-pubsub-short-message-bench.js on lines 52..61
          bench/spade-vapid-short-message-bench.js on lines 54..63

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

          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

          Identical blocks of code found in 4 locations. Consider refactoring.
          Open

          var enqueue = function () {
              var me = this
                  ;
              me.commands.subscribe( channels, function () {
                  ++reply_messages;
          Severity: Major
          Found in bench/spade-redis-long-message-bench.js and 3 other locations - About 1 hr to fix
          bench/spade-redis-pubsub-short-message-bench.js on lines 52..61
          bench/spade-vapid-pubsub-long-message-bench.js on lines 57..66
          bench/spade-vapid-short-message-bench.js on lines 54..63

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

          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 parse has 36 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              bproto.parse = function ( data, pos ) {
                  var me = this
                      , dlen = data.length
                      , p = pos || 0
                      , curry = 0
          Severity: Minor
          Found in lib/parser/rules/bulk.js - About 1 hr to fix

            Function publish has 36 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                    , publish : function ( command, args, sock ) {
                        var me = this
                            , clients = me.clients
                            , pubsub = me.pubsub
                            , channels = pubsub.channels
            Severity: Minor
            Found in lib/commands/pubsub.js - About 1 hr to fix

              Function onParserMatch has 34 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                                      , onParserMatch = function ( e, d, reveal ) {
                                          var cmd = d[ 0 ].toLowerCase()
                                              , sub = null
                                              , ocmd = me.commands[ cmd ]
                                              , osub = null
              Severity: Minor
              Found in lib/vapid.js - About 1 hr to fix

                Function subscribe has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                        , subscribe : function ( command, args, sock ) {
                            var me = this
                                , channels = me.pubsub.channels
                                , schannels = null
                                , alen = args.length
                Severity: Minor
                Found in lib/commands/pubsub.js - About 1 hr to fix

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

                  exports.MultiBulkRule = ( function () {
                      var Rule = require('./rule').Rule
                          , util = require( 'util' )
                          , MultiBulkRule = function ( char ) {
                              var me = this
                  Severity: Minor
                  Found in lib/parser/rules/mbulk.js - About 1 hr to fix

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

                            , collectResult = function ( rule, error, data ) {
                                var me = this
                                    , arr = null
                                    , peela = me.peela
                                    , head = peela.head()
                    Severity: Minor
                    Found in lib/parser/vapid_parser.js - About 1 hr to fix

                      Function Rule has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                      Open

                      exports.Rule = ( function () {
                          var emitter = require('events').EventEmitter
                              , util = require( 'util' )
                              , Abaco = require( 'abaco' )
                              , max = Math.max
                      Severity: Minor
                      Found in lib/parser/rules/rule.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 commands has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      exports.commands = function () {
                      
                          var wmsg = function ( cmd ) {
                                  return '-ERR wrong number of arguments for \'' + cmd + '\' command\r\n';
                              }
                      Severity: Minor
                      Found in lib/commands/server.js - About 1 hr to fix
                        Severity
                        Category
                        Status
                        Source
                        Language