Follow-up from "Import the `changes_size` rule"
The following discussion from !29 (merged) should be addressed:
-
@godfat-gitlab started a discussion: (+1 comment) If
project_helper
can be based from a base helper, then we can define this method and returnDEFAULT_CHANGES_SIZE_THRESHOLDS
, and project helper can override it.I don't know if we can do this though. It's always unclear to me how Danger plugins work :(
Maybe at some point we need to make our own plugin system, and then include them into Danger helper. This way we might have better control. For example, we can have our base helper, and every project should define their helpers based on the base helper, and then include that into Danger helper, if Danger helper cannot do something like this.
I do think this will work and we might not want to invest into that yet though, so sure we can go with this first.
Rémy said:
Good idea! We could have a
helper.config
method that would default to an object with config methods such as#code_size_thresholds
, and that each consumer could inject its own config into as well with:
helper.config do |config|
config.code_size_thresholds = { high: 1_000, medium: 250 }.freeze
end
That way the lib/danger/rules/changes_size/Dangerfile
rule could always use helper.config.code_size_thresholds
.