VSCode/Rubocop complaining about unconfigured cops
·
Answer a question
I've recently updated rubocop for a gem I'm working on. When I open a ruby file in the project using VSCode, I get the following warning:
The following cops were added to RuboCop, but are not configured. Please set Enabled to either `true` or `false` in your `.rubocop.yml` file:
- Lint/RaiseException (0.81)
- Lint/StructNewOverride (0.81)
- Style/HashEachMethods (0.80)
- Style/HashTransformKeys (0.80)
- Style/HashTransformValues (0.80)
For more information: https://docs.rubocop.org/en/latest/versioning/
Here is my .rubocop.yml file:
Metrics/MethodLength:
Max: 20
Layout/LineLength:
Max: 100
AllCops:
Exclude:
- 'spec/**/*'
When I visit the url in the warning it mentions adding a NewCops setting like so:
Metrics/MethodLength:
Max: 20
Layout/LineLength:
Max: 100
AllCops:
NewCops: enable
Exclude:
- 'spec/**/*'
However, I'm getting this new warning:
Warning: AllCops does not support NewCops parameter.
Supported parameters are:
- RubyInterpreters
- Include
- Exclude
- DefaultFormatter
- DisplayCopNames
- DisplayStyleGuide
- StyleGuideBaseURL
- ExtraDetails
- StyleGuideCopsOnly
- EnabledByDefault
- DisabledByDefault
- UseCache
- MaxFilesInCache
- CacheRootDirectory
- AllowSymlinksInCacheRootDirectory
- TargetRubyVersion
The following cops were added to RuboCop, but are not configured. Please set Enabled to either `true` or `false` in your `.rubocop.yml` file:
- Lint/RaiseException (0.81)
- Lint/StructNewOverride (0.81)
- Style/HashEachMethods (0.80)
- Style/HashTransformKeys (0.80)
- Style/HashTransformValues (0.80)
For more information: https://docs.rubocop.org/en/latest/versioning/
The warning instructs me to enable each of these new cops individually but the docs seem to have an easier solution that doesn't work. What am I doing wrong here?
Answers
I have the same issue here. The NewCops parameter inside AllCops is not recognized so there is only one way to do it which is by disabling or enabling each cop alone like so:
Lint/RaiseException:
Enabled: false
Lint/StructNewOverride:
Enabled: false
Style/HashEachMethods:
Enabled: false
Style/HashTransformKeys:
Enabled: false
Style/HashTransformValues:
Enabled: false
Hope this was helpful.
更多推荐
所有评论(0)