st0012/object_tracer

View on GitHub

Showing 4 of 6 total issues

Method build_minimum_trace_point has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
Open

  def build_minimum_trace_point(event_type:)
    TracePoint.new(*event_type) do |tp|
      next unless filter_condition_satisfied?(tp)

      filepath, line_number = get_call_location(tp)
Severity: Minor
Found in lib/object_tracer.rb - About 4 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

Class ObjectTracer has 28 methods (exceeds 20 allowed). Consider refactoring.
Open

class ObjectTracer

  CALLER_START_POINT = 3
  C_CALLER_START_POINT = 2

Severity: Minor
Found in lib/object_tracer.rb - About 3 hrs to fix

    Method process_options has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

      def process_options(options)
        options[:filter_by_paths] ||= config[:filter_by_paths]
        options[:exclude_by_paths] ||= config[:exclude_by_paths]
        options[:with_trace_to] ||= config[:with_trace_to]
        options[:event_type] ||= config[:event_type]
    Severity: Minor
    Found in lib/object_tracer.rb - About 1 hr 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 collect_arguments has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

      def collect_arguments(tp)
        parameters =
          if RUBY_VERSION.to_f >= 2.6
            tp.parameters
          else
    Severity: Minor
    Found in lib/object_tracer.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

    Severity
    Category
    Status
    Source
    Language