Skip to content

Instantly share code, notes, and snippets.

@dazza-codes
Last active December 9, 2023 05:32
Show Gist options
  • Save dazza-codes/9d6bc4412f43847fc425 to your computer and use it in GitHub Desktop.
Save dazza-codes/9d6bc4412f43847fc425 to your computer and use it in GitHub Desktop.
Run rubocop on files changed in git repository
#!/bin/bash
# check modified (M) ruby (.rb) files with rubocop
git status --porcelain | grep '^ M.*.rb' | cut -c4- | xargs -r rubocop
#!/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