Showing 5 of 5 total issues

Function watch has 51 lines of code (exceeds 25 allowed). Consider refactoring.
Open

gon.watch = function(name, possibleOptions, possibleCallback, possibleErrorCallback) {
  var callback, errorCallback, key, options, performAjax, timer, value, _base, _ref;
  if (typeof $ === "undefined" || $ === null) {
    return;
  }
Severity: Major
Found in js/watch.js - About 2 hrs to fix

    Function watch has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

    gon.watch = function(name, possibleOptions, possibleCallback, possibleErrorCallback) {
      var callback, errorCallback, key, options, performAjax, timer, value, _base, _ref;
      if (typeof $ === "undefined" || $ === null) {
        return;
      }
    Severity: Minor
    Found in js/watch.js - 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 convert_hash_keys has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

          def convert_hash_keys(value, current_depth, max_depth)
            return value if current_depth > (max_depth.is_a?(Symbol) ? 1000 : max_depth)
    
            case value
            when Hash
    Severity: Minor
    Found in lib/gon/base.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 method_missing has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def method_missing(method, *args, &block)
          if method.to_s =~ /=$/
            if public_method_name?(method)
              raise "You can't use Gon public methods for storing data: #{method}"
            end
    Severity: Minor
    Found in lib/gon.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 parse_options_from has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

          def parse_options_from(args, global)
            if old_api? args
              unless global
                text =  "[DEPRECATION] view_path argument is now optional. "
                text << "If you need to specify it, "
    Severity: Minor
    Found in lib/gon/rabl.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