jimmycuadra/to_lang

View on GitHub

Showing 4 of 6 total issues

Method method_missing has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    def method_missing(method, *args, &block)
      case method.to_s
      when /^to_(.*)_from_(.*)$/
        if CODEMAP[$1] && CODEMAP[$2]
          define_and_call_method(method) { translate(CODEMAP[$1], :from => CODEMAP[$2]) }
Severity: Minor
Found in lib/to_lang/translatable.rb - 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 normalize_param has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

  def normalize_param(key, value)
    param = ''
    stack = []

    if value.is_a?(Array)
Severity: Minor
Found in lib/to_lang/core_ext.rb - About 55 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 request has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def request(q, target, options = {})
      request_hash = { :key => @key, :q => q, :target => target }
      request_hash[:source] = options[:from] if options[:from]
      return request_hash if options[:debug] == :request

Severity: Minor
Found in lib/to_lang/connector.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 respond_to? has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def respond_to?(method, include_private = false)
      case method.to_s
      when /^to_(.*)_from_(.*)$/, /^from_(.*)_to_(.*)$/
        return true if CODEMAP[$1] && CODEMAP[$2]
      when /^to_(.*)$/
Severity: Minor
Found in lib/to_lang/translatable.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