sumoners/dm_courier

View on GitHub

Showing 5 of 21 total issues

Method constantize has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
Open

    def constantize(service_name)
      camel_cased_word = "DMCourier::Services::#{service_name.to_s.tr('_', ' ').split.map(&:capitalize).join('')}"
      names = camel_cased_word.split("::")

      Object.const_get(camel_cased_word) if names.empty?
Severity: Minor
Found in lib/dm_courier/service_locator.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 call has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

    def call(opts)
      method = opts[:method]
      path = opts[:path]
      body_values = opts[:body_values] || {}
      query_params = opts[:query_values] || {}
Severity: Minor
Found in lib/monkey_patch/sparkpost/client.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 sparkpost_message has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

      def sparkpost_message
        parameters = extract_params(nil_true_false: { inline_css: :inline_css,
                                                      click_tracking: :track_clicks,
                                                      open_tracking: :track_opens },
                                    string: { return_path: :return_path_domain,
Severity: Minor
Found in lib/dm_courier/services/sparkpost.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 attachments has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

      def attachments(filter = {})
        Enumerator.new do |y|
          attachments = mail.attachments
          attachments = if filter[:inline]
                          attachments.select(&:inline?)
Severity: Minor
Found in lib/dm_courier/message_helper.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 sparkpost_message has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      def sparkpost_message
        parameters = extract_params(nil_true_false: { inline_css: :inline_css,
                                                      click_tracking: :track_clicks,
                                                      open_tracking: :track_opens },
                                    string: { return_path: :return_path_domain,
Severity: Minor
Found in lib/dm_courier/services/sparkpost.rb - About 1 hr to fix
    Severity
    Category
    Status
    Source
    Language