concord-consortium/rigse

View on GitHub
rails/lib/clipboard.rb

Summary

Maintainability
A
1 hr
Test Coverage

Method clipboard_object_name has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def clipboard_object_name(options={})
    obj = clipboard_object(options)
    name = "(unknown object)"
    if obj
      if (obj.class.respond_to? :display_name) && obj.class.display_name
Severity: Minor
Found in rails/lib/clipboard.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 get_clipboard_object has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def get_clipboard_object(clipboard_data_type, clipboard_data_id)
    results = nil
    if clipboard_data_type && clipboard_data_type != 'null' && clipboard_data_id
      begin
        clazz = clipboard_data_type.de_clipboardify.classify.constantize
Severity: Minor
Found in rails/lib/clipboard.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

There are no issues that match your filters.

Category
Status