Skip to content

Instantly share code, notes, and snippets.

@ainame
Last active April 22, 2021 09:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ainame/710060e5387d62b5e64faecf4a5fee52 to your computer and use it in GitHub Desktop.
Save ainame/710060e5387d62b5e64faecf4a5fee52 to your computer and use it in GitHub Desktop.
require 'yaml'
cops = File.read('.rubocop_todo.yml')
.split("\n\n")
.drop(1)
.map {
{
count: _1.match(/Offense count: (\d+)/).captures[0].to_i,
yaml: YAML.load(_1),
auto_correct: _1.match(/Cop supports --auto-correct/) != nil
}
}
# => {:count=>1, :yaml=>{"Style/TrailingCommaInHashLiteral"=>{"Enabled"=>false}}, :auto_correct=>true}
# ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment