Skip to content

Remove hardcoded default values from rules #2597

Description

@BraisGabin

Expected Behavior

All the lines of code that we have in our production code are "meaningful".

Observed Behavior

The second parameter in this functions is never used in production: valueOrDefault(KEY, "value") and it's really missleading when you are writing/editing a rule.

Context

Working on #2498 I found some rules that doesn't have the default value hardcoded in it. And I created commits to fix that (4073097 and e7c0190)

But as I continue working in #2498 I see that there are even more rules that have this "issue".

I think that those values are there to make the tests easier. But we should not add any code in production to make the tests easier to write.

My proposal: change the use of valueOrDefault(key, value) to valueString(key), valueBoolean(key)...

Good thing: This is not a breaking change.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions