anilmaurya/bidder

View on GitHub

Showing 42 of 42 total issues

File pusher.js has 2600 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/*!
 * Pusher JavaScript Library v2.1.6
 * http://pusherapp.com/
 *
 * Copyright 2013, Pusher
Severity: Major
Found in app/assets/javascripts/pusher.js - About 1 wk to fix

    Function Pusher has 71 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      function Pusher(app_key, options) {
        checkAppKey(app_key);
        options = options || {};
    
        var self = this;
    Severity: Major
    Found in app/assets/javascripts/pusher.js - About 2 hrs to fix

      Function connect has 66 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        prototype.connect = function(minPriority, callback) {
          if (!this.isSupported()) {
            return failAttempt(new Pusher.Errors.UnsupportedStrategy(), callback);
          } else if (this.priority < minPriority) {
            return failAttempt(new Pusher.Errors.TransportPriorityTooLow(), callback);
      Severity: Major
      Found in app/assets/javascripts/pusher.js - About 2 hrs to fix

        Function connect has 48 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          prototype.connect = function(minPriority, callback) {
            var self = this;
        
            var strategies = this.strategies;
            var current = 0;
        Severity: Minor
        Found in app/assets/javascripts/pusher.js - About 1 hr to fix

          Function bindListeners has 47 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            prototype.bindListeners = function() {
              var self = this;
          
              var onMessage = function(m) {
                var message;
          Severity: Minor
          Found in app/assets/javascripts/pusher.js - About 1 hr to fix

            Function connect has 46 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              prototype.connect = function(minPriority, callback) {
                var encrypted = this.encrypted;
                var info = fetchTransportCache(encrypted);
            
                var strategies = [this.strategy];
            Severity: Minor
            Found in app/assets/javascripts/pusher.js - About 1 hr to fix

              Function send has 43 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                prototype.send = function(id, data, callback) {
                  if (this.script) {
                    return false;
                  }
              
              
              Severity: Minor
              Found in app/assets/javascripts/pusher.js - About 1 hr to fix

                Function getDefaultStrategy has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  Pusher.getDefaultStrategy = function(config) {
                    return [
                      [":def", "ws_options", {
                        hostUnencrypted: config.wsHost + ":" + config.wsPort,
                        hostEncrypted: config.wsHost + ":" + config.wssPort
                Severity: Minor
                Found in app/assets/javascripts/pusher.js - About 1 hr to fix

                  Method next_move has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def next_move(opponent_amount, level)
                      if self.current_amount == 0
                        return 0
                      elsif opponent_amount == 0
                        return 1
                  Severity: Minor
                  Found in app/models/player.rb - 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 ajax has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      ajax: function(socketId, callback){
                        var self = this, xhr;
                  
                        if (Pusher.XHR) {
                          xhr = new Pusher.XHR();
                  Severity: Minor
                  Found in app/assets/javascripts/pusher.js - About 1 hr to fix

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

                        return {
                          abort: function() {
                            runner.abort();
                          },
                          forceMinPriority: function(p) {
                    Severity: Major
                    Found in app/assets/javascripts/pusher.js and 1 other location - About 1 hr to fix
                    app/assets/javascripts/pusher.js on lines 1393..1403

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

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

                        return {
                          abort: function() {
                            runner.abort();
                          },
                          forceMinPriority: function(p) {
                    Severity: Major
                    Found in app/assets/javascripts/pusher.js and 1 other location - About 1 hr to fix
                    app/assets/javascripts/pusher.js on lines 1623..1633

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

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

                        def_transport: function(context, name, type, priority, options, manager) {
                          var transportClass = transports[type];
                          if (!transportClass) {
                            throw new Pusher.Errors.UnsupportedTransport(type);
                          }
                    Severity: Minor
                    Found in app/assets/javascripts/pusher.js - About 1 hr to fix

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

                        prototype.tryStrategy = function(strategy, minPriority, options, callback) {
                          var timer = null;
                          var runner = null;
                      
                          if (options.timeout > 0) {
                      Severity: Minor
                      Found in app/assets/javascripts/pusher.js - About 1 hr to fix

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

                            if (this.errorScript && this.errorScript.parentNode) {
                              this.errorScript.parentNode.removeChild(this.errorScript);
                              this.errorScript = null;
                            }
                        Severity: Major
                        Found in app/assets/javascripts/pusher.js and 1 other location - About 1 hr to fix
                        app/assets/javascripts/pusher.js on lines 1080..1083

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

                        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 (this.script && this.script.parentNode) {
                              this.script.parentNode.removeChild(this.script);
                              this.script = null;
                            }
                        Severity: Major
                        Found in app/assets/javascripts/pusher.js and 1 other location - About 1 hr to fix
                        app/assets/javascripts/pusher.js on lines 1084..1087

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

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

                          prototype.bindListeners = function() {
                            var self = this;
                        
                            self.onMessage = function(m) {
                              self.unbindListeners();
                        Severity: Minor
                        Found in app/assets/javascripts/pusher.js - About 1 hr to fix

                          Function createConnection has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                            prototype.createConnection = function(name, priority, key, options) {
                              var self = this;
                          
                              var options = Pusher.Util.extend({}, options, {
                                activityTimeout: self.pingDelay
                          Severity: Minor
                          Found in app/assets/javascripts/pusher.js - About 1 hr to fix

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

                              prototype.clearRetryTimer = function() {
                                if (this.retryTimer) {
                                  this.retryTimer.ensureAborted();
                                  this.retryTimer = null;
                                }
                            Severity: Major
                            Found in app/assets/javascripts/pusher.js and 1 other location - About 1 hr to fix
                            app/assets/javascripts/pusher.js on lines 3049..3054

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

                            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

                              prototype.abortConnecting = function() {
                                if (this.runner) {
                                  this.runner.abort();
                                  this.runner = null;
                                }
                            Severity: Major
                            Found in app/assets/javascripts/pusher.js and 1 other location - About 1 hr to fix
                            app/assets/javascripts/pusher.js on lines 3091..3096

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

                            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

                            Severity
                            Category
                            Status
                            Source
                            Language