-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Closed
Labels
Description
Expected behavior
RuboCop corrects only true module inclusions with Layout/EmptyLinesAfterModuleInclusion.
Actual behavior
We are seeing an infinite loop caused by the introduction of Layout/EmptyLinesAfterModuleInclusion. As you can see below, this is not actually a module inclusion, it just seems to be finding instances of include
.
includes = [include, sdk_include].compact.map do |inc|
"'#{inc}',"
end.join(" ")
The below is from our wrapper around RuboCop
╰─ brew style --fix libxml2
Infinite loop detected in /opt/homebrew/Library/Taps/homebrew/homebrew-core/Formula/lib/libxml2.rb and caused by Layout/EmptyLinesAfterModuleInclusion -> Layout/EmptyLinesAroundBlockBody
Taps/homebrew/homebrew-core/Formula/lib/libxml2.rb:109:17: C: [Corrected] Layout/EmptyLinesAfterModuleInclusion: Add an empty line after module inclusion.
includes = [include, sdk_include].compact.map do |inc|
^^^^^^^
Taps/homebrew/homebrew-core/Formula/lib/libxml2.rb:110:1: C: [Corrected] Layout/EmptyLinesAroundBlockBody: Extra empty line detected at block body beginning.
1 file inspected, 2 offenses detected, 2 offenses corrected
1 error occurred:
Infinite loop detected in /opt/homebrew/Library/Taps/homebrew/homebrew-core/Formula/lib/libxml2.rb and caused by Layout/EmptyLinesAfterModuleInclusion -> Layout/EmptyLinesAroundBlockBody
Errors are usually caused by RuboCop bugs.
Please, update to the latest RuboCop version if not already in use, and report a bug if the issue still occurs on this version.
Mention the following information in the issue report:
Steps to reproduce the problem
The code provided above triggers the infinite loop. False positives can also be found in our LLVM formulae:
(xctoolchain/"usr").install_symlink [bin, include, lib, libexec, share]
RuboCop version
1.79.2 (using Parser 3.3.9.0, rubocop-ast 1.46.0, analyzing as Ruby 2.7, running on ruby 3.4.5) [arm64-darwin20]
issyl0