Showing 2 of 2 total issues
Method included
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def included(original_base)
# TODO maybe avoid class_eval by extending/including instead
original_base.class_eval do
extend SuperModule::V1::ModuleBodyMethodCallRecorder
extend SuperModule::V1::SingletonMethodDefinitionStore
Method __singleton_method_call_recorder
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
Open
def __singleton_method_call_recorder(method_name, method_args)
unless __super_module_singleton_methods_excluded_from_call_recording.include?(method_name)
method_call_recorder_args = "'#{method_name}'"
method_call_recorder_args << ", #{method_args}" unless method_args.to_s.strip == ''
method_call_recorder_args = method_call_recorder_args.split(",").each_with_index.map {|arg, i| i == 0 ? arg : arg.split("=").first}.join(",")
- Read upRead up
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"