Dmitry Dmitriev
Dmitry Dmitriev

Reputation: 1059

Rubocop warning: Style/EndOfLine has the wrong namespace

I'm working with Ruby under Windows platform. Solving "Carriage return character missing" rubocop offenses, I created file .rubocop.yml in the root of my project:

Style/EndOfLine:
  EnforcedStyle: lf

This solved my "Carriage return" problem. But new warning appears:

~/project/.rubocop.yml:Style/EndOfLine has the wrong namespace - should be Layout

What does it mean "wrong namespace - should be Layout"? At current moment I have no idea where to dig to fix it.

Upvotes: 3

Views: 4242

Answers (3)

Dmitry Dmitriev
Dmitry Dmitriev

Reputation: 1059

To remove this warning need to use Layout/EndOfLine instead of Style/EndOfLine. EndOfLine is a rubucop cop that responsible for detecting offense related to indentation, because it placed in Layout department.

  Layout/EndOfLine:
    EnforcedStyle: lf

It is interesting why in this comment about fixing "Carriage return character missing" advised to use Style/EndOfLine. It's relative new article and comments. Looks like since April some changes in rubocop been added.

Upvotes: 4

Ben Scheirman
Ben Scheirman

Reputation: 40961

Looks like you need to indent that second line:

Style/EndOfLine:
  EnforcedStyle: lf

Upvotes: -1

Andrew Marshall
Andrew Marshall

Reputation: 96934

It’s Layout/EndOfLine, not Style/EndOfLine. The part before the / is the namespace.

Upvotes: 7

Related Questions