Currently, as per the documentation, we can either provide no configuration file to use the default config or provide a
.swift-format file or a custom path to
--configuration to use our own configuration. So some time ago, like recommended in the docs, I ran
swift-format dump-configuration and saved the contents to a
.swift-format file to make some small adjustments (e.g. changing the
lineLength option from to my own preference). Then I forgot of that config file for a while, to find out today that many new options were added to the default config file which I might want to use, but I didn't notice they were added.
I propose that we add a way to explicitly specify that one wants to use the default config file with some custom overrides rather than limiting the options to what's specified in the custom config file. This way, when new features are added, one can profit from them. The existing behavior should stay for those who actually just want the rules they have specified. But I propose we introduce a new default file name, e.g.
.swift-format-overrides and an option
--default-overrides. When one of these is specified, the default config file will be used but all options set in these overrides files are overridden in the default settings with the user-provided settings.
BTW: Specifying both
--default-overrides or both
.swift-format-overrides is considered an error as these options should be mutually exclusive.
I would be up to implementing this (unless someone wants to volunteer), but before sending a PR right away I thought it's best to discuss the API a little bit.
By the way: It's nowhere documented where such discussions as this could be contributed, I think that's also something that should change. If this is the official place to discuss or request new rules, it should be documented. Or even better, we could also just use GitHub Discussions. But that's another topic.