estepnv/fast_serializer

View on GitHub
lib/fast_serializer/json_model/attribute.rb

Summary

Maintainability
A
2 hrs
Test Coverage
A
95%

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

      def initialize(key, method, opts = {})
        super()

        @opts = opts || {}
        @injected_methods = Hash.new { |h, method_name| h[method_name] = true }
Severity: Minor
Found in lib/fast_serializer/json_model/attribute.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 call_proc_binding_to_context has 5 arguments (exceeds 4 allowed). Consider refactoring.
Wontfix

      def call_proc_binding_to_context(context, prc, arity, resource, params)
Severity: Minor
Found in lib/fast_serializer/json_model/attribute.rb - About 35 mins to fix

    Method call_method_on_context has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Wontfix

          def call_method_on_context(context, method_name, arity, resource, params)
    Severity: Minor
    Found in lib/fast_serializer/json_model/attribute.rb - About 35 mins to fix

      Method included? has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Wontfix

            def included?(resource, params, context)
              return true if !cond
      
              can_execute_on_mixin = !!(injected && cond_method_name && @injected_methods.key?(cond_method_name) && context)
      
      
      Severity: Minor
      Found in lib/fast_serializer/json_model/attribute.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

      There are no issues that match your filters.

      Category
      Status