You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using rubocop diagnostics I expect it to utilise the .rubocop.yml config at the root of my project, this doesn't seem to be the case as I'm getting errors on a file I've excluded. The yml file is picked up if I run rubocop from the command line. The same issue seems to be happening with vscode-ruby.
The way RuboCop handles excluded_files is a little confusing. When you run RuboCop on a directory, it uses the configuration. When you run it on a specific file, it assumes that you want a report regardless of whether the file is excluded. Solargraph runs RuboCop on the file when you open it in an editor, so you get the latter behavior.
It's hard to say which option is correct. Some users might want to see diagnostics while they're in the process of editing an excluded file, even if it won't appear in directory reports. Others might not.
The current workaround is to add a .rubocop file with the following:
When using rubocop diagnostics I expect it to utilise the .rubocop.yml config at the root of my project, this doesn't seem to be the case as I'm getting errors on a file I've excluded. The yml file is picked up if I run rubocop from the command line. The same issue seems to be happening with vscode-ruby.
settings.json
{ "editor.formatOnSave": true, "editor.formatOnSaveTimeout": 5000, "emmet.includeLanguages": { "html.erb": "html", "erb": "html" }, "powermode.enabled": true, "powermode.enableShake": false, "ruby.useLanguageServer": true, // "ruby.lint": { // "rubocop": { // "useBundler": true // } // }, "ruby.format": "rubocop", "ruby.useBundler": true, "solargraph.diagnostics": true, "workbench.colorTheme": "Blueberry Banana", "workbench.iconTheme": "vscode-icons", "git.enableSmartCommit": true, "git.confirmSync": false, "files.autoSave": "afterDelay" }
.rubocop.yml
AllCops: TargetRubyVersion: 2.6.5 Exclude: - "**/*.erb" - db/schema.rb - "bin/**/*" - "node_modules/**/*" - test/test_helper.rb - test/channels/application_cable/connection_test.rb
.solargraph.yml
AllCops: TargetRubyVersion: 2.6.5 Exclude: - "**/*.erb" - db/schema.rb - "bin/**/*" - "node_modules/**/*" - test/test_helper.rb - test/channels/application_cable/connection_test.rb
The text was updated successfully, but these errors were encountered: