3scale/porta

View on GitHub

Showing 5,267 of 5,597 total issues

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

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

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

BackendProviderSyncWorker#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.

ThreeScale::Swagger::Specification::VBase 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.

DataExportsWorker takes parameters ['period', 'type'] to 3 methods
Open

  def perform(provider_id, recipient_id, type, period)
    provider  = Account.providers_with_master.find(provider_id)
    recipient = User.find(recipient_id)

    if provider.provider_can_use?(:new_notification_system)
Severity: Minor
Found in app/workers/data_exports_worker.rb by reek

In general, a Data Clump occurs when the same two or three items frequently appear together in classes and parameter lists, or when a group of instance variable names start or end with similar substrings.

The recurrence of the items often means there is duplicate code spread around to handle them. There may be an abstraction missing from the code, making the system harder to understand.

Example

Given

class Dummy
  def x(y1,y2); end
  def y(y1,y2); end
  def z(y1,y2); end
end

Reek would emit the following warning:

test.rb -- 1 warning:
  [2, 3, 4]:Dummy takes parameters [y1, y2] to 3 methods (DataClump)

A possible way to fix this problem (quoting from Martin Fowler):

The first step is to replace data clumps with objects and use the objects whenever you see them. An immediate benefit is that you'll shrink some parameter lists. The interesting stuff happens as you begin to look for behavior to move into the new objects.

ThreeScale::Swagger::Specification::VInvalid 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#config doesn't depend on instance state (maybe move it to another class?)
Open

  def config
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.

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

  def perform(provider, previous_state)

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

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

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

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

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

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

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

NotificationMailer#event_class 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)

ThreeScale::OAuth2::Auth0Client#kind doesn't depend on instance state (maybe move it to another class?)
Open

      def kind

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

ThreeScale::OAuth2::RedhatCustomerPortalClient::ImplicitFlow has missing safe method 'validate_state!'
Open

        def validate_state!(request)

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::Rake::RemoveDupUsageLimits#duplicated_usage_limits is a writable attribute
Open

      attr_accessor :duplicated_usage_limits

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)

ThreeScale::RedisConfig has missing safe method 'apply_sentinels_config!'
Open

    def apply_sentinels_config!(config)
Severity: Minor
Found in app/lib/three_scale/redis_config.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.

DataExportsWorker has missing safe method 'publish_event!'
Open

  def publish_event!(provider, recipient, type, period)
Severity: Minor
Found in app/workers/data_exports_worker.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.

ThreeScale::Swagger::Validator#validate_specification doesn't depend on instance state (maybe move it to another class?)
Open

      def validate_specification record

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

NotificationMailer#hidden 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)

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

  def perform(class_name)

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

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

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

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

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

  def master_on_premises?
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.

Severity
Category
Status
Source
Language