bensomers/scrap

View on GitHub

Showing 6 of 6 total issues

Method gc_stats has 66 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def self.gc_stats   
    collected = nil
    puts "Respond to? #{ObjectSpace.respond_to? :live_objects}"
    if ObjectSpace.respond_to? :live_objects
      live = ObjectSpace.live_objects
Severity: Major
Found in lib/scrap.rb - About 2 hrs to fix

    Method gc_stats has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

      def self.gc_stats   
        collected = nil
        puts "Respond to? #{ObjectSpace.respond_to? :live_objects}"
        if ObjectSpace.respond_to? :live_objects
          live = ObjectSpace.live_objects
    Severity: Minor
    Found in lib/scrap.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 call has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

      def self.call(env)
        if !@@gc_stats_enabled
          GC.enable_stats if GC.respond_to? :enable_stats # for REE
          GC::Profiler.enable if defined? GC::Profiler # for 1.9.3+
          @@gc_stats_enabled = true
    Severity: Minor
    Found in lib/scrap.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 add_os has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

      def self.add_os(c, s, options = {})
        print_objects = options["print_objects"]
        small = options["small"]
        min = options["min"]
        show_fields = options["show_fields"]
    Severity: Minor
    Found in lib/scrap.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 memcheck has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

      def self.memcheck(top, klass = Object, mode = :normal)
        top ||= 50
        os = Hash.new(0)
        ObjectSpace.each_object(klass) do |o|
          begin;
    Severity: Minor
    Found in lib/scrap.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 add_os has 29 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def self.add_os(c, s, options = {})
        print_objects = options["print_objects"]
        small = options["small"]
        min = options["min"]
        show_fields = options["show_fields"]
    Severity: Minor
    Found in lib/scrap.rb - About 1 hr to fix
      Severity
      Category
      Status
      Source
      Language