Clean up formatter code
See the individual commit messages for details.
I noticed that the first commit in this merge request is a superset of the first commit in !45. However !45 is stuck in review because of a discussion of its second commit. Whichever merge request is merged first, rebasing the other one should not be difficult because the overlapping part of the commits is identical.
I have another branch with fixes based on this one: https://invent.kde.org/igorkushnir/kdevelop/-/commits/fix-astyle-plugin-options. It is much less straightforward than this one, so I keep it separate. I'll wait until this merge request makes it to master before creating the second merge request to avoid conflicts.