tbpgr/tbpgr_utils

View on GitHub

Showing 12 of 37 total issues

Method get_brothers has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def get_brothers(person)
      ret = []
      tmp_family = family.dup
      person.parent_ids.each do |parent_id|
        tmp_family.each do |v|
Severity: Minor
Found in lib/familyable/familynize.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 setting_variables_code has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

  def setting_variables_code(variables)
    fail TypeError, "invalid type #{variables.class}. you have to use Array" unless variables.is_a? Array
    variables.reduce([]) do |ret, variable|
      fail TypeError, "invalid type #{variable.class}. you have to use Hash" unless variable.is_a? Hash
      fail TypeError, 'invalid hash. you have to set Hash[:name]' if variable[:name].nil?
Severity: Minor
Found in lib/eval_helper/set_variables_code.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 to_heading has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def to_heading
      self_chars = chars
      level, index, word_ret, ret = 0, 0, [], []
      self_chars.each_with_index do |v, index|
        key_word = v.in? %w(> + ^)
Severity: Minor
Found in lib/open_classes/string/heading_helper.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 must_impl has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def must_impl(*methods)
      return if methods.nil?
      fail TypeError, "invalid args type #{methods.class}. you must use Array or Symbol" unless methods.class.any_of? Array, Symbol
      methods = (methods.class.is_a? Symbol) ? [methods] : methods
      methods.each do |method_name|
Severity: Minor
Found in lib/template_methodable.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 together_fill has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  def together_fill(fill_value = nil, &block)
    if_not_contain_array_rails_type_error
    if block
      fill_value = 0 if fill_value.nil?
      first.each_with_index do |i_v, i|
Severity: Minor
Found in lib/open_classes/array/together_fill.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 start_match has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  def start_match(proc)
    @tournament.reverse_each.with_index do |outer, outer_index|
      outer.reverse_each.with_index do |inner, inner_index|
        next if inner_index.odd?
        next if inner_index == outer.size - 1
Severity: Minor
Found in lib/simple_tournament.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 to_html_table has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def to_html_table(options = { no_header: false })
    options[:no_header] = false if options[:no_header].nil?
    cnt = options[:no_header] ? 1 : 0
    ret = reduce(['<table>']) do |rets, lines|
      ret = lines.reduce([]) do |ret, column|
Severity: Minor
Found in lib/open_classes/array/to_html_table.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 first_attr has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def first_attr(attribute, method_name, *args, &block)
      col = collection
      return [] if col.empty?
      first_size = args.size == 0 ? nil : Integer(args.first)
      fail ArgumentError, "invalid attribute #{attribute}" unless include_attr?(col.first, attribute)
Severity: Minor
Found in lib/attr_enumerable/first_attr.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 last_attr has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def last_attr(attribute, method_name, *args, &block)
      col = collection
      return [] if col.empty?
      last_size = args.size == 0 ? nil : Integer(args.last)
      fail ArgumentError, "invalid attribute #{attribute}" unless include_attr?(col.last, attribute)
Severity: Minor
Found in lib/attr_enumerable/last_attr.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 slice_attr has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def slice_attr(attribute, method_name, *args, &block)
      check_argument_length(*args)
      col = collection
      index_or_range = args.first
      length = args.size > 1 ? args[1] : nil
Severity: Minor
Found in lib/attr_enumerable/slice_attr.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 exchange! has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def exchange!(one_index, other_index)
    return self unless one_index.respond_to? :to_i
    return self unless other_index.respond_to? :to_i
    one_index = one_index.to_i
    other_index = other_index.to_i
Severity: Minor
Found in lib/open_classes/array/exchange.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 link has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def self.link(label, url)
    label = '' if label.nil?
    url = '' if url.nil?
    return label unless label.is_a?(String)
    return url unless url.is_a?(String)
Severity: Minor
Found in lib/markdown/link.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