View on GitHub

Showing 2 of 2 total issues

Method included has 42 lines of code (exceeds 25 allowed). Consider refactoring.

      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
Severity: Minor
Found in lib/super_module/v1.rb - About 1 hr to fix

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

          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(",") {|arg, i| i == 0 ? arg : arg.split("=").first}.join(",")
    Severity: Minor
    Found in lib/super_module/v1/module_body_method_call_recorder.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