Skip to content

Latest commit

 

History

History
509 lines (355 loc) · 5.75 KB

cops_rbs_layout.adoc

File metadata and controls

509 lines (355 loc) · 5.75 KB

RBS/Layout

RBS/Layout/CommentIndentation

Enabled by default Safe Supports autocorrection Version Added Version Changed

Enabled

Yes

Always

-

-

Examples

default

# bad
  # comment here
def foo: () -> void

# good
# comment here
def foo: () -> void

RBS/Layout/EmptyLines

Enabled by default Safe Supports autocorrection Version Added Version Changed

Enabled

Yes

Always

-

-

Checks for two or more consecutive blank lines.

Examples

# bad - It has two empty lines.
def foo: () -> void
# one empty line
# two empty lines
def bar: () -> void

# good
def foo: () -> void
# one empty line
def bar: () -> void

RBS/Layout/EmptyLinesAroundAccessModifier

Enabled by default Safe Supports autocorrection Version Added Version Changed

Enabled

Yes

Always

-

-

Access modifiers should be surrounded by blank lines.

# bad
class Foo
  def bar: () -> void
  private
  def baz: () -> void
end
# good
class Foo
  def bar: () -> void
private
  def baz: () -> void
end

RBS/Layout/EmptyLinesAroundClassBody

Enabled by default Safe Supports autocorrection Version Added Version Changed

Enabled

Yes

Always

-

-

Checks if empty lines around the bodies of classes match the configuration.

Examples

default

# good

class Foo
  def bar: () -> void
end

RBS/Layout/EmptyLinesAroundInterfaceBody

Enabled by default Safe Supports autocorrection Version Added Version Changed

Enabled

Yes

Always

-

-

Checks if empty lines around the bodies of interfaces match the configuration.

Examples

default

# good

interface _Foo
  def bar: () -> void
end

RBS/Layout/EmptyLinesAroundModuleBody

Enabled by default Safe Supports autocorrection Version Added Version Changed

Enabled

Yes

Always

-

-

Checks if empty lines around the bodies of modules match the configuration.

Examples

default

# good

module Foo
  def bar: () -> void
end

RBS/Layout/EmptyLinesAroundOverloads

Enabled by default Safe Supports autocorrection Version Added Version Changed

Enabled

Yes

Always

-

-

Examples

default

# bad
def foo: () -> void

       | (Integer) -> Integer

# good
def foo: () -> void
       | (Integer) -> Integer

RBS/Layout/EndAlignment

Enabled by default Safe Supports autocorrection Version Added Version Changed

Enabled

Yes

Always

-

-

Examples

default

# bad
class Foo
  def foo: () -> void
  end

# good
class Foo
  def foo: () -> void
end

RBS/Layout/ExtraSpacing

Enabled by default Safe Supports autocorrection Version Added Version Changed

Enabled

Yes

Always

-

-

Examples

default

# bad
def   foo:   ()   ->   void

# good
def foo: () -> void

RBS/Layout/IndentationWidth

Enabled by default Safe Supports autocorrection Version Added Version Changed

Enabled

Yes

Always

-

-

Examples

default

# bad
class Foo
def foo: () -> void
end

# good
class Foo
  def foo: () -> void
end

RBS/Layout/OverloadIndentation

Enabled by default Safe Supports autocorrection Version Added Version Changed

Enabled

Yes

Always

-

-

Examples

default

# bad
def foo: () -> String | () -> (Integer)

# bad
def foo: () -> String
    | () -> (Integer)

# bad
def foo: () -> String |
         () -> (Integer)

# good
def foo: () -> String
       | () -> Integer

RBS/Layout/SpaceAroundArrow

Enabled by default Safe Supports autocorrection Version Added Version Changed

Enabled

Yes

Always

-

-

Examples

default

# bad
def foo: ()->void

# bad
def bar: () { ()->void } -> void

# good
def foo: () -> void

# good
def bar: () { () -> void } -> void

RBS/Layout/SpaceAroundBraces

Enabled by default Safe Supports autocorrection Version Added Version Changed

Enabled

Yes

Always

-

-

Examples

default

# bad
def bar: (){() -> void}-> void

# good
def bar: () { () -> void } -> void

RBS/Layout/SpaceAroundOperators

Enabled by default Safe Supports autocorrection Version Added Version Changed

Enabled

Yes

Always

-

-

Examples

default

# bad
Integer|String

# good
Integer | String

RBS/Layout/SpaceBeforeColon

Enabled by default Safe Supports autocorrection Version Added Version Changed

Enabled

Yes

Always

-

-

Examples

default

# bad
def foo : () -> void

# good
def foo: () -> void

RBS/Layout/SpaceBeforeOverload

Enabled by default Safe Supports autocorrection Version Added Version Changed

Enabled

Yes

Always

-

-

Examples

default

# bad
def foo:() -> void
       |  () -> void

# good
def foo: () -> void
       | () -> void

RBS/Layout/TrailingWhitespace

Enabled by default Safe Supports autocorrection Version Added Version Changed

Enabled

Yes

Always

-

-

Examples

default

# bad
class Foo[:space:]
  def foo: () -> void[:space:]
end[:space:]

# good
class Foo
  def foo: () -> void
end