binarylogic/authlogic

View on GitHub

Showing 13 of 13 total issues

Class Base has 163 methods (exceeds 20 allowed). Consider refactoring.
Open

    class Base
      extend ActiveModel::Naming
      extend ActiveModel::Translation
      extend Authlogic::Config
      include ActiveSupport::Callbacks
Severity: Major
Found in lib/authlogic/session/base.rb - About 3 days to fix

    File base.rb has 1043 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    require "request_store"
    
    module Authlogic
      module Session
        module Activation
    Severity: Major
    Found in lib/authlogic/session/base.rb - About 2 days to fix

      Method credentials= has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
      Open

            def credentials=(value)
              normalized = Array.wrap(value)
              if normalized.first.class.name == "ActionController::Parameters"
                raise TypeError, E_AC_PARAMETERS
              end
      Severity: Minor
      Found in lib/authlogic/session/base.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

      Method credentials= has 31 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

            def credentials=(value)
              normalized = Array.wrap(value)
              if normalized.first.class.name == "ActionController::Parameters"
                raise TypeError, E_AC_PARAMETERS
              end
      Severity: Minor
      Found in lib/authlogic/session/base.rb - About 1 hr to fix

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

                  def valid_password?(
                    attempted_password,
                    check_against_database = check_passwords_against_database?
                  )
                    crypted = crypted_password_to_validate_against(check_against_database)
        Severity: Minor
        Found in lib/authlogic/acts_as_authentic/password.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

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

        module Authlogic
          # The acts_as_authentic method has a crypto_provider option. This allows you
          # to use any type of encryption you like. Just create a class with a class
          # level encrypt and matches? method. See example below.
          #
        Severity: Major
        Found in lib/authlogic/crypto_providers/sha256.rb and 2 other locations - About 55 mins to fix
        lib/authlogic/crypto_providers/md5.rb on lines 5..31
        lib/authlogic/crypto_providers/sha512.rb on lines 5..33

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

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

        module Authlogic
          module CryptoProviders
            # SHA-512 does not have any practical known attacks against it. However,
            # there are better choices. We recommend transitioning to a more secure,
            # adaptive hashing algorithm, like scrypt.
        Severity: Major
        Found in lib/authlogic/crypto_providers/sha512.rb and 2 other locations - About 55 mins to fix
        lib/authlogic/crypto_providers/md5.rb on lines 5..31
        lib/authlogic/crypto_providers/sha256.rb on lines 5..54

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

        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

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

              def save
                result = nil
                if valid?
                  self.record = attempted_record
        
        
        Severity: Minor
        Found in lib/authlogic/session/base.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

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

        module Authlogic
          module CryptoProviders
            # A poor choice. There are known attacks against this algorithm.
            class MD5
              # V2 hashes the digest bytes in repeated stretches instead of hex characters.
        Severity: Major
        Found in lib/authlogic/crypto_providers/md5.rb and 2 other locations - About 55 mins to fix
        lib/authlogic/crypto_providers/sha256.rb on lines 5..54
        lib/authlogic/crypto_providers/sha512.rb on lines 5..33

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

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

        module Authlogic
          module CryptoProviders
            class Sha512
              # SHA-512 does not have any practical known attacks against it. However,
              # there are better choices. We recommend transitioning to a more secure,
        Severity: Major
        Found in lib/authlogic/crypto_providers/sha512/v2.rb and 2 other locations - About 45 mins to fix
        lib/authlogic/crypto_providers/md5/v2.rb on lines 5..29
        lib/authlogic/crypto_providers/sha256/v2.rb on lines 5..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 41.

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

        module Authlogic
          module CryptoProviders
            class MD5
              # A poor choice. There are known attacks against this algorithm.
              class V2
        Severity: Major
        Found in lib/authlogic/crypto_providers/md5/v2.rb and 2 other locations - About 45 mins to fix
        lib/authlogic/crypto_providers/sha256/v2.rb on lines 5..52
        lib/authlogic/crypto_providers/sha512/v2.rb on lines 5..33

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

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

        module Authlogic
          # The acts_as_authentic method has a crypto_provider option. This allows you
          # to use any type of encryption you like. Just create a class with a class
          # level encrypt and matches? method. See example below.
          #
        Severity: Major
        Found in lib/authlogic/crypto_providers/sha256/v2.rb and 2 other locations - About 45 mins to fix
        lib/authlogic/crypto_providers/md5/v2.rb on lines 5..29
        lib/authlogic/crypto_providers/sha512/v2.rb on lines 5..33

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

        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

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

              def define_login_field_methods
                return unless login_field
                self.class.send(:attr_writer, login_field) unless respond_to?("#{login_field}=")
                self.class.send(:attr_reader, login_field) unless respond_to?(login_field)
              end
        Severity: Minor
        Found in lib/authlogic/session/base.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