Skip to content
This repository was archived by the owner on Jul 31, 2023. It is now read-only.

In editor a linting (rubocop) error is show that doesn't appear in console #698

@shir

Description

@shir

Your environment

  • vscode-ruby version: 0.28.1
  • Ruby version: 2.7.2
  • Ruby version manager (if any): asdf 0.8.0
  • VS Code version: 1.52.1
  • Operating System: Mac OS X 11.1
  • Using language server? (eg useLanguageServer is true in your configuration?): Yes
  • Rubocop version: 1.7.0

Expected behavior

I expect that I don't see any rubocop error in the editor I there is no errors when I run rubocop from the console.

Actual behavior

I see the next error in the editor:

Screenshot 2021-01-14 at 11 54 49

But when I run rubocop in console for this file I don't see any error (and shouldn't):

❯ rubocop app/models/article.rb
Inspecting 1 file
.

1 file inspected, no offenses detected

If I try to run rubocop as language server do I don't have errors too:

❯ cat /Users/shir/project/app/models/article.rb | rubocop -s '/Users/shir/project/app/models/article.rb' -f json
{"metadata":{"rubocop_version":"1.7.0","ruby_engine":"ruby","ruby_version":"2.7.2","ruby_patchlevel":"137","ruby_platform":"x86_64-darwin19"},"files":[{"path":"app/models/article.rb","offenses":[]}],"summary":{"offense_count":0,"target_file_count":1,"inspected_file_count":1}}%

If I remove this # rubocop:disable Rails/EnumHash comment then the error in the editor disappear, but I will have an error when I run rubocop from the console:

❯ rubocop app/models/article.rb
Inspecting 1 file
C

Offenses:

app/models/article.rb:37:16: C: [Correctable] Rails/EnumHash: Enum defined as an array found in status enum declaration. Use hash syntax instead.
  enum status: [:published, :draft]
               ^^^^^^^^^^^^^^^^^^^^

1 file inspected, 1 offense detected, 1 offense auto-correctable

I'm not sure when this error appears after rubocop update or after the last vscode-ruby update.

I will be glad to help with any debugging but right now I don't know where to go.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions