3scale/porta

View on GitHub

Showing 5,267 of 5,597 total issues

ActivationReminderWorker#perform doesn't depend on instance state (maybe move it to another class?)
Open

  def perform(user_id)

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

ThreeScale::Search::Scopes::ClassMethods#table_and_column performs a nil-check
Open

        if table.present? && column.nil?
Severity: Minor
Found in app/lib/three_scale/search.rb by reek

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)

ThreeScale::Swagger::Specification::V10 has missing safe method 'validate!'
Open

        def validate!

A candidate method for the Missing Safe Method smell are methods whose names end with an exclamation mark.

An exclamation mark in method names means (the explanation below is taken from here ):

The ! in method names that end with ! means, “This method is dangerous”—or, more precisely, this method is the “dangerous” version of an otherwise equivalent method, with the same name minus the !. “Danger” is relative; the ! doesn’t mean anything at all unless the method name it’s in corresponds to a similar but bang-less method name. So, for example, gsub! is the dangerous version of gsub. exit! is the dangerous version of exit. flatten! is the dangerous version of flatten. And so forth.

Such a method is called Missing Safe Method if and only if her non-bang version does not exist and this method is reported as a smell.

Example

Given

class C
  def foo; end
  def foo!; end
  def bar!; end
end

Reek would report bar! as Missing Safe Method smell but not foo!.

Reek reports this smell only in a class context, not in a module context in order to allow perfectly legit code like this:

class Parent
  def foo; end
end

module Dangerous
  def foo!; end
end

class Son < Parent
  include Dangerous
end

class Daughter < Parent
end

In this example, Reek would not report the Missing Safe Method smell for the method foo of the Dangerous module.

ThreeScale#master_billing_enabled? doesn't depend on instance state (maybe move it to another class?)
Open

  def master_billing_enabled?
Severity: Minor
Found in app/lib/three_scale.rb by reek

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

ThreeScale::XML::Builder has missing safe method 'tag!'
Open

      def tag!(*args, &block)
Severity: Minor
Found in app/lib/three_scale/xml/builder.rb by reek

A candidate method for the Missing Safe Method smell are methods whose names end with an exclamation mark.

An exclamation mark in method names means (the explanation below is taken from here ):

The ! in method names that end with ! means, “This method is dangerous”—or, more precisely, this method is the “dangerous” version of an otherwise equivalent method, with the same name minus the !. “Danger” is relative; the ! doesn’t mean anything at all unless the method name it’s in corresponds to a similar but bang-less method name. So, for example, gsub! is the dangerous version of gsub. exit! is the dangerous version of exit. flatten! is the dangerous version of flatten. And so forth.

Such a method is called Missing Safe Method if and only if her non-bang version does not exist and this method is reported as a smell.

Example

Given

class C
  def foo; end
  def foo!; end
  def bar!; end
end

Reek would report bar! as Missing Safe Method smell but not foo!.

Reek reports this smell only in a class context, not in a module context in order to allow perfectly legit code like this:

class Parent
  def foo; end
end

module Dangerous
  def foo!; end
end

class Son < Parent
  include Dangerous
end

class Daughter < Parent
end

In this example, Reek would not report the Missing Safe Method smell for the method foo of the Dangerous module.

BackendRandomDataGeneratorWorker#perform doesn't depend on instance state (maybe move it to another class?)
Open

  def perform(options)

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

CMS::UpgradeContentWorker#on_success doesn't depend on instance state (maybe move it to another class?)
Open

  def on_success(_, options)

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

PersistEventWorker#perform doesn't depend on instance state (maybe move it to another class?)
Open

  def perform(event_attrs)
Severity: Minor
Found in app/workers/persist_event_worker.rb by reek

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

ReverseProviderKeyWorker#perform doesn't depend on instance state (maybe move it to another class?)
Open

  def perform(provider_id)

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

BackendStorageRewriteWorker#perform doesn't depend on instance state (maybe move it to another class?)
Open

  def perform(class_name, ids)

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

NotificationMailer#abilities is a writable attribute
Open

    attr_accessor :event_class, :hidden, :abilities, :hidden_om
Severity: Minor
Found in app/mailers/notification_mailer.rb by reek

A class that publishes a setter for an instance variable invites client classes to become too intimate with its inner workings, and in particular with its representation of state.

The same holds to a lesser extent for getters, but Reek doesn't flag those.

Example

Given:

class Klass
  attr_accessor :dummy
end

Reek would emit the following warning:

reek test.rb

test.rb -- 1 warning:
  [2]:Klass declares the writable attribute dummy (Attribute)

EventsFetchWorker#perform doesn't depend on instance state (maybe move it to another class?)
Open

  def perform
Severity: Minor
Found in app/workers/events_fetch_worker.rb by reek

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

RenameServiceNotifications#self.up performs a nil-check
Open

      notification.reject! { |key,value| value.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)

ChangeHashValuesInSystemOperation#down doesn't depend on instance state (maybe move it to another class?)
Open

  def down

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

AddUniqueIndexToConnectors#self.up performs a nil-check
Open

      unless row[3].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)

EventsTenantIdShouldNotBeMaster#up doesn't depend on instance state (maybe move it to another class?)
Open

  def up

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

AddIndexToAlertsOnAlertId#index_options doesn't depend on instance state (maybe move it to another class?)
Open

  def index_options

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

BackfillTitlesCMSSections#up doesn't depend on instance state (maybe move it to another class?)
Open

  def up

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

hour_selector doesn't depend on instance state (maybe move it to another class?)
Open

def hour_selector

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

ChangeHashValuesInSystemOperation#up doesn't depend on instance state (maybe move it to another class?)
Open

  def up

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

Severity
Category
Status
Source
Language