Closed Zhorian closed 4 years ago
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:
---force-exclusion
Thanks that worked except I think you may have added an extra dash?
--force-exclusion
worked for me!
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:
.solargraph.yml `AllCops: TargetRubyVersion: 2.6.5 Exclude: