3scale/porta

View on GitHub

Showing 5,267 of 5,597 total issues

Liquid::Template::FallbackResolver#build_path doesn't depend on instance state (maybe move it to another class?)
Open

      def build_path(name, prefix, partial)

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

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

    def call(worker_class, msg, *)

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

ThreeScale::Metrics::Yabeda#event_status_code_class performs a nil-check
Open

          code = if event.payload[:status].nil? && event.payload[:exception].present?
Severity: Minor
Found in lib/three_scale/metrics/yabeda.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)

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

  def current_user
Severity: Minor
Found in lib/tracking_notifications.rb by reek

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

Arel::Visitors takes parameters ['collector', 'o'] to 4 methods
Open

      def visit_Arel_Nodes_In(o, collector)
        strip_order_from_select(o)

        super
      end
Severity: Minor
Found in lib/arel/visitors/oracle12_hack.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::SidekiqRetrySupport::Middleware#call doesn't depend on instance state (maybe move it to another class?)
Open

      def call(worker, msg, *)

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

Liquid::Tags::InternalError#render doesn't depend on instance state (maybe move it to another class?)
Open

      def render(context)

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

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

    def current_user
Severity: Minor
Found in config/initializers/audited_hacks.rb by reek

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

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

  def sanitize_actioncontroller_parameters(attributes)
Severity: Minor
Found in config/initializers/rails_sqli.rb by reek

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

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

def sanitize_redis_config(cfg)
Severity: Minor
Found in config/initializers/sidekiq.rb by reek

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

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

  def report_and_supress_exceptions
Severity: Minor
Found in lib/exception_reporting.rb by reek

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

clause performs a nil-check
Open

        table_name  = (model.nil? ? adapter.quoted_table_name   : model.quoted_table_name)
        column_name = (model.nil? ? adapter.quote(@column.to_s) : model.connection.quote_column_name(@column.to_s))
Severity: Minor
Found in config/initializers/oracle.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)

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

  def action_controller_parameters_in?(attributes)
Severity: Minor
Found in config/initializers/rails_sqli.rb by reek

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

Line contains inconsistent indentation
Open

          values = {type: key, items: values, description: ThreeScaleAutoComplete.TipDescriptions[key]}

AuditedHacks::InstanceMethods#write_audit performs a nil-check
Open

          attrs[:associated] = send(audit_associated_with) unless audit_associated_with.nil?
Severity: Minor
Found in config/initializers/audited_hacks.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)

Line contains inconsistent indentation
Open

          values = {type: key, items: values, description: ThreeScaleAutoComplete.TipDescriptions[key]}

Identical blocks of code found in 2 locations. Consider refactoring.
Open

  def slice_and_use_defaults(params, *allowed)
    options = super(params, *allowed)

    return options unless options.key?(:metric_name)

Severity: Minor
Found in app/controllers/stats/api/backend_apis_controller.rb and 1 other location - About 25 mins to fix
app/controllers/stats/data/backend_apis_controller.rb on lines 19..27

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 29.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Identical blocks of code found in 2 locations. Consider refactoring.
Open

  def slice_and_use_defaults(params, *allowed)
    options = super(params, *allowed)

    return options unless options.key?(:metric_name)

Severity: Minor
Found in app/controllers/stats/data/backend_apis_controller.rb and 1 other location - About 25 mins to fix
app/controllers/stats/api/backend_apis_controller.rb on lines 16..24

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 29.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 3 locations. Consider refactoring.
Open

  def rejected(account)
    self.provider_account = account.provider_account

    headers('Return-Path' => from_address(account),
            'X-SMTPAPI' => '{"category": "Account rejected"}')
Severity: Minor
Found in app/mailers/account_mailer.rb and 2 other locations - About 25 mins to fix
app/mailers/account_mailer.rb on lines 11..22
app/mailers/account_mailer.rb on lines 26..37

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 29.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 3 locations. Consider refactoring.
Open

  def approved(account)
    self.provider_account = account.provider_account

    headers('Return-Path' => from_address(account),
            'X-SMTPAPI' => '{"category": "Account approved"}')
Severity: Minor
Found in app/mailers/account_mailer.rb and 2 other locations - About 25 mins to fix
app/mailers/account_mailer.rb on lines 11..22
app/mailers/account_mailer.rb on lines 41..52

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 29.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Severity
Category
Status
Source
Language