dimelo/faye-authentication

View on GitHub

Showing 8 of 12 total issues

File faye-authentication.js has 371 lines of code (exceeds 250 allowed). Consider refactoring.
Open

function FayeAuthentication(client, endpoint, options) {
  this._client = client;
  this._endpoint = endpoint || '/faye/auth';
  this._signatures = {};
  this._outbox = {};
Severity: Minor
Found in app/assets/javascripts/faye-authentication.js - About 4 hrs to fix

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

    FayeAuthentication.prototype.resolveWaitingSignatures = function() {
      if (this._waiting_signatures.length == 0) {
        return ;
      }
      var self = this;
    Severity: Minor
    Found in app/assets/javascripts/faye-authentication.js - About 1 hr to fix

      Function signMessage has 29 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      FayeAuthentication.prototype.signMessage = function(message, callback) {
        var channel = message.subscription || message.channel;
        var clientId = message.clientId;
      
        var self = this;
      Severity: Minor
      Found in app/assets/javascripts/faye-authentication.js - About 1 hr to fix

        Method prepare_request has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

              def self.prepare_request(uri, channel, data, key, options = {})
        Severity: Minor
        Found in lib/faye/authentication/http_client.rb - About 35 mins to fix

          Method publish has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

                def self.publish(url, channel, data, key, options = {})
          Severity: Minor
          Found in lib/faye/authentication/http_client.rb - About 35 mins to fix

            Method authentication_required? has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

                def self.authentication_required?(message, options = {})
                  subscription_or_channel = message['subscription'] || message['channel']
                  return false if message['channel'].nil?
                  return false unless (message['channel'].start_with?('/meta/subscribe') || (!(message['channel'].start_with?('/meta/'))))
                  whitelist_proc = options[:whitelist]
            Severity: Minor
            Found in lib/faye/authentication.rb - 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

            Method incoming has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

                  def incoming(message, callback)
                    if Faye::Authentication.authentication_required?(message, @options)
                      begin
                        Faye::Authentication.validate(message['signature'],
                                                      message['subscription'] || message['channel'],
            Severity: Minor
            Found in lib/faye/authentication/server_extension.rb - 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 authentication_required has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

            FayeAuthentication.prototype.authentication_required = function(message) {
              var subscription_or_channel = message.subscription || message.channel;
              if (message.channel.lastIndexOf('/meta/subscribe') === 0 || message.channel.lastIndexOf('/meta/', 0) !== 0) {
                if(this._options.whitelist) {
                  try {
            Severity: Minor
            Found in app/assets/javascripts/faye-authentication.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