save-cli
save-cli copied to clipboard
Refactor PluginConfigs merge methods
Now we use two different approaches in SaveProperties and in PluginConfigs for the same issues in process of fields merging.
While in SaveProperties we do all work in one method
optionFromCli ?: optionFromFile ?: defaultValue
But in PluginConfigs, we firstly merge current field with parent, and after that set default values in validation method.
E.g. in WarnConfig:
fun mergeWith() {
...
this.execFlags ?: other.execFlags,
...
}
fun validateAndSetDefaults() {
...
execFlags ?: "",
...
}
It's suggested to use approach from SaveProperties in PluginConfigs:
fun mergeWith() {
...
this.execFlags ?: other.execFlags ?: "",
...
}
It also will be good to do it in table view:
// | current value---------- |value from parent--------- | default value
this.execFlags ?: other.execFlags ?: "",
this.exactWarningsMatch ?: other.exactWarningsMatch ?: true