datamolecule/door_mat

View on GitHub

Showing 34 of 79 total issues

Class Session has 28 methods (exceeds 20 allowed). Consider refactoring.
Open

  class Session < ActiveRecord::Base

    belongs_to :actor
    belongs_to :email

Severity: Minor
Found in app/models/door_mat/session.rb - About 3 hrs to fix

    Method with has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
    Open

          def self.with(actor, new_password, old_password='', save_session=true)
            actor.with_lock do
    
              unless old_password.nil?
                return false unless actor.authenticate(old_password)
    Severity: Minor
    Found in lib/door_mat/process/actor_password_change.rb - About 3 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

    Class AccessToken has 25 methods (exceeds 20 allowed). Consider refactoring.
    Open

      class AccessToken < ActiveRecord::Base
    
        include DoorMat::AttrSymmetricStore
    
        belongs_to :actor, class_name: 'DoorMat::Actor'
    Severity: Minor
    Found in app/models/door_mat/access_token.rb - About 2 hrs to fix

      Method create_from_params has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
      Open

          def self.create_from_params(token_for, identifier, confirm_identifier, name, is_public, remember_me, request)
            clear_current_access_token
            is_public = '1' == is_public.to_s
            remember_me = '1' == remember_me.to_s
      
      
      Severity: Minor
      Found in app/models/door_mat/access_token.rb - 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

      Method validate_token has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
      Open

          def self.validate_token(token, cookies, request)
            access_token = load_token(token, request)
      
            access_token = case
              when access_token.blank?
      Severity: Minor
      Found in app/models/door_mat/access_token.rb - 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

      Method initialize has 49 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def initialize
            @mailer_from_address = "noreply@example.com"
      
            # Controllers that require_password_reconfirm will only
            # allow the user in without requesting an additional sign-in if the user password
      Severity: Minor
      Found in lib/door_mat/configuration.rb - About 1 hr to fix

        Method from has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
        Open

            def self.from(cookies, request)
              clear_current_session
              session_guid = cookies.encrypted[:session_guid].to_s.strip
              session_key = cookies.encrypted[:session_key].to_s.strip
        
        
        Severity: Minor
        Found in app/models/door_mat/session.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

        Method create_from_params has 44 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            def self.create_from_params(token_for, identifier, confirm_identifier, name, is_public, remember_me, request)
              clear_current_access_token
              is_public = '1' == is_public.to_s
              remember_me = '1' == remember_me.to_s
        
        
        Severity: Minor
        Found in app/models/door_mat/access_token.rb - About 1 hr to fix

          Method with has 40 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                def self.with(actor, new_password, old_password='', save_session=true)
                  actor.with_lock do
          
                    unless old_password.nil?
                      return false unless actor.authenticate(old_password)
          Severity: Minor
          Found in lib/door_mat/process/actor_password_change.rb - About 1 hr to fix

            Method from has 40 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                def self.from(cookies, request)
                  clear_current_session
                  session_guid = cookies.encrypted[:session_guid].to_s.strip
                  session_key = cookies.encrypted[:session_key].to_s.strip
            
            
            Severity: Minor
            Found in app/models/door_mat/session.rb - About 1 hr to fix

              Method swap_token! has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
              Open

                  def self.swap_token!(cookies, valid_current_session_tokens, new_session_token, force_new_token_generation = false)
                    access_token = current_access_token
              
                    # Our current access token is in order
                    return unless access_token.valid?
              Severity: Minor
              Found in app/models/door_mat/access_token.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

              Method validate_token has 39 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  def self.validate_token(token, cookies, request)
                    access_token = load_token(token, request)
              
                    access_token = case
                      when access_token.blank?
              Severity: Minor
              Found in app/models/door_mat/access_token.rb - About 1 hr to fix

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

                    def process_token_request(token_for, token, klass = DoorMat::AccessToken)
                      klass.destroy_if_linked_to(cookies)
                      @access_token = nil
                
                      token_for_symbol = token_for.to_s.strip.to_sym
                Severity: Minor
                Found in app/controllers/door_mat/password_less_session_controller.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

                Method with has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                Open

                      def self.with(email, password, is_public, remember_me, request, cookies)
                        # Destroy any session linked to existing cookies before
                        # replacing it by a new session
                        DoorMat::Session.destroy_if_linked_to(cookies)
                
                
                Severity: Minor
                Found in lib/door_mat/process/actor_sign_in.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

                Method swap_token! has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    def self.swap_token!(cookies, valid_current_session_tokens, new_session_token, force_new_token_generation = false)
                      access_token = current_access_token
                
                      # Our current access token is in order
                      return unless access_token.valid?
                Severity: Minor
                Found in app/models/door_mat/access_token.rb - About 1 hr to fix

                  Method attr_symmetric_store has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                  Open

                        def attr_symmetric_store(*args, **options)
                          return unless self.table_exists?
                  
                          actor_column = options.fetch(:actor_column, :actor).to_s
                          unless self.attribute_names.include? "#{actor_column}_id"
                  Severity: Minor
                  Found in lib/door_mat/attr_symmetric_store.rb - 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

                  Method attr_asymmetric_store has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                  Open

                        def attr_asymmetric_store(*args, **options)
                          return unless self.table_exists?
                  
                          actor_column = options.fetch(:actor_column, :actor).to_s
                          unless self.attribute_names.include? "#{actor_column}_id"
                  Severity: Minor
                  Found in lib/door_mat/attr_asymmetric_store.rb - 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

                  Method create_from_params has 7 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                      def self.create_from_params(token_for, identifier, confirm_identifier, name, is_public, remember_me, request)
                  Severity: Major
                  Found in app/models/door_mat/access_token.rb - About 50 mins to fix

                    Method confirm_email has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def confirm_email
                          before_confirm_email
                    
                          actor = DoorMat::Session.current_session.actor
                          token = params[:token]
                    Severity: Minor
                    Found in app/controllers/door_mat/activities_controller.rb - 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

                    Method protected_by_password_less_session has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def protected_by_password_less_session(pls_symbols)
                          pls_symbols = Array(pls_symbols)
                          redirect_url = send("#{pls_symbols.first}_url".to_sym)
                    
                          if DoorMat::AccessToken.is_cookie_present? cookies
                    Severity: Minor
                    Found in lib/door_mat/controller.rb - 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

                    Severity
                    Category
                    Status
                    Source
                    Language