luong-komorebi/action-mailer-kafka

View on GitHub

Showing 7 of 7 total issues

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

    def deliver!(mail)
      mail_data = construct_mail_as_kafka_message(mail)
      @kafka_publisher.publish(mail_data, construct_message_key, @mailer_topic_name)
    rescue Kafka::Error => e
      error_msg = "Fail to send email into Kafka due to: #{e.message}. Delivered using fallback method"
Severity: Minor
Found in lib/action_mailer_kafka/delivery_method.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

Unnecessary spacing detected.
Open

require ::File.expand_path('../config/environment',  __FILE__)
Severity: Minor
Found in example/config.ru by rubocop

This cop checks for extra/unnecessary whitespace.

Example:

# good if AllowForAlignment is true
name      = "RuboCop"
# Some comment and an empty line

website  += "/bbatsov/rubocop" unless cond
puts        "rubocop"          if     debug

# bad for any configuration
set_app("RuboCop")
website  = "https://github.com/bbatsov/rubocop"

Gems should be sorted in an alphabetical order within their section of the Gemfile. Gem pg should appear before rails.
Open

gem 'pg'
Severity: Minor
Found in example/Gemfile by rubocop

Gems should be alphabetically sorted within groups.

Example:

# bad
gem 'rubocop'
gem 'rspec'

# good
gem 'rspec'
gem 'rubocop'

# good
gem 'rubocop'

gem 'rspec'

# good only if TreatCommentsAsGroupSeparators is true
# For code quality
gem 'rubocop'
# For tests
gem 'rspec'

Gems should be sorted in an alphabetical order within their section of the Gemfile. Gem delayed_job_active_record should appear before figaro.
Open

gem 'delayed_job_active_record'
Severity: Minor
Found in example/Gemfile by rubocop

Gems should be alphabetically sorted within groups.

Example:

# bad
gem 'rubocop'
gem 'rspec'

# good
gem 'rspec'
gem 'rubocop'

# good
gem 'rubocop'

gem 'rspec'

# good only if TreatCommentsAsGroupSeparators is true
# For code quality
gem 'rubocop'
# For tests
gem 'rspec'

Unnecessary spacing detected.
Open

gem 'spring',        group: :development
Severity: Minor
Found in example/Gemfile by rubocop

This cop checks for extra/unnecessary whitespace.

Example:

# good if AllowForAlignment is true
name      = "RuboCop"
# Some comment and an empty line

website  += "/bbatsov/rubocop" unless cond
puts        "rubocop"          if     debug

# bad for any configuration
set_app("RuboCop")
website  = "https://github.com/bbatsov/rubocop"

Prefer single-quoted strings when you don't need string interpolation or special symbols.
Open

gem "figaro"
Severity: Minor
Found in example/Gemfile by rubocop

Checks if uses of quotes match the configured preference.

Example: EnforcedStyle: single_quotes (default)

# bad
"No special symbols"
"No string interpolation"
"Just text"

# good
'No special symbols'
'No string interpolation'
'Just text'
"Wait! What's #{this}!"

Example: EnforcedStyle: double_quotes

# bad
'Just some text'
'No special chars or interpolation'

# good
"Just some text"
"No special chars or interpolation"
"Every string in #{project} uses double_quotes"

Gems should be sorted in an alphabetical order within their section of the Gemfile. Gem action_mailer_kafka should appear before delayed_job_active_record.
Open

gem 'action_mailer_kafka', path: '../'
Severity: Minor
Found in example/Gemfile by rubocop

Gems should be alphabetically sorted within groups.

Example:

# bad
gem 'rubocop'
gem 'rspec'

# good
gem 'rspec'
gem 'rubocop'

# good
gem 'rubocop'

gem 'rspec'

# good only if TreatCommentsAsGroupSeparators is true
# For code quality
gem 'rubocop'
# For tests
gem 'rspec'
Severity
Category
Status
Source
Language