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 (!ba.test(m)) if (ca.test(m)) {
                  f.push(m.substring(9, m.length - 3));
                  n += m.length - 12;
                } else if (da.test(m)) {
                  f.push("\n");
    Severity: Major
    Found in lib/html/pretty-print.js - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                    if ((a.tagName === "pre" || a.tagName === "code" || a.tagName === "xmp") && a.className && a.className.indexOf("prettyprint") >= 0) {
                      d = true;
                      break;
                    }
      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

        Avoid deeply nested control flow statements.
        Open

                      if (K) {
                        d = a.innerHTML;
                        if ("XMP" === a.tagName) d = y(d);else {
                          a = a;
                          if ("PRE" === a.tagName) a = true;else if (ka.test(d)) {
        Severity: Major
        Found in lib/html/pretty-print.js - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                        for (h = 0; h < l; ++h) {
                          g = f[h];
          
                          if (e = a.match(g[1])) {
                            k = g[0];
          Severity: Major
          Found in lib/html/pretty-print.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

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

                    def merge!(config)
                      if config
                        if Hash === config
                          config.each { |k, v| instance_variable_set "@#{k}", v }
                        else
              Severity: Minor
              Found in lib/mini_profiler/config.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

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

                    def has_valid_cookie?
                      valid_cookie = !@cookie.nil?
              
                      if (MiniProfiler.config.authorization_mode == :allow_authorized) && valid_cookie
                        begin
              Severity: Minor
              Found in lib/mini_profiler/client_settings.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

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

                def on_query(env)
                  if SqlPatches.should_measure?
                    not_indexed = env[:criteria] && env[:criteria].where_present? &&
                                      !env[:criteria].where_indexed? &&
                                      !env[:criteria].model.try(:perf_warnings_disabled)
              Severity: Minor
              Found in lib/patches/db/nobrainer.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

                            for (h = 0; h < l; ++h) {
                              g = f[h];
              
                              if (e = a.match(g[1])) {
                                k = g[0];
              Severity: Major
              Found in lib/html/vendor.js - About 45 mins to fix

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

                          def symbolize_hash(hash)
                            new_hash = {}
                            hash.each do |k, v|
                              sym_k = String === k ? k.to_sym : k
                              if Hash === v
                Severity: Minor
                Found in lib/mini_profiler/timer_struct/page.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

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

                    def inject(fragment, script)
                      # find explicit or implicit body
                      index = fragment.rindex(/<\/body>/i) || fragment.rindex(/<\/html>/i)
                      if index
                        # if for whatever crazy reason we dont get a utf string,
                Severity: Minor
                Found in lib/mini_profiler.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

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

                  Avoid deeply nested control flow statements.
                  Open

                              if (!ba.test(m)) if (ca.test(m)) {
                                f.push(m.substring(9, m.length - 3));
                                n += m.length - 12;
                              } else if (da.test(m)) {
                                f.push("\n");
                  Severity: Major
                  Found in lib/html/vendor.js - About 45 mins to fix

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

                          def set_unviewed(user, id)
                            @client.add("#{@prefix}-#{user}-v", [], @expires_in_seconds)
                            MAX_RETRIES.times do
                              break if @client.cas("#{@prefix}-#{user}-v", @expires_in_seconds) do |ids|
                                ids << id unless ids.include?(id)
                    Severity: Minor
                    Found in lib/mini_profiler/storage/memcache_store.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 ((a.tagName === "pre" || a.tagName === "code" || a.tagName === "xmp") && a.className && a.className.indexOf("prettyprint") >= 0) {
                                    d = true;
                                    break;
                                  }
                    Severity: Major
                    Found in lib/html/pretty-print.js - About 45 mins to fix

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

                        def execute_with_profiling(client, request_context)
                          return execute_without_profiling(client, request_context) unless SqlPatches.should_measure?
                      
                          start        = Process.clock_gettime(Process::CLOCK_MONOTONIC)
                          result       = execute_without_profiling(client, request_context)
                      Severity: Minor
                      Found in lib/patches/db/rsolr.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

                                } else if ("\\" === g.charAt(0)) if ((g = +g.substring(1)) && g <= h) d[e] = "\\" + k[h];
                      Severity: Major
                      Found in lib/html/pretty-print.js - About 45 mins to fix

                        Avoid deeply nested control flow statements.
                        Open

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