3scale/porta

View on GitHub
app/lib/api_docs/account_data.rb

Summary

Maintainability
A
0 mins
Test Coverage

ApiDocs::AccountData#as_json performs a nil-check
Open

      @account.nil? ? return_error : return_account_data
Severity: Minor
Found in app/lib/api_docs/account_data.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)

ApiDocs::AccountData#as_json has unused parameter 'options'
Open

    def as_json(options = {})
Severity: Minor
Found in app/lib/api_docs/account_data.rb by reek

Unused Parameter refers to methods with parameters that are unused in scope of the method.

Having unused parameters in a method is code smell because leaving dead code in a method can never improve the method and it makes the code confusing to read.

Example

Given:

class Klass
  def unused_parameters(x,y,z)
    puts x,y # but not z
  end
end

Reek would emit the following warning:

[2]:Klass#unused_parameters has unused parameter 'z' (UnusedParameters)

There are no issues that match your filters.

Category
Status