app/models/vouchertype.rb
Class Vouchertype
has 42 methods (exceeds 20 allowed). Consider refactoring. Open
Open
class Vouchertype < ActiveRecord::Base
belongs_to :account_code
validates_associated :account_code
BUG found Open
Open
# BUG: this duplicates functionality
- Exclude checks
BUG found Open
Open
# BUG clean up this method
- Exclude checks
Useless assignment to variable - s
. Use _
or _s
as a variable name to indicate that it won't be used. Open
Open
s,e = Time.season_boundaries(Time.this_season)
- Read upRead up
- Exclude checks
This cop checks for every useless assignment to local variable in every
scope.
The basic idea for this cop was from the warning of ruby -cw
:
assigned but unused variable - foo
Currently this cop has advanced logic that detects unreferenced reassignments and properly handles varied cases such as branch, loop, rescue, ensure, etc.
Example:
# bad
def some_method
some_var = 1
do_something
end
Example:
# good
def some_method
some_var = 1
do_something(some_var)
end
Useless assignment to variable - e
. Use _
or _e
as a variable name to indicate that it won't be used. Open
Open
s,e = Time.season_boundaries(Time.this_season)
- Read upRead up
- Exclude checks
This cop checks for every useless assignment to local variable in every
scope.
The basic idea for this cop was from the warning of ruby -cw
:
assigned but unused variable - foo
Currently this cop has advanced logic that detects unreferenced reassignments and properly handles varied cases such as branch, loop, rescue, ensure, etc.
Example:
# bad
def some_method
some_var = 1
do_something
end
Example:
# good
def some_method
some_var = 1
do_something(some_var)
end
Unused block argument - id
. If it's necessary, use _
or _id
as an argument name to indicate that it won't be used. Open
Open
included_vouchers.delete_if { |id,qty| qty.to_i.zero? }
- Read upRead up
- Exclude checks
This cop checks for unused block arguments.
Example:
# bad
do_something do |used, unused|
puts used
end
do_something do |bar|
puts :foo
end
define_method(:foo) do |bar|
puts :baz
end
Example:
#good
do_something do |used, _unused|
puts used
end
do_something do
puts :foo
end
define_method(:foo) do |_bar|
puts :baz
end