pboling/rack-insight

View on GitHub

Showing 94 of 116 total issues

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

Avoid deeply nested control flow statements.
Open

                            if ( !jQuery.event.special[type] || jQuery.event.special[type].teardown.call(elem, namespaces) === false ) {
                                if (elem.removeEventListener)
                                    elem.removeEventListener(type, jQuery.data(elem, "handle"), false);
                                else if (elem.detachEvent)
                                    elem.detachEvent("on" + type, jQuery.data(elem, "handle"));
Severity: Major
Found in lib/rack/insight/public/__insight__/jquery-1.3.2.js - About 45 mins to fix

    Function ATTR has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

            ATTR: function(match, curLoop, inplace, result, not, isXML){
    Severity: Minor
    Found in lib/rack/insight/public/__insight__/jquery-1.3.2.js - About 45 mins to fix

      Function dirCheck has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      function dirCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) {
      Severity: Minor
      Found in lib/rack/insight/public/__insight__/jquery-1.3.2.js - About 45 mins to fix

        Consider simplifying this complex logical expression.
        Open

                if ( s.dataType == "script" && type == "GET" && parts
                    && ( parts[1] && parts[1] != location.protocol || parts[2] != location.host )){
        
                    var head = document.getElementsByTagName("head")[0];
                    var script = document.createElement("script");
        Severity: Major
        Found in lib/rack/insight/public/__insight__/jquery-1.3.2.js - About 40 mins to fix

          Method request_finish has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              def request_finish(env, status, headers, body, timing)
          Severity: Minor
          Found in lib/rack/insight/panels/templates_panel.rb - About 35 mins to fix

            Function prop has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                prop: function( elem, value, type, i, name ) {
            Severity: Minor
            Found in lib/rack/insight/public/__insight__/jquery-1.3.2.js - About 35 mins to fix

              Method initialize has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                    def initialize(path, args, time, backtrace = [], result=nil)
              Severity: Minor
              Found in lib/rack/insight/panels/active_resource_panel/query.rb - About 35 mins to fix

                Method request_finish has 5 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                    def request_finish(env, status, headers, body, timing)
                Severity: Minor
                Found in lib/rack/insight/panels/redis_panel.rb - About 35 mins to fix

                  Method request_finish has 5 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                      def request_finish(env, status, headers, body, timing)
                  Severity: Minor
                  Found in lib/rack/insight/panels/sphinx_panel.rb - About 35 mins to fix

                    Method request_finish has 5 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                          def request_finish(env, status, headers, body, timing)
                    Severity: Minor
                    Found in lib/rack/insight/panels/speedtracer_panel/tracer.rb - About 35 mins to fix

                      Function PSEUDO has 5 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                              PSEUDO: function(match, curLoop, inplace, result, not){
                      Severity: Minor
                      Found in lib/rack/insight/public/__insight__/jquery-1.3.2.js - About 35 mins to fix

                        Method request_finish has 5 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                            def request_finish(env, status, headers, body, timing)
                        Severity: Minor
                        Found in lib/rack/insight/panels/active_record_panel.rb - About 35 mins to fix

                          Method request_finish has 5 arguments (exceeds 4 allowed). Consider refactoring.
                          Open

                              def request_finish(env, st, hd, bd, timing)
                          Severity: Minor
                          Found in lib/rack/insight/panels/cache_panel.rb - About 35 mins to fix

                            Method send_message_with_safe_check_with_insight has 5 arguments (exceeds 4 allowed). Consider refactoring.
                            Open

                                def send_message_with_safe_check_with_insight(operation, message, db_name, log_message=nil, last_error_params=false)
                            Severity: Minor
                            Found in lib/rack/insight/panels/mongo_panel/mongo_extension.rb - About 35 mins to fix

                              Method request_finish has 5 arguments (exceeds 4 allowed). Consider refactoring.
                              Open

                                  def request_finish(env, status, headers, body, timing)
                              Severity: Minor
                              Found in lib/rack/insight/instrumentation/client.rb - About 35 mins to fix

                                Method compiled_source has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                Open

                                    def compiled_source(filename)
                                      templates = []
                                      templates << ::File.join(::File.dirname(__FILE__), "views/#{filename}.html.erb")
                                      if self.class.respond_to?(:template_root) && !self.class.template_root.nil?
                                        # Push onto the front of the array to try because if there is a template root it is the most likely place to find the view.
                                Severity: Minor
                                Found in lib/rack/insight/render.rb - About 35 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 before has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                Open

                                    def before(env)
                                      super
                                      tracer = env['st.tracer']
                                      Kernel::set_trace_func proc {|event, file, line, name, binding,classname|
                                        case event
                                Severity: Minor
                                Found in lib/rack/insight/panels/speedtracer_panel/profiling.rb - About 35 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 configure has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                Open

                                    def self.configure &block
                                      yield @config
                                      logger.debug("Rack::Insight::Config#configure:\n  called from: #{caller[0]}\n  with: #{@config}") if config[:verbosity] == true || config[:verbosity].respond_to?(:<) && config[:verbosity] <= 1
                                      @logger = config[:logger]
                                      if @logger.nil?
                                Severity: Minor
                                Found in lib/rack/insight/config.rb - About 35 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

                                Avoid too many return statements within this function.
                                Open

                                                        return ( diff % first == 0 && diff / first >= 0 );
                                Severity: Major
                                Found in lib/rack/insight/public/__insight__/jquery-1.3.2.js - About 30 mins to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language