3scale/porta

View on GitHub

Showing 5,267 of 5,597 total issues

Fields::BaseField#required is a writable attribute
Open

  attr_accessor :name, :label, :type, :required, :choices, :hint, :hidden, :options
Severity: Minor
Found in app/lib/fields/base_field.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)

PaymentGateways::PaymentGatewayCrypt#test? doesn't depend on instance state (maybe move it to another class?)
Open

    def test?

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

Fields::BaseField#hint is a writable attribute
Open

  attr_accessor :name, :label, :type, :required, :choices, :hint, :hidden, :options
Severity: Minor
Found in app/lib/fields/base_field.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)

Fields::Extensions::AssociationCollectionExtension#modify_attributes_with_fields performs a nil-check
Open

      attributes = attributes.nil? ? {} : attributes.dup
Severity: Minor
Found in app/lib/fields/extensions.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)

Finance::Builder::XmlMarkup#account! doesn't depend on instance state (maybe move it to another class?)
Open

  def account!(xml, name, account, address = nil)
Severity: Minor
Found in app/lib/finance/builder/xml_markup.rb by reek

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

Finance::Builder::XmlMarkup#date! doesn't depend on instance state (maybe move it to another class?)
Open

  def date!(xml, name, value)
Severity: Minor
Found in app/lib/finance/builder/xml_markup.rb by reek

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

Events::Importers::FirstDailyTrafficImporter has missing safe method 'save!'
Open

      def save!

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.

Logic::ProviderSignup::SampleData has missing safe method 'create!'
Open

      def create!
Severity: Minor
Found in app/lib/logic/provider_signup.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.

Logic::ProviderSignup::SampleData has missing safe method 'create_application_plan!'
Open

      def create_application_plan!(name, features: [])
Severity: Minor
Found in app/lib/logic/provider_signup.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.

Messenger::MessageLiquidizer#file_system doesn't depend on instance state (maybe move it to another class?)
Open

    def file_system

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

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

  def normalize_path(old_path)
Severity: Minor
Found in app/lib/normalize_path_attribute.rb by reek

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

PaymentGateways::BuyerReferences::ClassMethods#buyer_reference doesn't depend on instance state (maybe move it to another class?)
Open

      def buyer_reference(account, provider)

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

Fields::BaseField#type is a writable attribute
Open

  attr_accessor :name, :label, :type, :required, :choices, :hint, :hidden, :options
Severity: Minor
Found in app/lib/fields/base_field.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)

Logic::RollingUpdates::Features::Base#enabled? performs a nil-check
Open

          when nil
Severity: Minor
Found in app/lib/logic/rolling_updates.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)

BackendClient::Application::Utilization::Collection inherits from core class 'Array'
Open

      class Collection < Array

Subclassing core classes in Ruby can lead to unexpected side effects.

Knowing that Ruby has a core library, which is written in C, and a standard library, which is written in Ruby, if you do not know exactly how these core classes operate at the C level, you are gonna have a bad time.

Source: http://words.steveklabnik.com/beware-subclassing-ruby-core-classes

Fields::BaseField#choices is a writable attribute
Open

  attr_accessor :name, :label, :type, :required, :choices, :hint, :hidden, :options
Severity: Minor
Found in app/lib/fields/base_field.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)

Finance::Builder::XmlMarkup has missing safe method 'account!'
Open

  def account!(xml, name, account, address = nil)
Severity: Minor
Found in app/lib/finance/builder/xml_markup.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.

Logic::ProviderSignup::SampleData has missing safe method 'create_active_docs_service!'
Open

      def create_active_docs_service!
Severity: Minor
Found in app/lib/logic/provider_signup.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.

BackendClient::Request#default_options doesn't depend on instance state (maybe move it to another class?)
Open

    def default_options
Severity: Minor
Found in app/lib/backend_client/request.rb by reek

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

EventStore::Repository::Facade::InvalidEventError#record is a writable attribute
Open

        attr_accessor :record
Severity: Minor
Found in app/lib/event_store/repository.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)
Severity
Category
Status
Source
Language