-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PlainVote validation #1770
PlainVote validation #1770
Conversation
Pull reviewers statsStats of the last 30 days for popstellar:
|
ready for review 🎉 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, just a small comment
) { | ||
verify() | ||
.isNotEmptyBase64(questionId, "question ID") | ||
.isNotEmptyBase64(electionId ?: "", "election ID") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see any reason why we should pass an empty string when it's null rather than just pass directly electionId
.
If electionId is null in the Election.generateElectionVoteId
function it will throw the illegal argument exception, so we can safely check if it's null right from the beginning in the MessageValidator
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I remember I did this because IDE was screaming about it, but it's not anymore... Strange 🤷♂️
You are right tho, thanks 👍
Also is there a reason we had String?
and not String
for electionId? I did not want to touch it without knowing, but in my opinion we can just remove the ?
to ensure we are not given a null argument.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IIRC I left the String
? instead to force String
because it would have meant to change some tests that were passing null as value (they wouldn't be compiled anymore). But for the sake of the application itself, yeah it would have been better to just have String
Quality Gate passed for 'PoP - PoPCHA-Web-Client'Issues Measures |
Quality Gate passed for 'PoP - Be2-Scala'Issues Measures |
Quality Gate passed for 'PoP - Be1-Go'Issues Measures |
Quality Gate passed for 'PoP - Fe2-Android'Issues Measures |
Quality Gate passed for 'PoP - Fe1-Web'Issues Measures |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work!
Nit comment: try not to have commits like 'addressing comment from XX' but rather 'doing XX', as commits are often seen without their PR, so no one actually will know what the commit does without looking at the code change
addresses #1751
Adds validations et tests at construction of PlainVote.