lib/rexpense/resources/nested_endpoints/membership.rb
Use nested module/class definitions instead of compact style. Open
Open
module Rexpense::Resources
- Read upRead up
- Exclude checks
This cop checks the style of children definitions at classes and modules. Basically there are two different styles:
Example: EnforcedStyle: nested (default)
# good
# have each child on its own line
class Foo
class Bar
end
end
Example: EnforcedStyle: compact
# good
# combine definitions as much as possible
class Foo::Bar
end
The compact style is only forced for classes/modules with one child.
Pass &:parsed_body
as an argument to post
instead of a block. Open
Open
http.post(membership_endpoint(organization_id), body: params) do |response|
response.parsed_body
end
- Read upRead up
- Exclude checks
Use symbols as procs when possible.
Example:
# bad
something.map { |s| s.upcase }
# good
something.map(&:upcase)
Unused block argument - response
. You can omit the argument if you don't care about it. Open
Open
http.delete("#{membership_endpoint(organization_id)}/#{membership_id}") do |response|
- 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