Skip to content

Commit

Permalink
Fix a typo
Browse files Browse the repository at this point in the history
`Rubocop::AST::Node` is a typo and is correctly `RuboCop::AST::Node`.

```console
% cd path/to/rubocop
% bin/console
irb(main):001:0> Rubocop::AST::Node
(irb):1:in `<main>': uninitialized constant Rubocop (NameError)
Did you mean?  RuboCop
from bin/console:10:in `<main>'
irb(main):002:0> RuboCop::AST::Node
=> RuboCop::AST::Node
```

https://github.com/rubocop/rubocop-ast/blob/v1.7.0/lib/rubocop/ast/node.rb
  • Loading branch information
koic committed Jun 28, 2021
1 parent 89463f6 commit 0170f53
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions lib/rubocop/cop/corrector.rb
Expand Up @@ -32,7 +32,7 @@ def initialize(source)

# Removes `size` characters prior to the source range.
#
# @param [Parser::Source::Range, Rubocop::AST::Node] range or node
# @param [Parser::Source::Range, RuboCop::AST::Node] range or node
# @param [Integer] size
def remove_preceding(node_or_range, size)
range = to_range(node_or_range)
Expand All @@ -44,7 +44,7 @@ def remove_preceding(node_or_range, size)
# If `size` is greater than the size of `range`, the removed region can
# overrun the end of `range`.
#
# @param [Parser::Source::Range, Rubocop::AST::Node] range or node
# @param [Parser::Source::Range, RuboCop::AST::Node] range or node
# @param [Integer] size
def remove_leading(node_or_range, size)
range = to_range(node_or_range)
Expand All @@ -56,7 +56,7 @@ def remove_leading(node_or_range, size)
# If `size` is greater than the size of `range`, the removed region can
# overrun the beginning of `range`.
#
# @param [Parser::Source::Range, Rubocop::AST::Node] range or node
# @param [Parser::Source::Range, RuboCop::AST::Node] range or node
# @param [Integer] size
def remove_trailing(node_or_range, size)
range = to_range(node_or_range)
Expand Down Expand Up @@ -90,7 +90,7 @@ def to_range(node_or_range)
else
raise TypeError,
'Expected a Parser::Source::Range, Comment or ' \
"Rubocop::AST::Node, got #{node_or_range.class}"
"RuboCop::AST::Node, got #{node_or_range.class}"
end
validate_buffer(range.source_buffer)
range
Expand Down
2 changes: 1 addition & 1 deletion spec/rubocop/cop/corrector_spec.rb
Expand Up @@ -73,7 +73,7 @@ def do_rewrite(corrections = nil, &block)
expect do
do_rewrite { |corr| corr.replace(1..3, 'oops') }
end.to raise_error(TypeError, 'Expected a Parser::Source::Range, '\
'Comment or Rubocop::AST::Node, got Range')
'Comment or RuboCop::AST::Node, got Range')
end

context 'when range is from incorrect source' do
Expand Down

0 comments on commit 0170f53

Please sign in to comment.