dominicsayers/name_tamer

View on GitHub
lib/name_tamer/name.rb

Summary

Maintainability
C
1 day
Test Coverage

Class Name has 32 methods (exceeds 20 allowed). Consider refactoring.
Open

  class Name
    # References:
    # http://www.w3.org/International/questions/qa-personal-names
    # https://github.com/berkmancenter/namae
    # https://github.com/mericson/people
Severity: Minor
Found in lib/name_tamer/name.rb - About 4 hrs to fix

Method remove_adfixes has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
Open

    def remove_adfixes
      if @last_name.nil?
        # Our name is still in one part, not two
        loop do
          @nice_name = remove_outermost_adfix(:suffix, @nice_name)
Severity: Minor
Found in lib/name_tamer/name.rb - About 3 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 contact_type_from has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def contact_type_from(args)
      args_ct = args[:contact_type]
      return unless args_ct

      ct = args_ct.is_a?(Symbol) ? args_ct : args_ct.dup
Severity: Minor
Found in lib/name_tamer/name.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 remove_middle_names has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def remove_middle_names
      return unless @contact_type == :person

      first_name, parts = find_first_usable_name(@simple_name.split)
      last_name, = find_last_usable_name(parts)
Severity: Minor
Found in lib/name_tamer/name.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 name_wrangle_single_name has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def name_wrangle_single_name
      lowercase = @nice_name.downcase
      uppercase = @nice_name.upcase
      fix_case = false

Severity: Minor
Found in lib/name_tamer/name.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

There are no issues that match your filters.

Category
Status