axsh/wakame-dolphin

View on GitHub

Showing 5 of 5 total issues

Method put_event has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

    def put_event(event_object)
      logger :info, "Worker put events #{event_object}"

      notification_id = event_object[:notification_id]
      message_template_id = event_object[:message_type]
Severity: Minor
Found in lib/dolphin/worker.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 put_event has 53 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def put_event(event_object)
      logger :info, "Worker put events #{event_object}"

      notification_id = event_object[:notification_id]
      message_template_id = event_object[:message_type]
Severity: Major
Found in lib/dolphin/worker.rb - About 2 hrs to fix

    Method template has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

          def template(template_id)
            load_target_templates = []
    
            if Dolphin.settings['template'] && Dolphin.settings['template'].has_key?('template_path')
              load_target_templates << File.join(File.expand_path(Dolphin.settings['template']['template_path']), 'email')
    Severity: Minor
    Found in lib/dolphin/message_builder.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 build has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

          def build(template_id, params)
            message = ''
    
            if template_id.blank?
              template_id = 'default'
    Severity: Minor
    Found in lib/dolphin/message_builder.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 connect has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

          def connect
            begin
              if @connection.nil?
                @connection = ::Cassandra.new(@keyspace, seeds)
    
    
    Severity: Minor
    Found in lib/dolphin/data_stores/cassandra.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