kapost/kapost_deploy

View on GitHub
lib/kapost_deploy/plugins/notify_honeybadger_after_promote.rb

Summary

Maintainability
A
0 mins
Test Coverage

KapostDeploy::Plugins::NotifyHoneyBadgerAfterPromote#ci_sha doesn't depend on instance state (maybe move it to another class?)
Open

      def ci_sha

A Utility Function is any instance method that has no dependency on the state of the instance.

KapostDeploy::Plugins::NotifyHoneyBadgerAfterPromote#configured? performs a nil-check
Open

        !github_repo.nil? && !github_repo.empty?

A NilCheck is a type check. Failures of NilCheck violate the "tell, don't ask" principle.

Additionally, type checks often mask bigger problems in your source code like not using OOP and / or polymorphism when you should.

Example

Given

class Klass
  def nil_checker(argument)
    if argument.nil?
      puts "argument isn't nil!"
    end
  end
end

Reek would emit the following warning:

test.rb -- 1 warning:
  [3]:Klass#nil_checker performs a nil-check. (NilCheck)

KapostDeploy::Plugins::NotifyHoneyBadgerAfterPromote#github_repo performs a nil-check
Open

        git_config[:github_repo] unless git_config.nil?

A NilCheck is a type check. Failures of NilCheck violate the "tell, don't ask" principle.

Additionally, type checks often mask bigger problems in your source code like not using OOP and / or polymorphism when you should.

Example

Given

class Klass
  def nil_checker(argument)
    if argument.nil?
      puts "argument isn't nil!"
    end
  end
end

Reek would emit the following warning:

test.rb -- 1 warning:
  [3]:Klass#nil_checker performs a nil-check. (NilCheck)

Use github_repo.present? instead of !github_repo.nil? && !github_repo.empty?.
Open

        !github_repo.nil? && !github_repo.empty?

This cops checks for code that can be changed to blank?. Settings: NotNilAndNotEmpty: Convert checks for not nil and not empty? to present? NotBlank: Convert usages of not blank? to present? UnlessBlank: Convert usages of unless blank? to if present?

Example:

# NotNilAndNotEmpty: true
  # bad
  !foo.nil? && !foo.empty?
  foo != nil && !foo.empty?
  !foo.blank?

  # good
  foo.present?

# NotBlank: true
  # bad
  !foo.blank?
  not foo.blank?

  # good
  foo.present?

# UnlessBlank: true
  # bad
  something unless foo.blank?

  # good
  something if  foo.present?

There are no issues that match your filters.

Category
Status