Rubocop warning: Style/EndOfLine has the wrong namespace

4.1k Views Asked by At

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.

3

There are 3 best solutions below

0
On BEST ANSWER

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

1
On

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.

2
On

Looks like you need to indent that second line:

Style/EndOfLine:
  EnforcedStyle: lf