pboling/rack-insight

View on GitHub

Showing 116 of 116 total issues

Avoid too many return statements within this function.
Open

            return attr === null ? undefined : attr;
Severity: Major
Found in lib/rack/insight/public/__insight__/jquery-1.3.2.js - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

                return elem.filter && elem.filter.indexOf("opacity=") >= 0 ?
                    (parseFloat( elem.filter.match(/opacity=([^)]*)/)[1] ) / 100) + '':
                    "";
    Severity: Major
    Found in lib/rack/insight/public/__insight__/jquery-1.3.2.js - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

              return this.setArray(jQuery.isArray( selector ) ?
                  selector :
                  jQuery.makeArray(selector));
      Severity: Major
      Found in lib/rack/insight/public/__insight__/jquery-1.3.2.js - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

                        return jQuery.attr( elem.style, "cssText", value );
        Severity: Major
        Found in lib/rack/insight/public/__insight__/jquery-1.3.2.js - About 30 mins to fix

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

                      left = box.left + (self.pageXOffset || jQuery.boxModel && docElem.scrollLeft || body.scrollLeft) - clientLeft;
          Severity: Minor
          Found in lib/rack/insight/public/__insight__/jquery-1.3.2.js and 1 other location - About 30 mins to fix
          lib/rack/insight/public/__insight__/jquery-1.3.2.js on lines 4178..4178

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 45.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Avoid too many return statements within this function.
          Open

                          return (elem.value || "").replace(/\r/g, "");
          Severity: Major
          Found in lib/rack/insight/public/__insight__/jquery-1.3.2.js - About 30 mins to fix

            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

              Avoid too many return statements within this function.
              Open

                          return undefined;
              Severity: Major
              Found in lib/rack/insight/public/__insight__/jquery-1.3.2.js - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                                        return true;
                Severity: Major
                Found in lib/rack/insight/public/__insight__/jquery-1.3.2.js - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                                          return diff == 0;
                  Severity: Major
                  Found in lib/rack/insight/public/__insight__/jquery-1.3.2.js - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                            return elem[ name ];
                    Severity: Major
                    Found in lib/rack/insight/public/__insight__/jquery-1.3.2.js - About 30 mins to fix

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

                            def symbolize_hash(hash)
                              symbolled_hash = {}
                              hash.each_key do |key|
                                if String === key
                                  next if hash.has_key?(key.to_sym)
                      Severity: Minor
                      Found in lib/rack/insight/panels/speedtracer_panel/tracer.rb - About 25 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

                      Similar blocks of code found in 2 locations. Consider refactoring.
                      Open

                            def encode_value(value)
                              Base64.encode64(YAML.dump(value))
                            rescue Exception => ex
                              wrapped = EncodingError.new(ex, "Rack::Insight::Database#encode_value failed with error: ")
                              logger.error(wrapped)
                      Severity: Minor
                      Found in lib/rack/insight/database.rb and 1 other location - About 25 mins to fix
                      lib/rack/insight/database.rb on lines 230..236

                      Duplicated Code

                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                      Tuning

                      This issue has a mass of 30.

                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                      Refactorings

                      Further Reading

                      Similar blocks of code found in 2 locations. Consider refactoring.
                      Open

                            def decode_value(value)
                              YAML.load(Base64.decode64(value))
                            rescue Exception => ex
                              wrapped = DecodingError.new(ex, "Rack::Insight::Database#decode_value failed with error: ")
                              logger.error(wrapped)
                      Severity: Minor
                      Found in lib/rack/insight/database.rb and 1 other location - About 25 mins to fix
                      lib/rack/insight/database.rb on lines 222..228

                      Duplicated Code

                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                      Tuning

                      This issue has a mass of 30.

                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                      Refactorings

                      Further Reading

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

                          def initialize(app)
                      
                            # Call super before setting up probes in case there are any custom probes configured
                            super # will setup custom probes
                      
                      
                      Severity: Minor
                      Found in lib/rack/insight/panels/log_panel.rb - About 25 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 delete_cache_list has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                            def delete_cache_list
                              validate_params
                              raise "Rails not found... can't delete key" unless defined?(Rails)
                      
                              params.each do |key, value|
                      Severity: Minor
                      Found in lib/rack/insight/panels/cache_panel/panel_app.rb - About 25 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

                      Severity
                      Category
                      Status
                      Source
                      Language