Lint repeated if
/else if
/ else
after a certain threshold?
#1868
Labels
if
/else if
/ else
after a certain threshold?
#1868
After a certain point, a block of conditional statements can become quite difficult to read, maintain, and extend further.
To see what I mean, consider this example from
{insight}
:The alternative here is to create a look-up table (using a data frame, named vector/list, etc.), which is much easier to read, and importantly, extend - we just need to add another row for every new transformation:
That said, I am not sure where to draw the line, i.e., how many repeats of
if
+else if
is too many. Maybe this can be configurable?Also, note that this is a different linter from any of the existing or proposed ones:
ifelse()
ifelse()
That said, IINM, it does have some overlap with Google's
IfSwitchLinter()
.The text was updated successfully, but these errors were encountered: