Skip to content

Instantly share code, notes, and snippets.

@Lockyy
Last active June 6, 2023 16:23
Show Gist options
  • Save Lockyy/7e0d7736b7d897809e4b88b6114f8f12 to your computer and use it in GitHub Desktop.
Save Lockyy/7e0d7736b7d897809e4b88b6114f8f12 to your computer and use it in GitHub Desktop.
Run Rubocop on files that've changed in Git
#!/bin/bash
rubocop $(git diff --name-only --diff-filter=d main...) --force-exclusion "$@"
@Lockyy
Copy link
Author

Lockyy commented Jun 6, 2023

I've updated this to use the contents of files-diff for gathering the changed files. Typically I have that as a separate script that I use instead:

#!/bin/bash

rubocop $(files-diff) --force-exclusion "$@"

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