Showing 5,267 of 5,597 total issues
Liquid::Filters::RailsHelpers#pluralize doesn't depend on instance state (maybe move it to another class?) Open
def pluralize(text)
- Read upRead up
- Exclude checks
A Utility Function is any instance method that has no dependency on the state of the instance.
Liquid::Forms::Base#object_param_name doesn't depend on instance state (maybe move it to another class?) Open
def object_param_name(model)
- Read upRead up
- Exclude checks
A Utility Function is any instance method that has no dependency on the state of the instance.
Liquid::Tags::Debug#html_comment doesn't depend on instance state (maybe move it to another class?) Open
def html_comment(*texts)
- Read upRead up
- Exclude checks
A Utility Function is any instance method that has no dependency on the state of the instance.
Liquid::Docs::Registration#registered is a writable attribute Open
attr_accessor :registered
- Read upRead up
- Exclude checks
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)
Liquid::Tags::PageSubSection#render doesn't depend on instance state (maybe move it to another class?) Open
def render(context)
- Read upRead up
- Exclude checks
A Utility Function is any instance method that has no dependency on the state of the instance.
Liquid::Template::Resolver#cms is a writable attribute Open
attr_accessor :cms
- Read upRead up
- Exclude checks
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)
Liquid::Tags#register doesn't depend on instance state (maybe move it to another class?) Open
def register(klass, template)
- Read upRead up
- Exclude checks
A Utility Function is any instance method that has no dependency on the state of the instance.
TrackingNotifications#raise_exceptions? doesn't depend on instance state (maybe move it to another class?) Open
def raise_exceptions?
- Read upRead up
- Exclude checks
A Utility Function is any instance method that has no dependency on the state of the instance.
ThreeScale::Middleware::Multitenant::TenantChecker has missing safe method 'verify!' Open
def verify!(object)
- Read upRead up
- Exclude checks
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.
Liquid::Tags::Debug#assigns doesn't depend on instance state (maybe move it to another class?) Open
def assigns(context)
- Read upRead up
- Exclude checks
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)
- Read upRead up
- Exclude checks
A Utility Function is any instance method that has no dependency on the state of the instance.
Liquid::Tags::Menu#render doesn't depend on instance state (maybe move it to another class?) Open
def render(context)
- Read upRead up
- Exclude checks
A Utility Function is any instance method that has no dependency on the state of the instance.
Arel::Visitors#strip_order_from_select doesn't depend on instance state (maybe move it to another class?) Open
def strip_order_from_select(o)
- Read upRead up
- Exclude checks
A Utility Function is any instance method that has no dependency on the state of the instance.
Liquid::Tags::PageSection#render doesn't depend on instance state (maybe move it to another class?) Open
def render(context)
- Read upRead up
- Exclude checks
A Utility Function is any instance method that has no dependency on the state of the instance.
Liquid::Tags::ThemeStylesheet#render doesn't depend on instance state (maybe move it to another class?) Open
def render(context)
- Read upRead up
- Exclude checks
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?
- Read upRead up
- Exclude checks
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)
Liquid::Tags::Footer#render doesn't depend on instance state (maybe move it to another class?) Open
def render(context)
- Read upRead up
- Exclude checks
A Utility Function is any instance method that has no dependency on the state of the instance.
days_since doesn't depend on instance state (maybe move it to another class?) Open
def days_since(time)
- Read upRead up
- Exclude checks
A Utility Function is any instance method that has no dependency on the state of the instance.
ThreeScale::Middleware::Multitenant::TenantChecker#verify! performs a nil-check Open
return if current.nil?
- Read upRead up
- Exclude checks
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)
ThreeScale::SidekiqRetrySupport::Worker#retry_attempt is a writable attribute Open
attr_writer :retry_attempt
- Read upRead up
- Exclude checks
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)