Class: RuboCop::Cop::RBS::Style::EmptyArgument
- Inherits:
-
RBS::CopBase
- Object
- Base
- RBS::CopBase
- RuboCop::Cop::RBS::Style::EmptyArgument
- Extended by:
- AutoCorrector
- Defined in:
- lib/rubocop/cop/rbs/style/empty_argument.rb
Overview
Defined Under Namespace
Classes: MethodTypeChecker
Constant Summary collapse
- MSG =
'Insert `()` when empty argument'
Instance Attribute Summary
Attributes inherited from RBS::CopBase
Instance Method Summary collapse
- #on_rbs_constant(const) ⇒ Object (also: #on_rbs_global, #on_rbs_type_alias, #on_rbs_attribute, #on_rbs_var)
- #on_rbs_def(decl) ⇒ Object
Methods inherited from RBS::CopBase
#investigation_rbs, #location_to_range, #on_new_investigation, #on_other_file, #on_rbs_class, #on_rbs_interface, #on_rbs_module, #on_rbs_new_investigation, #on_rbs_parsing_error, #on_rbs_private, #on_rbs_public, #parse_rbs, #rbs_buffer, #tokenize, #walk
Methods included from RBS::OnTypeHelper
Instance Method Details
#on_rbs_constant(const) ⇒ Object Also known as: on_rbs_global, on_rbs_type_alias, on_rbs_attribute, on_rbs_var
155 156 157 158 159 160 161 162 |
# File 'lib/rubocop/cop/rbs/style/empty_argument.rb', line 155 def on_rbs_constant(const) MethodTypeChecker.new(base_type: const.type) do |s, e| range = range_between(s, e) add_offense(range) do |corrector| corrector.insert_before(range, '() ') end end.check_type end |
#on_rbs_def(decl) ⇒ Object
144 145 146 147 148 149 150 151 152 153 |
# File 'lib/rubocop/cop/rbs/style/empty_argument.rb', line 144 def on_rbs_def(decl) decl.overloads.each do |overload| MethodTypeChecker.new(base_type: overload.method_type) do |s, e| range = range_between(s, e) add_offense(range) do |corrector| corrector.insert_before(range, '() ') end end.check end end |