alainravet/private_please

View on GitHub

Showing 4 of 4 total issues

Method format has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

      def self.format(cur_tpd)
        class_and_method = cur_tpd.method_full_name
        if @prev_cur_tpd.nil?
          same_object_id = same_lineno = false
        else
Severity: Minor
Found in lib/private_please/tracking/debug/trace_point_data_logger.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 format has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      def self.format(cur_tpd)
        class_and_method = cur_tpd.method_full_name
        if @prev_cur_tpd.nil?
          same_object_id = same_lineno = false
        else
Severity: Minor
Found in lib/private_please/tracking/debug/trace_point_data_logger.rb - About 1 hr to fix

    Method source_path_and_lineno has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

          def source_path_and_lineno(klass, separator, method)
            is_instance_method = separator == '#'
            if klass.instance_of?(Module)
              if is_instance_method
                klass.instance_method(method).source_location
    Severity: Minor
    Found in lib/private_please/utils/source_file_utils.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

    Method method_full_name has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

          def method_full_name
            defined_class_s = defined_class.to_s
            is_module_class_method = defined_class_s.start_with?('#<Class:')
            if is_module_class_method
              defined_class_s.gsub!(/^#<Class:/, '').delete!('>')
    Severity: Minor
    Found in lib/private_please/tracking/trace_point_details.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