save-cli icon indicating copy to clipboard operation
save-cli copied to clipboard

Refactor PluginConfigs merge methods

Open kgevorkyan opened this issue 4 years ago • 0 comments

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

kgevorkyan avatar Jun 23 '21 14:06 kgevorkyan