datamolecule/door_mat

View on GitHub

Showing 34 of 79 total issues

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

    def self.load_token(token, request, verbose=true)
      token = token.to_s.strip
      if DoorMat::Regex.session_guid.match(token).blank?
        DoorMat.configuration.logger.warn "WARN: #{request.remote_ip} Attempted to use token with invalid format #{token}" if verbose
        return nil
Severity: Minor
Found in app/models/door_mat/access_token.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 create has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def create
      before_sign_up
      @sign_up = DoorMat::SignUp.new(sign_up_params)
      sign_up_failed = true

Severity: Minor
Found in app/controllers/door_mat/sign_up_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 around_save has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

      def around_save(record)
        return yield if DoorMat::Crypto.current_skip_crypto_callback.skip?

        clear_attribute = record.send("#{@attribute}")
        actor = record.send("#{@actor_column}")
Severity: Minor
Found in lib/door_mat/attr_asymmetric_store.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 with has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

      def self.with(email, password, is_public, remember_me, request, cookies)
Severity: Minor
Found in lib/door_mat/process/actor_sign_in.rb - About 45 mins to fix

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

          def self.with(address, password, request, cookies, controller)
    Severity: Minor
    Found in lib/door_mat/process/actor_sign_up.rb - About 35 mins to fix

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

            def self.add(email, actor, controller)
              return false unless email.valid?
      
              actor.with_lock do
                return false unless actor.can_add_email? email
      Severity: Minor
      Found in lib/door_mat/process/manage_email.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 with has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

            def self.with(address, password, request, cookies, controller)
              # 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_up.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 set_primary has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

            def self.set_primary(encoded_address, actor)
              actor.with_lock do
                email = actor.email_from_urlsafe_encoded(encoded_address)
                return false if email.blank?
      
      
      Severity: Minor
      Found in lib/door_mat/process/manage_email.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

      Avoid too many return statements within this method.
      Open

                  return nil
      Severity: Major
      Found in app/models/door_mat/session.rb - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

                return access_token
        Severity: Major
        Found in app/models/door_mat/access_token.rb - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                  return access_token
          Severity: Major
          Found in app/models/door_mat/access_token.rb - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                    return false
            Severity: Major
            Found in lib/door_mat/process/reset_password.rb - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

                          return nil
              Severity: Major
              Found in app/models/door_mat/session.rb - About 30 mins to fix

                Method owned_by has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                      def self.owned_by(owner)
                        password = DoorMat::Crypto::SymmetricStore.random_key
                        anonymous_actor = Actor.create_with(password)
                        return nil if anonymous_actor.blank?
                
                
                Severity: Minor
                Found in lib/door_mat/process/create_new_anonymous_actor.rb - 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