Expected the line after the closing parenthesis of Struct.new(...)
to be checked for Layout/EmptyLinesAroundClassBody, in the event that the class inherits from Struct.new
and is declared in a multiline format.
Keeps revolving between
Layout/EmptyLinesAroundClassBody: Empty line missing at class body beginning,
Layout/EmptyLinesAroundArguments: Empty line detected around arguments.
in an infinite loop.
screenshots of the two formats:
Steps to reproduce the problemThis seems to get applied once I extend the class to have a def initialize method... it must at that point get registered as a "block" class instead of a class that is defined "inline":
class Event < Struct.new( :message, # it checks this line for the space :severity, keyword_init: true, ) # this is the space I expected it to look at for Layout/EmptyLinesAroundClassBody def initialize(severity: :warning, **args) super(severity: severity, **args) end end
I tried to create a regex pattern that would work with AllowedPatterns, but the issue is that RuboCop compares the regex 1 line in the source code at a time - so I'm unable to create a multiline regex pattern that captures \sclass.<\sStruct.new( and then disables this for the next line (or do ^sclass.<\sStruct.new(\n.*:[a-z_]+,).
RuboCop versionRetroSearch 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