gradle-plugin icon indicating copy to clipboard operation
gradle-plugin copied to clipboard

The data type for arguments in the extension should be a List<String> instead of a String

Open bmuschko opened this issue 4 years ago • 3 comments

Arguments are a list of Strings. From an end user's perspective it looks counter-intuitive to put together a single String for multiple arguments. See https://github.com/snyk/gradle-plugin/blob/2e08af4d43dde43a6150902411f8ee583568a871/src/main/java/io/snyk/gradle/plugin/SnykExtension.java#L9. The handling on how those arguments are concatenated and used should be the responsibility of the plugin implementation.

snyk {
    arguments = "--dry-run --ignore-policy"
}

vs.

snyk {
    arguments = ["--dry-run", "--ignore-policy"]
}

Furthermore, the extension exposes an argument that is added to the list automatically: severity. That's not clear to the end user and could cause confusion when defined as part of arguments. Either keep the arguments as list and remove the field severity or introduce properties for each argument to be consistent.

bmuschko avatar Aug 05 '21 15:08 bmuschko

Interesting pov on the list although I do not fully agree. The severity was there by design as it was in line with how the maven plugin at that time.

bmvermeer avatar Aug 05 '21 20:08 bmvermeer

Another point is that an end user might want to extend the list of arguments later e.g. from a plugin. How do you add a new argument with the String parameter? Even if you could the end user needs to ensure that the space is added for every argument which she can get wrong easily.

bmuschko avatar Aug 05 '21 20:08 bmuschko

need to rework the extension to use the lazy gradle API's. so this should probably be a ListProperty

I think in most cases it probably won't matter that it would be a list but using a property should help ensure that people can do more advanced configuration without any extra burden on this project

trevjonez avatar Sep 08 '21 16:09 trevjonez