text
stringlengths 0
444
|
|---|
----
|
# bad
|
def some_method
|
data = initialize(options)
|
data.manipulate!
|
data.result
|
end
|
def some_other_method
|
result
|
end
|
# good
|
def some_method
|
data = initialize(options)
|
data.manipulate!
|
data.result
|
end
|
def some_other_method
|
result
|
end
|
----
|
=== Two or More Empty Lines [[two-or-more-empty-lines]]
|
Don't use several empty lines in a row.
|
[source,ruby]
|
----
|
# bad - It has two empty lines.
|
some_method
|
some_method
|
# good
|
some_method
|
some_method
|
----
|
=== Empty Lines around Attribute Accessor [[empty-lines-around-attribute-accessor]]
|
Use empty lines around attribute accessor.
|
[source,ruby]
|
----
|
# bad
|
class Foo
|
attr_reader :foo
|
def foo
|
# do something...
|
end
|
end
|
# good
|
class Foo
|
attr_reader :foo
|
def foo
|
# do something...
|
end
|
end
|
----
|
=== Empty Lines around Access Modifier [[empty-lines-around-access-modifier]]
|
Use empty lines around access modifier.
|
[source,ruby]
|
----
|
# bad
|
class Foo
|
def bar; end
|
private
|
def baz; end
|
end
|
# good
|
class Foo
|
def bar; end
|
private
|
def baz; end
|
end
|
----
|
=== Empty Lines around Bodies [[empty-lines-around-bodies]]
|
Don't use empty lines around method, class, module, block bodies.
|
[source,ruby]
|
----
|
# bad
|
class Foo
|
def foo
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.