Last active
January 19, 2022 17:16
-
-
Save iamricks/dc7530bfa0aef3bbd4a7fad3c72d5899 to your computer and use it in GitHub Desktop.
Find syntax errors before pushing to git, good for avoiding a push to Heroku that takes down production ;)
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
# Find files modified | |
# Only works before git add | |
modified_file_paths = %x(git diff --name-only).split("\n") | |
# Make sure zeitwerk doesn't surprise you | |
print(%x(bin/rails zeitwerk:check)) | |
# Loop through files and check syntax, print status | |
modified_file_paths.each do |path| | |
next if !path.include?('.rb') | |
print(%x(ruby -c #{path})) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment