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 #8232] Fix a false positive for Layout/EmptyLinesAroundAccessModifier #8233

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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Expand Up @@ -6,6 +6,10 @@

* [#8242](https://github.com/rubocop-hq/rubocop/pull/8242): Internal profiling available with `bin/rubocop-profile` and rake tasks. ([@marcandre][])

### Bug fixes

* [#8232](https://github.com/rubocop-hq/rubocop/issues/8232): Fix a false positive for `Layout/EmptyLinesAroundAccessModifier` when `end` immediately after access modifier. ([@koic][])

## 0.87.1 (2020-07-07)

### Bug fixes
Expand Down
Expand Up @@ -109,6 +109,7 @@ def autocorrect(node)

def allowed_only_before_style?(node)
if node.special_modifier?
return true if processed_source[node.last_line] == 'end'
return false if next_line_empty?(node.last_line)
end

Expand Down
Expand Up @@ -397,6 +397,14 @@ def test; end
end
RUBY
end

it "does not register an offense when `end` immediately after #{access_modifier}" do
expect_no_offenses(<<~RUBY)
class Test
#{access_modifier}
end
RUBY
end
end

%w[public module_function].each do |access_modifier|
Expand Down