Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Fix #8919] Require RuboCop AST to 1.0.1 or higher #8928

Merged
merged 1 commit into from
Oct 23, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
### Changes

* [#8920](https://github.com/rubocop-hq/rubocop/pull/8920): Remove Capybara's `save_screenshot` from `Lint/Debugger`. ([@ybiquitous][])
* [#8919](https://github.com/rubocop-hq/rubocop/issues/8919): Require RuboCop AST to 1.0.1 or higher. ([@koic][])

### Bug fixes

Expand Down
2 changes: 1 addition & 1 deletion rubocop.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ Gem::Specification.new do |s|
s.add_runtime_dependency('rainbow', '>= 2.2.2', '< 4.0')
s.add_runtime_dependency('regexp_parser', '>= 1.8')
s.add_runtime_dependency('rexml')
s.add_runtime_dependency('rubocop-ast', '>= 0.6.0')
s.add_runtime_dependency('rubocop-ast', '>= 1.0.1')
s.add_runtime_dependency('ruby-progressbar', '~> 1.7')
s.add_runtime_dependency('unicode-display_width', '>= 1.4.0', '< 2.0')

Expand Down
36 changes: 36 additions & 0 deletions spec/rubocop/cop/layout/indentation_consistency_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -527,6 +527,42 @@ def meow_at_4am?
end
RUBY
end

it 'accepts different indentation in different visibility sections when using `Struct.new`' do
expect_no_offenses(<<~RUBY)
Foo = Struct.new(:foo) do
def meow
puts('Meow!')
end

protected

def can_we_be_friends?(another_cat)
# some logic
end

def related_to?(another_cat)
# some logic
end

private

# Here we go back an indentation level again. This is a
# violation of the indented_internal_methods style,
# but it's not for this cop to report.
# Layout/IndentationWidth will handle it.
def meow_at_3am?
rand < 0.8
end

# As long as the indentation of this method is
# consistent with that of the last one, we're fine.
def meow_at_4am?
rand < 0.8
end
end
RUBY
end
end

context 'with normal style configured' do
Expand Down