I was wondering how people deal with working in a project with badly written and formatted code, I'm talking mixed tabs and spaces, unnecessary parentheses and newlines and a whole bunch of warnings appearing on the code from the IDE. For context I have this problem on java projects, where no formatting was agreed upon. Also, in my case they are projects that have not gone public yet.
The possible solutions I can see are:
- Try and talk to the team leader/code owner, agree to a formatting and reformat everything in one commit. (my preferred choice)
- Format the piece or pieces of code that you have to change, commit, then make the change and commit (second best)
- Deal with it, make your changes as minimal as possible, leaving everything else as was.. (worst choice, for me)