pboling/rack-insight

View on GitHub
lib/rack/insight/panel.rb

Summary

Maintainability
D
1 day
Test Coverage

Class Panel has 31 methods (exceeds 20 allowed). Consider refactoring.
Open

  class Panel
    include ERB::Util
    include Rack::Insight::Logging
    include Rack::Insight::Render
    include Rack::Insight::Database::RequestDataClient
Severity: Minor
Found in lib/rack/insight/panel.rb - About 3 hrs to fix

    Method content_for_request has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
    Open

        def content_for_request(number)
          logger.info("Rack::Insight is using default content_for_request for #{self.class}") if verbose(:med)
          if !self.has_table?
            logger.info("#{self.class} is being used without a table") if verbose(:med)
            content
    Severity: Minor
    Found in lib/rack/insight/panel.rb - About 3 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

    Method current_panel_file has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
    Open

          def current_panel_file(sub)
            file_name = nil
            matched_line = nil
            caller.each do |line|
              # First make sure we are not matching rack-insight's own panel class, which will be in the caller stack,
    Severity: Minor
    Found in lib/rack/insight/panel.rb - About 3 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

    Method heading_for_request has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

        def heading_for_request(number)
          if !self.has_table?
            heading
          else
            num = count(number)
    Severity: Minor
    Found in lib/rack/insight/panel.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 initialize has 33 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def initialize(app)
          if panel_app
            #XXX use mappings
            @app = Rack::Cascade.new([panel_app, app])
          else
    Severity: Minor
    Found in lib/rack/insight/panel.rb - About 1 hr to fix

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

          def initialize(app)
            if panel_app
              #XXX use mappings
              @app = Rack::Cascade.new([panel_app, app])
            else
      Severity: Minor
      Found in lib/rack/insight/panel.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

      Method from_file has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

            def from_file(rel_path)
              old_rel, Thread::current['rack-panel_file'] = Thread::current['rack-panel_file'], rel_path
              num_load_paths_to_check = Rack::Insight::Config.config[:panel_load_paths].length
              Rack::Insight::Config.config[:panel_load_paths].each_with_index do |load_path, index|
                begin
      Severity: Minor
      Found in lib/rack/insight/panel.rb - About 45 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

      There are no issues that match your filters.

      Category
      Status