Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
513 views
in Technique[技术] by (71.8m points)

VSCode Ruby RuboCop formatter removes focused specs `fit` -> `it`

I've been happily using https://github.com/rubyide/vscode-ruby in VSCode which has been auto-formatting my code on save, until this was merged https://github.com/rubocop-hq/rubocop-rspec/pull/1109 (which is great in itself).

Now when I save a Rspec file with a focused spec, it removes it! eg

On saving fit "something" do, it updates it to it 'something'! (It does not remove disabled specs xit)

vscode-ruby config:

    "ruby.intellisense": "rubyLocate",
    "ruby.useLanguageServer": true,
    "ruby.codeCompletion": "rcodetools",
    "ruby.format": "rubocop", // this line causes the formatter to kick in
    "ruby.lint": {
        "rubocop": true
    },

Options

  1. I can bypass this by adding # rubocop:disable RSpec/Focus to the end, but that is annoying
  2. I can disable the cop in my local .rubocop.yml file, but then
    1. either have a local diff, and lose the check against all files when running rubocop on the command line
    2. have to check it in and everyone loses the check
  3. AFAICT there is no command-line option to disable a cop. The inverse of only would be good!
  4. But even if that option was present, can vscode-ruby be configured to modify the command line options?
  5. Others?
question from:https://stackoverflow.com/questions/66062717/vscode-ruby-rubocop-formatter-removes-focused-specs-fit-it

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...