MiniProfiler/rack-mini-profiler

View on GitHub

Showing 151 of 176 total issues

Avoid deeply nested control flow statements.
Open

                if (this.readyState == 4) {
                  var stringIds = this.getResponseHeader("X-MiniProfiler-Ids");

                  if (stringIds) {
                    var ids = stringIds.split(",");
Severity: Major
Found in lib/html/includes.js - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

                    if (this.miniprofiler.prev_onreadystatechange !== null)
                      return this.miniprofiler.prev_onreadystatechange.apply(
                        this,
                        arguments
                      );
    Severity: Major
    Found in lib/html/includes.js - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                  if (k < 0) a = p;else {
                    for (--k; (k = p.indexOf("&#", k + 1)) >= 0;) {
                      var e = p.indexOf(";", k);
      
                      if (e >= 0) {
      Severity: Major
      Found in lib/html/vendor.js - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                      if (p = m.a) {
                        c = m.b;
        
                        if ("XMP" === c.tagName) {
                          d = document.createElement("PRE");
        Severity: Major
        Found in lib/html/pretty-print.js - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                        for (var r = [], j = n; --j >= 0;) {
                          r[j] = l[j];
                        }
          Severity: Major
          Found in lib/html/vendor.js - About 45 mins to fix

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

              def self.other_patches
                patches = []
                patches << 'mongo' if defined?(Mongo::Server::Connection) && Mongo.class == Module
                patches << 'moped' if defined?(Moped::Node) && Moped::Node.class == Class
                patches << 'plucky' if defined?(Plucky::Query) && Plucky::Query.class == Class
            Severity: Minor
            Found in lib/patches/sql_patches.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

            Consider simplifying this complex logical expression.
            Open

                      if (!(s < 65 || g > 122)) {
                        s < 65 || g > 90 || a.push([Math.max(65, g) | 32, Math.min(s, 90) | 32]);
                        s < 97 || g > 122 || a.push([Math.max(97, g) & -33, Math.min(s, 122) & -33]);
                      }
            Severity: Major
            Found in lib/html/pretty-print.js - About 40 mins to fix

              Consider simplifying this complex logical expression.
              Open

                        if (!(s < 65 || g > 122)) {
                          s < 65 || g > 90 || a.push([Math.max(65, g) | 32, Math.min(s, 90) | 32]);
                          s < 97 || g > 122 || a.push([Math.max(97, g) & -33, Math.min(s, 122) & -33]);
                        }
              Severity: Major
              Found in lib/html/vendor.js - About 40 mins to fix

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

                  def exec_insert(sql, name, binds, pk = nil, sequence_name = nil)
                Severity: Minor
                Found in lib/patches/db/oracle_enhanced.rb - About 35 mins to fix

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

                        def cleanup_cache
                          files = Dir.entries(@path)
                          @timer_struct_lock.synchronize {
                            files.each do |f|
                              f = @path + '/' + f
                  Severity: Minor
                  Found in lib/mini_profiler/storage/file_store.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 sql_patches has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def self.sql_patches
                      patches = []
                  
                      patches << 'mysql2' if defined?(Mysql2::Client) && Mysql2::Client.class == Class && patch_rails?
                      patches << 'pg' if defined?(PG::Result) && PG::Result.class == Class && patch_rails?
                  Severity: Minor
                  Found in lib/patches/sql_patches.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 rails_route_from_path has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def rails_route_from_path(path, method)
                        if defined?(Rails) && defined?(ActionController::RoutingError)
                          hash = Rails.application.routes.recognize_path(path, method: method)
                          if hash && hash[:controller] && hash[:action]
                            "#{hash[:controller]}##{hash[:action]}"
                  Severity: Minor
                  Found in lib/mini_profiler.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 record_sql has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                        def record_sql(query, elapsed_ms, params = nil)
                          return unless current && current.current_timer
                          c = current
                          c.current_timer.add_sql(
                            redact_sql_queries? ? nil : query,
                  Severity: Minor
                  Found in lib/mini_profiler/profiling_methods.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 method.
                  Open

                          return client_settings.handle_cookie(dump_exceptions exceptions)
                  Severity: Major
                  Found in lib/mini_profiler.rb - About 30 mins to fix

                    Avoid too many return statements within this method.
                    Open

                            return client_settings.handle_cookie(self.flamegraph(flamegraph, path, env))
                    Severity: Major
                    Found in lib/mini_profiler.rb - About 30 mins to fix

                      Avoid too many return statements within this method.
                      Open

                              return tool_disabled_message(client_settings) if !advanced_debugging_enabled?
                      Severity: Major
                      Found in lib/mini_profiler.rb - About 30 mins to fix

                        Avoid too many return statements within this method.
                        Open

                                    return client_settings.handle_cookie(
                                      text_result(message, status: status, headers: headers)
                                    )
                        Severity: Major
                        Found in lib/mini_profiler.rb - About 30 mins to fix

                          Avoid too many return statements within this method.
                          Open

                                  return client_settings.handle_cookie(analyze_memory)
                          Severity: Major
                          Found in lib/mini_profiler.rb - About 30 mins to fix

                            Avoid too many return statements within this method.
                            Open

                                    return client_settings.handle_cookie(dump_env env)
                            Severity: Major
                            Found in lib/mini_profiler.rb - About 30 mins to fix

                              Avoid too many return statements within this method.
                              Open

                                      return client_settings.handle_cookie(help(client_settings, env))
                              Severity: Major
                              Found in lib/mini_profiler.rb - About 30 mins to fix
                                Severity
                                Category
                                Status
                                Source
                                Language