3scale/porta

View on GitHub
lib/tasks/provider_stats.rb

Summary

Maintainability
A
0 mins
Test Coverage

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

def days_since(time)
Severity: Minor
Found in lib/tasks/provider_stats.rb by reek

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

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

def last_admin_access_of(provider)
Severity: Minor
Found in lib/tasks/provider_stats.rb by reek

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

days_since performs a nil-check
Open

  return -1 if time.nil?
Severity: Minor
Found in lib/tasks/provider_stats.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)

last_admin_access_of has the variable name 'u'
Open

  provider.users.impersonation_admins.map{|u| u.user_sessions.last.try!(:accessed_at)}.compact.max
Severity: Minor
Found in lib/tasks/provider_stats.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