KEMBAR78
Fix false-positive for `Layout/EmptyLinesAfterModuleInclusion` when inclusion is called with modifier by r7kamura · Pull Request #14408 · rubocop/rubocop · GitHub
Skip to content

Conversation

@r7kamura
Copy link
Contributor

@r7kamura r7kamura commented Aug 1, 2025

In the current implementation, I’ve confirmed that the following use of a modifier is flagged as an offense, but I believe it would be preferable not to treat this as an offense.

class Foo
  include Bar
  include Baz if condition
  include Qux
end
example.rb:2:3: C: [Correctable] Layout/EmptyLinesAfterModuleInclusion: Add an empty line after module inclusion.
  include Bar
  ^^^^^^^^^^^
$ bundle exec rubocop -V
1.79.1 (using Parser 3.3.8.0, rubocop-ast 1.46.0, analyzing as Ruby 2.7, running on ruby 3.4.2) [x86_64-linux]
  - rubocop-performance 1.25.0
  - rubocop-rake 0.7.1
  - rubocop-rspec 3.6.0

Before submitting the PR make sure the following are checked:

  • The PR relates to only one subject with a clear title and description in grammatically correct, complete sentences.
  • Wrote good commit messages.
  • Commit message starts with [Fix #issue-number] (if the related issue exists).
  • Feature branch is up-to-date with master (if not - rebase it).
  • Squashed related commits together.
  • Added tests.
  • Ran bundle exec rake default. It executes all tests and runs RuboCop on its own code.
  • Added an entry (file) to the changelog folder named {change_type}_{change_description}.md if the new code introduces user-observable changes. See changelog entry format for details.

@koic
Copy link
Member

koic commented Aug 1, 2025

I think so too. Thanks!

@koic koic merged commit 9423ef4 into rubocop:master Aug 1, 2025
23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants