Closed Jason-Abbott closed 2 months ago
I knew it: it only took asking for me to figure out. It’s the “acronyms” rule.
@Jason-Abbott I'm glad you found it. The acronyms rule is disabled by default though, so I'm slightly confused as to how you had this enabled if you didn't want it?
If you are using --enable all
or something like that I would advise against it, as the rules that are disabled by default have a higher likelihood of breaking code when used indiscriminately
The fault lies with past-self who was just learning Swift a couple years ago, coming from languages where the standard for acronyms is otherwise. I must have enabled the setting to get used to the different standard.
Now I’m accustomed to Swift and forgot there even was such a SwiftFormat setting … so, no problem with SwiftFormat at all! I just kept looking for a setting about “rename” or “variable” and coming up empty.
I’ve apparently gone blind from looking too many times at the rules but cannot find the one that is causing it to rename (and thus break) variables.
These are the names of fields from an API so the names are not up to me. I can
// swiftformat:disable all
but I’d rather just disable whatever rule this is. And honestly, I can’t think of a time when I’d want any tool to change my variable names.