3scale/porta

View on GitHub
config/initializers/rails_sqli.rb

Summary

Maintainability
A
0 mins
Test Coverage

RailsSQLiFix#sanitize_actioncontroller_parameters manually dispatches method call
Open

    result = attributes.respond_to?(:to_unsafe_h) ? attributes.to_unsafe_h : attributes
Severity: Minor
Found in config/initializers/rails_sqli.rb by reek

Reek reports a Manual Dispatch smell if it finds source code that manually checks whether an object responds to a method before that method is called. Manual dispatch is a type of Simulated Polymorphism which leads to code that is harder to reason about, debug, and refactor.

Example

class MyManualDispatcher
  attr_reader :foo

  def initialize(foo)
    @foo = foo
  end

  def call
    foo.bar if foo.respond_to?(:bar)
  end
end

Reek would emit the following warning:

test.rb -- 1 warning:
  [9]: MyManualDispatcher manually dispatches method call (ManualDispatch)

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.

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.

RailsSQLiFix#action_controller_parameters_in? has the variable name 'v'
Open

    ActionController::Parameters === attributes || attributes.any?{|_k,v| ActionController::Parameters === v }
Severity: Minor
Found in config/initializers/rails_sqli.rb by reek

An Uncommunicative Variable Name is a variable name that doesn't communicate its intent well enough.

Poor names make it hard for the reader to build a mental picture of what's going on in the code. They can also be mis-interpreted; and they hurt the flow of reading, because the reader must slow down to interpret the names.

There are no issues that match your filters.

Category
Status