For code in settings scripts, the answer is the same as for build scripts, write a convention plugin.
If you write them as binary plugin, implement Plugin<Settings>
instead of Plugin<Project>
or if you need one that is applicable to both (actually all three as you can also write init script plugins), Plugin<PluginAware>
.
If you write them as precompiled script plugins, name it foo.settings.gradle.kts
to write one for settings scripts instead of foo.gradle.kts
which is for build scripts.
The warning mode I don’t think you can centralize, except by using a custom Gradle distribution. Or if you just want this for yourself when running any build, put it to <GRADLE_USER_HOME>/gradle.properties
.