weavejester / cljfmt

A tool for formatting Clojure code
Eclipse Public License 1.0
1.11k stars 120 forks source link

Add CLI option to parallelize file processing #257

Closed or closed 2 years ago

or commented 2 years ago

The files processed by the 'fix' and 'check' commands can be processed in an arbitrary order and each file can be processed independently, so the whole process can be parallelized.

To make sure threads aren't writing to stdout/stderr at the same time, the result for each file is captured and then printed in order once every file is done. The 'check' command already did this via print-file-status, the 'fix' command now uses the same mechanism.

Addresses one part of #254.

weavejester commented 2 years ago

To make sure threads aren't writing to stdout/stderr at the same time, the result for each file is captured and then printed in order once every file is done.

Can you explain how you're doing this? I'm not sure I'm following the logic.

weavejester commented 2 years ago

Ah, wait, I see. Nevermind 😃

or commented 2 years ago

Removed the (flush). I needed that in a previous version, but no more.

Also noticed that there might be an opportunity to merge check and fix, now that they look so similar.

or commented 2 years ago

Cool, thanks. This resolves #104 and #185 as well.