square / spacecommander

Commit fully-formatted Objective-C as a team without even trying.
Other
1.13k stars 177 forks source link

Run at compile-time? #25

Closed JALsnipe closed 8 years ago

JALsnipe commented 9 years ago

Is it possible to run Space Commander in Xcode, possibly as a run script phase, to identify and address potential styling issues at compile-time rather than at the point of commit?

alanf commented 9 years ago

I believe so, but you might have to make one modification. In lib/common.sh, the function objc_files_to_format() uses the argument --cached which means only files that are staged for commit will be tested for formatting issues. Make sure you remove that.

Then, create a new "Run Script" phase and have it run format-objc-hook. I haven't tried this myself, but all the precommit hook does is run the format-objc-hook script.

alanf commented 8 years ago

Please reopen if you would still like to have this as a feature of Space Commander