-
-
Save dvandersluis/0d692eafd4696f542f5bd6abd1840043 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
describe 'cop description' do | |
let(:cops) do | |
RuboCop::Cop::Cop | |
.registry | |
.without_department(:Test) | |
.without_department(:InternalAffairs) | |
.cops | |
end | |
let(:config) { RuboCop::ConfigLoader.load_file('config/default.yml') } | |
it 'includes a @safety YARD tag for all cops that are `Safe: false` or `SafeAutoCorrect: false`' do | |
require 'yard' | |
YARD::Registry.load! | |
cops.each do |cop| | |
cop_config = config.dig(cop.cop_name) | |
next unless cop_config['Safe'] == false || cop_config['SafeAutoCorrect'] == false | |
yard = YARD::Registry.resolve(nil, cop.name) | |
expect(yard.tags('safety')).to_not be_empty, "unsafe cop `#{cop.cop_name}` is missing a `@safety` block in its description" | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment