Rubocop TIP output is going to files on auto save
See original GitHub issueAfter upgrading to 1.5.1, Rubocop by default prints the following message in the console when you run the command:
Tip: Based on detected gems, the following RuboCop extension libraries might be helpful:
* rubocop-rails (http://github.com/rubocop-hq/rubocop-rails)
* rubocop-rspec (http://github.com/rubocop-hq/rubocop-rspec)
You can opt out of this message by adding the following to your config (see https://docs.rubocop.org/rubocop/extensions.html#extension-suggestions for more options):
AllCops:
SuggestExtensions: false
This exact message appears at the end of every file when I save using the auto formatting in the VSCode Extension.
Versions
- Ruby 2.5.1p57 (2018-03-29 revision 63029)
- gem Rubocop: ~> 1.5.1
- VSCode
Version: 1.51.1
Commit: e5a624b788d92b8d34d1392e4c4d9789406efe8f
Date: 2020-11-10T23:31:29.624Z
Electron: 9.3.3
Chrome: 83.0.4103.122
Node.js: 12.14.1
V8: 8.3.110.13-electron.0
OS: Linux x64 4.15.0-118-generic
- ruby-rubocop: 0.8.5
Relevant VSCode preferences
{
"ruby.format": "rubocop",
"editor.formatOnSave": true,
"editor.formatOnSaveTimeout": 5000,
"[ruby]": {
"editor.defaultFormatter": "misogi.ruby-rubocop"
},
"ruby.rubocop.useBundler": true,
}
Setting the option SuggestExtensions: false
as showed by Rubocop fixes the issue; for now.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:4
- Comments:7 (1 by maintainers)
Top Results From Across the Web
Developers - Rubocop TIP output is going to files on auto save -
Rubocop TIP output is going to files on auto save. ... After upgrading to 1.5.1, Rubocop by default prints the following message in...
Read more >vscode( vscode-ruby + rubocop ) how to auto correct on save?
Question. I was under the inpression that vscode-ruby and rubocop would auto-correct indentations and cop rules on file save, but apparently it ...
Read more >Basic Usage :: RuboCop Docs
Run all cops enabled by configuration except the specified cop(s) and/or departments. --exclude-limit. Limit how many individual files --auto-gen-config can ...
Read more >Rubocop - 4 ways to reduce your frustration! | Hanami Mastery
In this episode, I'll show you how to keep it only in the loved section. ... Rubocop Allows you to automatically generate a...
Read more >How to Use Rubocop for Your Team's Rails Apps - Semaphore
Rubocop gets its configuration from the automatically generated .rubocop.yml file. If you've already run Rubocop with --auto-gen-config , then ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
The bug here is that those messages should not be written into the .rb source file. The extension is writing them into the .rb source file, meaning that attempting to save an .rb file causes the editor to append invalid syntax, (those messages) breaking the file.
Diagnostic, warning, and error messages should be displayed in VSCode’s interface, not written into source code. If the existence of those messages makes it impossible to format a file, then the file should remain unmodified.
On Mon, Dec 21, 2020, 1:54 AM Daniel Vandersluis notifications@github.com wrote:
This is not a RuboCop bug, but rather a bug of how this library is calling RuboCop. The suggested extensions text only is added when using a formatter that is intended for human consumption. If this library used a RuboCop formatter meant for parsing (
-f j
for json for instance), the text would not be output by RuboCop and then added to your code.