joker1007/activemodel-associations

View on GitHub

Showing 4 of 4 total issues

Method add_constraints has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

      def add_constraints(scope, owner, association_klass, refl, chain_head, chain_tail)
Severity: Minor
Found in lib/active_model/associations/association_scope_extension.rb - About 45 mins to fix

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

          def compute_type(type_name)
            if type_name.match(/^::/)
              # If the type is prefixed with a scope operator then we assume that
              # the type_name is an absolute reference.
              ActiveSupport::Dependencies.constantize(type_name)
    Severity: Minor
    Found in lib/active_model/associations/override_methods.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 add_constraints has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

          def add_constraints(scope, owner, assoc_klass, refl, tracker)
    Severity: Minor
    Found in lib/active_model/associations/association_scope_extension.rb - About 35 mins to fix

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

              def create_reflection(macro, name, scope, options, active_record)
      Severity: Minor
      Found in lib/active_model/associations/active_record_reflection.rb - About 35 mins to fix
        Severity
        Category
        Status
        Source
        Language