Skip to content

Instantly share code, notes, and snippets.

@YarikST
Created August 3, 2022 15:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save YarikST/b5179f0b192bdc67c1194f44f56509a4 to your computer and use it in GitHub Desktop.
Save YarikST/b5179f0b192bdc67c1194f44f56509a4 to your computer and use it in GitHub Desktop.
Run Rubocop only on changed files
1. Create cop.diff file. On theses files we would run Rubocop
git diff-tree -r --no-commit-id --name-only --diff-filter=dr head origin/master > cop.diff
diff-filter - allow to filter some records, we dont need deleted file
origin/master - is a target for comparison
2. Run Rubocop
cat cop.diff | xargs bundle exec rubocop -A
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment