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

Layout/EndOfLine: EnforcedStyle: lf does not seem to work #621

Open
Youdaman opened this issue Apr 2, 2024 · 0 comments
Open

Layout/EndOfLine: EnforcedStyle: lf does not seem to work #621

Youdaman opened this issue Apr 2, 2024 · 0 comments

Comments

@Youdaman
Copy link

Youdaman commented Apr 2, 2024

I'm on Windows and I want to override the EnforcedStyle from "native" to "lf", so here's my .standard.yml

plugins:
  - standard-rails

ignore:
  - 'db/migrate/20240401101848_create_delayed_jobs.rb':
    - Layout/ExtraSpacing
    - Rails/ReversibleMigrationMethodDefinition
  # - '**/*':
  #   - Layout/EndOfLine

Layout/EndOfLine:
  EnforcedStyle: lf

When I run standardrb I still errors for the various .rb files in the project complaining:

standard: Use Ruby Standard Style (https://github.com/standardrb/standard)
  Gemfile:1:1: Layout/EndOfLine: Carriage return character missing.
  Rakefile:1:1: Layout/EndOfLine: Carriage return character missing.
  app/channels/application_cable/channel.rb:1:1: Layout/EndOfLine: Carriage return character missing.
  app/channels/application_cable/connection.rb:1:1: Layout/EndOfLine: Carriage return character missing.
  app/controllers/application_controller.rb:1:1: Layout/EndOfLine: Carriage return character missing.
  app/helpers/application_helper.rb:1:1: Layout/EndOfLine: Carriage return character missing.
  app/jobs/application_job.rb:1:1: Layout/EndOfLine: Carriage return character missing.
  app/mailers/application_mailer.rb:1:1: Layout/EndOfLine: Carriage return character missing.
  app/models/application_record.rb:1:1: Layout/EndOfLine: Carriage return character missing.
  app/models/user.rb:1:1: Layout/EndOfLine: Carriage return character missing.
  config.ru:1:1: Layout/EndOfLine: Carriage return character missing.
  config/application.rb:1:1: Layout/EndOfLine: Carriage return character missing.
  config/boot.rb:1:1: Layout/EndOfLine: Carriage return character missing.
  config/environment.rb:1:1: Layout/EndOfLine: Carriage return character missing.
  config/environments/development.rb:1:1: Layout/EndOfLine: Carriage return character missing.
  config/environments/production.rb:1:1: Layout/EndOfLine: Carriage return character missing.
  config/environments/test.rb:1:1: Layout/EndOfLine: Carriage return character missing.
  config/importmap.rb:1:1: Layout/EndOfLine: Carriage return character missing.
  config/initializers/assets.rb:1:1: Layout/EndOfLine: Carriage return character missing.
  config/initializers/content_security_policy.rb:1:1: Layout/EndOfLine: Carriage return character missing.
  config/initializers/filter_parameter_logging.rb:1:1: Layout/EndOfLine: Carriage return character missing.
  config/initializers/inflections.rb:1:1: Layout/EndOfLine: Carriage return character missing.
  config/initializers/pay.rb:1:1: Layout/EndOfLine: Carriage return character missing.
  config/initializers/permissions_policy.rb:1:1: Layout/EndOfLine: Carriage return character missing.
  config/initializers/revise_auth.rb:1:1: Layout/EndOfLine: Carriage return character missing.
  config/puma.rb:1:1: Layout/EndOfLine: Carriage return character missing.
  config/routes.rb:1:1: Layout/EndOfLine: Carriage return character missing.
  db/migrate/20240401030014_create_pay_tables.pay.rb:1:1: Layout/EndOfLine: Carriage return character missing.
  db/migrate/20240401060824_create_users.rb:1:1: Layout/EndOfLine: Carriage return character missing.
  db/migrate/20240401075402_add_name_to_user.rb:1:1: Layout/EndOfLine: Carriage return character missing.
  db/migrate/20240401101848_create_delayed_jobs.rb:1:1: Layout/EndOfLine: Carriage return character missing.
  db/seeds.rb:1:1: Layout/EndOfLine: Carriage return character missing.
  test/application_system_test_case.rb:1:1: Layout/EndOfLine: Carriage return character missing.
  test/channels/application_cable/connection_test.rb:1:1: Layout/EndOfLine: Carriage return character missing.
  test/models/user_test.rb:1:1: Layout/EndOfLine: Carriage return character missing.
  test/test_helper.rb:1:1: Layout/EndOfLine: Carriage return character missing.

If I uncomment that ignore rule things work fine:

   - '**/*':
    - Layout/EndOfLine

But I feel this is a hack and doesn't actually enforce all files to end with LF. I've confirmed the offending files don't contain carriage returns by using the od command, e.g. od -a test/test_helper.rb | grep cr (which returns nothing, i.e. no match) -- and the status bar in VS Code also says "LF" for these files.

Am I doing something wrong with where I have the Layout/EndOfLine in my config? Should it be nested under something?

I'm calling standardrb without having it in my Gemfile because it's installed globally, but that shouldn't make a difference right?

I found a related issue to do with rubocop here but the solution there to ignore the cache doesn't seem to apply to standardrb rubocop/rubocop#4669 -- unless there is some caching issue? If so how do I empty/ignore the cache?

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