Class: RuboCop::Cop::RBS::Layout::EmptyLineBetweenDeclarations

Inherits:
RBS::CopBase
  • Object
show all
Extended by:
AutoCorrector
Defined in:
lib/rubocop/cop/rbs/layout/empty_line_between_declarations.rb

Overview

Checks for empty lines between declarations.

Examples:

Class: true (default)

# checks for empty lines between class declarations.

# bad
class A
end
class B
end

# good
class A
end

class B
end

Module: true (default)

# checks for empty lines between module declarations.

# bad
module A
end
module B
end

# good
module A
end

module B
end

Interface: true (default)

# checks for empty lines between interface declarations.

# bad
interface _A
end
interface _B
end

# good
interface _A
end

interface _B
end

Constant Summary collapse

MSG =
'Expected %<expected>s between %<type>s definitions; found %<actual>d.'

Instance Attribute Summary

Attributes inherited from RBS::CopBase

#processed_rbs_source

Instance Method Summary collapse

Methods inherited from RBS::CopBase

documentation_url, #investigation_rbs, #location_to_range, #on_new_investigation, #on_other_file, #on_rbs_attribute, #on_rbs_class, #on_rbs_constant, #on_rbs_def, #on_rbs_global, #on_rbs_interface, #on_rbs_module, #on_rbs_parsing_error, #on_rbs_private, #on_rbs_public, #on_rbs_type_alias, #on_rbs_var, #parse_rbs, #rbs_buffer, #tokenize, #walk

Methods included from RBS::OnTypeHelper

#on_not_type, #on_type

Instance Method Details

#on_rbs_new_investigationObject



62
63
64
65
66
# File 'lib/rubocop/cop/rbs/layout/empty_line_between_declarations.rb', line 62

def on_rbs_new_investigation
  [nil, *processed_rbs_source.decls, nil].each_cons(2) do |decls|
    check_decls(decls)
  end
end