hbakhtiyor/rcore-ext

View on GitHub

Showing 5 of 7 total issues

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

  def deep_compact!(option = nil)
    @option = option; changed = false
    each_pair do |key, value|
      (changed = true unless key.deep_compact!(option).nil?)   if key.is_a?(Hash)
      (changed = true unless value.deep_compact!(option).nil?) if value.is_a?(Hash)
Severity: Minor
Found in lib/rcore_ext/hash/compact.rb - About 2 hrs 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 deep_compact! has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

  def deep_compact!
    index = 0; changed = false
    while size > index
      item = at(index)
      (changed = true unless item.deep_compact!.nil?) if item.is_a?(Array)
Severity: Minor
Found in lib/rcore_ext/array/compact.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 deep_compact has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def deep_compact(option = nil)
    @option = option
    result = {}
    each_pair do |key, value|
      key   = key.deep_compact(option)    if key.is_a?(Hash)
Severity: Minor
Found in lib/rcore_ext/hash/compact.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 encode_string has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def encode_string(format, options={})
    raise ArgumentError, "Format can't be empty" if format.nil?
    format = format.to_sym
    @options = options || {}

Severity: Minor
Found in lib/rcore_ext/string/format.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 decode_string has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def decode_string(format, options={})
    raise ArgumentError, "Format can't be empty" if format.nil? 
    format = format.to_sym    
    @options = options || {}

Severity: Minor
Found in lib/rcore_ext/string/format.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