Skip to content

Commit 83df552

Browse files
committed
refactor: use OPTIONS_PER_ROLE where needed
In some part of the code, we have the `OPTIONS_PER_ROLE` value hardcoded as in return frequencyMap.values().stream().filter(value -> value != 3).count(); Replace the hardcoded 3 with the actual constant we have previously made so that it mirrors any potential changes we make in the future regarding this value (perhaps we decide to remove emojis as arguments and suddenly we find ourselves in a situation where the `OPTIONS_PER_ROLE` constant is now 2. Suggested-by: Zabuzard <zabuza.dev@gmail.com> Signed-off-by: Chris Sdogkos <work@chris-sdogkos.com>
1 parent 81b6557 commit 83df552

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

application/src/main/java/org/togetherjava/tjbot/features/roleapplication/CreateRoleApplicationCommand.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ private static long getIncorrectRoleArgsCount(final List<OptionMapping> args) {
193193
.map(name -> name.split(OPTION_PARAM_ID_DELIMITER)[1])
194194
.forEach(number -> frequencyMap.merge(number, 1, Integer::sum));
195195

196-
return frequencyMap.values().stream().filter(value -> value != 3).count();
196+
return frequencyMap.values().stream().filter(value -> value != OPTIONS_PER_ROLE).count();
197197
}
198198

199199
/**

0 commit comments

Comments
 (0)