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
- Create a ticketCreate a ticket
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)
- Read upRead up
- Create a ticketCreate a ticket
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
- Read upRead up
- Create a ticketCreate a ticket
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)
- Read upRead up
- Create a ticketCreate a ticket
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
- Read upRead up
- Create a ticketCreate a ticket
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"