Showing 37 of 76 total issues
RequestHelpers has no descriptive comment Open
module RequestHelpers
- Read upRead up
- Exclude checks
Classes and modules are the units of reuse and release. It is therefore considered good practice to annotate every class and module with a brief comment outlining its responsibilities.
Example
Given
class Dummy
# Do things...
end
Reek would emit the following warning:
test.rb -- 1 warning:
[1]:Dummy has no descriptive comment (IrresponsibleModule)
Fixing this is simple - just an explaining comment:
# The Dummy class is responsible for ...
class Dummy
# Do things...
end
Minitest::Spec has no descriptive comment Open
class Spec
- Read upRead up
- Exclude checks
Classes and modules are the units of reuse and release. It is therefore considered good practice to annotate every class and module with a brief comment outlining its responsibilities.
Example
Given
class Dummy
# Do things...
end
Reek would emit the following warning:
test.rb -- 1 warning:
[1]:Dummy has no descriptive comment (IrresponsibleModule)
Fixing this is simple - just an explaining comment:
# The Dummy class is responsible for ...
class Dummy
# Do things...
end
Minitest::WebSpec has no descriptive comment Open
class WebSpec < Spec
- Read upRead up
- Exclude checks
Classes and modules are the units of reuse and release. It is therefore considered good practice to annotate every class and module with a brief comment outlining its responsibilities.
Example
Given
class Dummy
# Do things...
end
Reek would emit the following warning:
test.rb -- 1 warning:
[1]:Dummy has no descriptive comment (IrresponsibleModule)
Fixing this is simple - just an explaining comment:
# The Dummy class is responsible for ...
class Dummy
# Do things...
end
TimeHelpers#die_wende doesn't depend on instance state (maybe move it to another class?) Open
def die_wende
- Read upRead up
- Exclude checks
A Utility Function is any instance method that has no dependency on the state of the instance.
EventHelpers#event_store doesn't depend on instance state (maybe move it to another class?) Open
def event_store
- Read upRead up
- Exclude checks
A Utility Function is any instance method that has no dependency on the state of the instance.
Reactors::InvitationMailer#subject doesn't depend on instance state (maybe move it to another class?) Open
def subject(inviter)
- Read upRead up
- Exclude checks
A Utility Function is any instance method that has no dependency on the state of the instance.
Workflows::TagsMember#steps doesn't depend on instance state (maybe move it to another class?) Open
def steps
- Read upRead up
- Exclude checks
A Utility Function is any instance method that has no dependency on the state of the instance.
Aggregates::Member::Tag#== performs a nil-check Open
return if other.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)
RequestHelpers#secret doesn't depend on instance state (maybe move it to another class?) Open
def secret
- Read upRead up
- Exclude checks
A Utility Function is any instance method that has no dependency on the state of the instance.
Roost::Config#database_url is a writable attribute Open
attr_accessor :database_url, :secret_base, :web_url
- 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)
Roost::Config#web_url is a writable attribute Open
attr_accessor :database_url, :secret_base, :web_url
- 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)
Reactors::InvitationMailer#from doesn't depend on instance state (maybe move it to another class?) Open
def from(inviter)
- Read upRead up
- Exclude checks
A Utility Function is any instance method that has no dependency on the state of the instance.
Aggregates::Member::TagList inherits from core class 'Array' Open
class TagList < Array
- Read upRead up
- Exclude checks
Subclassing core classes in Ruby can lead to unexpected side effects.
Knowing that Ruby has a core library, which is written in C, and a standard library, which is written in Ruby, if you do not know exactly how these core classes operate at the C level, you are gonna have a bad time.
Source: http://words.steveklabnik.com/beware-subclassing-ruby-core-classes
Roost::Config#secret_base is a writable attribute Open
attr_accessor :database_url, :secret_base, :web_url
- 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)
Workflows::MemberRegisters#steps doesn't depend on instance state (maybe move it to another class?) Open
def steps
- Read upRead up
- Exclude checks
A Utility Function is any instance method that has no dependency on the state of the instance.
DataHelpers#fixtures doesn't depend on instance state (maybe move it to another class?) Open
def fixtures(file)
- Read upRead up
- Exclude checks
A Utility Function is any instance method that has no dependency on the state of the instance.
Complex method Web::TagsController::post#/tags (20.5) Open
post '/tags' do
requires_authorization
Commands.handle(
'Profile',
- Read upRead up
- Exclude checks
Flog calculates the ABC score for methods. The ABC score is based on assignments, branches (method calls), and conditions.
You can read more about ABC metrics or the flog tool