Skip to content

Commit

Permalink
Move default enforced styles to top in docs
Browse files Browse the repository at this point in the history
  • Loading branch information
pirj authored and bbatsov committed Jun 4, 2022
1 parent a9fd669 commit 0c7a1aa
Show file tree
Hide file tree
Showing 14 changed files with 281 additions and 279 deletions.
148 changes: 74 additions & 74 deletions docs/modules/ROOT/pages/cops_layout.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -1945,27 +1945,27 @@ the configuration.

=== Examples

==== EnforcedStyle: empty_lines
==== EnforcedStyle: no_empty_lines (default)

[source,ruby]
----
# good
foo do |bar|
# ...
end
----

==== EnforcedStyle: no_empty_lines (default)
==== EnforcedStyle: empty_lines

[source,ruby]
----
# good
foo do |bar|
# ...
end
----

Expand Down Expand Up @@ -2000,6 +2000,19 @@ the configuration.

=== Examples

==== EnforcedStyle: no_empty_lines (default)

[source,ruby]
----
# good
class Foo
def bar
# ...
end
end
----

==== EnforcedStyle: empty_lines

[source,ruby]
Expand Down Expand Up @@ -2070,19 +2083,6 @@ class Foo
end
----

==== EnforcedStyle: no_empty_lines (default)

[source,ruby]
----
# good
class Foo
def bar
# ...
end
end
----

=== Configurable attributes

|===
Expand Down Expand Up @@ -2226,58 +2226,58 @@ the configuration.

=== Examples

==== EnforcedStyle: empty_lines
==== EnforcedStyle: no_empty_lines (default)

[source,ruby]
----
# good
module Foo
def bar
# ...
end
end
----

==== EnforcedStyle: empty_lines_except_namespace
==== EnforcedStyle: empty_lines

[source,ruby]
----
# good
module Foo
module Bar
def bar
# ...
end
end
----

==== EnforcedStyle: empty_lines_special
==== EnforcedStyle: empty_lines_except_namespace

[source,ruby]
----
# good
module Foo
module Bar
def bar; end
# ...
end
end
----

==== EnforcedStyle: no_empty_lines (default)
==== EnforcedStyle: empty_lines_special

[source,ruby]
----
# good
module Foo
def bar
# ...
end
def bar; end
end
----

Expand Down Expand Up @@ -2587,12 +2587,13 @@ nested_first_param),
second_param
----

==== EnforcedStyle: consistent
==== EnforcedStyle: special_for_inner_method_call_in_parentheses (default)

[source,ruby]
----
# The first argument should always be indented one step more than the
# preceding line.
# Same as `special_for_inner_method_call` except that the special rule
# only applies if the outer method call encloses its arguments in
# parentheses.
# good
some_method(
Expand All @@ -2604,7 +2605,7 @@ foo = some_method(
second_param)
foo = some_method(nested_call(
nested_first_param),
nested_first_param),
second_param)
foo = some_method(
Expand All @@ -2617,75 +2618,74 @@ some_method nested_call(
second_param
----

==== EnforcedStyle: consistent_relative_to_receiver
==== EnforcedStyle: consistent

[source,ruby]
----
# The first argument should always be indented one level relative to
# the parent that is receiving the argument
# The first argument should always be indented one step more than the
# preceding line.
# good
some_method(
first_param,
second_param)
foo = some_method(
first_param,
first_param,
second_param)
foo = some_method(nested_call(
nested_first_param),
nested_first_param),
second_param)
foo = some_method(
nested_call(
nested_first_param),
nested_call(
nested_first_param),
second_param)
some_method nested_call(
nested_first_param),
second_params
nested_first_param),
second_param
----

==== EnforcedStyle: special_for_inner_method_call
==== EnforcedStyle: consistent_relative_to_receiver

[source,ruby]
----
# The first argument should normally be indented one step more than
# the preceding line, but if it's a argument for a method call that
# is itself a argument in a method call, then the inner argument
# should be indented relative to the inner method.
# The first argument should always be indented one level relative to
# the parent that is receiving the argument
# good
some_method(
first_param,
second_param)
foo = some_method(
first_param,
first_param,
second_param)
foo = some_method(nested_call(
nested_first_param),
second_param)
foo = some_method(
nested_call(
nested_first_param),
nested_call(
nested_first_param),
second_param)
some_method nested_call(
nested_first_param),
second_param
second_params
----

==== EnforcedStyle: special_for_inner_method_call_in_parentheses (default)
==== EnforcedStyle: special_for_inner_method_call

[source,ruby]
----
# Same as `special_for_inner_method_call` except that the special rule
# only applies if the outer method call encloses its arguments in
# parentheses.
# The first argument should normally be indented one step more than
# the preceding line, but if it's a argument for a method call that
# is itself a argument in a method call, then the inner argument
# should be indented relative to the inner method.
# good
some_method(
Expand All @@ -2706,7 +2706,7 @@ foo = some_method(
second_param)
some_method nested_call(
nested_first_param),
nested_first_param),
second_param
----

Expand Down Expand Up @@ -6104,32 +6104,32 @@ surrounding space depending on configuration.

=== Examples

==== EnforcedStyle: space
==== EnforcedStyle: no_space (default)

[source,ruby]
----
# The `space` style enforces that array literals have
# surrounding space.
# The `no_space` style enforces that array literals have
# no surrounding space.
# bad
array = [a, b, c, d]
array = [ a, b, c, d ]
# good
array = [ a, b, c, d ]
array = [a, b, c, d]
----

==== EnforcedStyle: no_space (default)
==== EnforcedStyle: space

[source,ruby]
----
# The `no_space` style enforces that array literals have
# no surrounding space.
# The `space` style enforces that array literals have
# surrounding space.
# bad
array = [ a, b, c, d ]
array = [a, b, c, d]
# good
array = [a, b, c, d]
array = [ a, b, c, d ]
----

==== EnforcedStyle: compact
Expand Down Expand Up @@ -6780,42 +6780,42 @@ source code.

=== Examples

==== EnforcedStyle: final_blank_line
==== EnforcedStyle: final_newline (default)

[source,ruby]
----
# `final_blank_line` looks for one blank line followed by a new line
# at the end of files.
# `final_newline` looks for one newline at the end of files.
# bad
class Foo; end
# EOF
# bad
class Foo; end # EOF
# good
class Foo; end
# EOF
----

==== EnforcedStyle: final_newline (default)
==== EnforcedStyle: final_blank_line

[source,ruby]
----
# `final_newline` looks for one newline at the end of files.
# `final_blank_line` looks for one blank line followed by a new line
# at the end of files.
# bad
class Foo; end
# EOF
# bad
class Foo; end # EOF
# good
class Foo; end
# EOF
----

Expand Down

0 comments on commit 0c7a1aa

Please sign in to comment.