Or even an on-save or (and more likely to prevent this kind of error in a large file) as-you-type feature in your IDE/editor.
Available autoformatting is great, but IIRC the Apple issue happened in an automatic merge. Autoformatting would still help it be noticed, when someone wondered why the formatter changed some bit of the code they hadn't touched, but a formatting check in with the automated tests would catch it faster.