binarylogic/authlogic

View on GitHub
lib/authlogic/session/base.rb

Summary

Maintainability
F
6 days
Test Coverage

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

        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

        There are no issues that match your filters.

        Category
        Status