Skip to content

Instantly share code, notes, and snippets.

@paul
Created May 24, 2024 16:59
Show Gist options
  • Save paul/7da6e74efa3a682c4e0aa5885b18915c to your computer and use it in GitHub Desktop.
Save paul/7da6e74efa3a682c4e0aa5885b18915c to your computer and use it in GitHub Desktop.
# Auto-correct files that get generated
g.after_generate do |files|
parsable_files = files.filter { |file| File.exist?(file) && file.end_with?(".rb") }
unless parsable_files.empty?
system("bundle", "exec",
"rubocop",
"--autocorrect-all",
"--fail-level=E",
"--format=quiet",
*parsable_files,
exception: true)
end
end
@paul
Copy link
Author

paul commented May 24, 2024

Originally from https://ruby.social/@kotogavr/112495584388210864

I made it copy/pastable, and let it handle "pretend" mode with File.exists?.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment