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

Style/ClassAndModuleChildren with compact style should not be enforced when top level class is a subclass #2911

Closed
morgoth opened this issue Mar 4, 2016 · 0 comments

Comments

@morgoth
Copy link

morgoth commented Mar 4, 2016

Having .rubocop.yml

Style/ClassAndModuleChildren:
  EnforcedStyle: compact

and test.rb

class ApplicationJob < String
  class Error
  end
end

When I run rubocop --only Style/ClassAndModuleChildren
I get

test.rb:1:7: C: Use compact module/class definition instead of nested style.
class ApplicationJob < String

but when I change test.rb to:

class ApplicationJob < String
  class Error
  end

  def test
  end
end

it passes fine

Expected behavior

I think it should not enforce compact style in case when top level class is a subclass.

RuboCop version

rubocop -V
0.37.2 (using Parser 2.3.0.6, running on ruby 2.3.0 x86_64-linux)
@bbatsov bbatsov closed this as completed in 0f40a84 Mar 5, 2016
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

No branches or pull requests

1 participant