I'm trying to pipe filnames into Rubocop as such:

$ git diff --name-only | tr '\n' ' ' | rubocop

However Rubocop still checks all project files.

Is there something wrong on my piping? On Rubocop? Somewhere else?

  • Did you try with rubocop --stdin – Tux_DEV_NULL Jul 2 '18 at 14:08
  • missing argument: --stdin – bjacquet Jul 2 '18 at 16:24

I'm answering myself because I discovered how to do it using xargs.

$ git diff --name-only | xargs rubocop

Your Answer

By clicking "Post Your Answer", you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.