Created
November 16, 2019 19:25
-
-
Save dreikanter/05e482bcb69dd57fd864bf3510da5652 to your computer and use it in GitHub Desktop.
purge_rubocop_todo.rb
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
require 'yaml' | |
data = YAML.load_file('.rubocop_todo.yml') | |
data.each do |cop, options| | |
excludes = options['Exclude'] | |
next unless excludes | |
next if excludes.empty? | |
data[cop]['Exclude'] = excludes.select do |path| | |
File.exist?(File.expand_path(path, __dir__)) | |
end | |
end | |
File.open('.rubocop_todo_NEW.yml', 'wt') { |f| YAML.dump(data, f) } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment