Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
registry = RuboCop::Cop::Registry.new
registry.enlist(RuboCop::Cop::MyCustomCop)
config = RuboCop::Config.new()
options = {auto_correct: true}
team = RuboCop::Cop::Team.new(registry, config, options)
buffer = Parser::Source::Buffer.new('(string)')
buffer.source = source_string
source = RuboCop::ProcessedSource.new(buffer.source, RUBY_VERSION.to_f)
team.inspect_file(source)
new_code = team.send(:autocorrect_all_cops, buffer, team.cops)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.