IMHO, issues with formating, like the ones you describe, should be cought by a linter. Or even better yet, enforce format-on-save in all editors your team uses and have it automatically re-indent and reformat the code so what indentation it was originally indented with irrelevant. I think this approach would work, but I tend to work on files < 10k LoC, it might get annoyingly slow past that.