Last active
December 9, 2023 05:32
-
-
Save dazza-codes/9d6bc4412f43847fc425 to your computer and use it in GitHub Desktop.
Run rubocop on files changed in git repository
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
#!/bin/bash | |
# check modified (M) ruby (.rb) files with rubocop | |
git status --porcelain | grep '^ M.*.rb' | cut -c4- | xargs -r rubocop |
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
#!/bin/bash | |
# check all ruby files for changes against the master branch | |
git diff --name-only HEAD..master | grep -E -i 'rake|*.rb|*.erb' | xargs -r bundle exec rubocop |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment