A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/rubocop/rubocop/issues/14399 below:

The Layout/EmptyLinesAfterModuleInclusion cop behaves incorrectly when using Module.new · Issue #14399 · rubocop/rubocop · GitHub

Expected behavior

The code I wrote in the “step to reproduce” should not be flagged as a violation.

Actual behavior

The code I wrote in the “step to reproduce” section is flagged by Layout/EmptyLinesAfterModuleInclusion.
When I follow its suggestion and add a blank line after prepend Module.new do, it then causes a Layout/EmptyLinesAroundBlockBody violation.

Steps to reproduce the problem

rubocop --enable-pending-cops

# frozen_string_literal: true

# class C document
class C
  prepend Module.new do
    def foo
      puts 'foo'
      super
    end
  end
end
RuboCop version
1.79.0 (using Parser 3.3.9.0, rubocop-ast 1.46.0, analyzing as Ruby 2.7, running on ruby 3.4.5) [arm64-darwin24]

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4