Skip to content
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

Merged
merged 6 commits into from
Mar 4, 2024
Merged

Conversation

Kaz-ookid
Copy link
Contributor

@Kaz-ookid Kaz-ookid commented Mar 3, 2024

addresses #1751

Adds validations et tests at construction of PlainVote.

@Kaz-ookid Kaz-ookid self-assigned this Mar 3, 2024
@Kaz-ookid Kaz-ookid requested a review from a team as a code owner March 3, 2024 17:05
Copy link

github-actions bot commented Mar 3, 2024

Pull reviewers stats

Stats of the last 30 days for popstellar:

User Total reviews Time to review Total comments
MariemBaccari
🥇
6
▀▀▀
2d 11m
1
pierluca
🥈
5
▀▀
2d 6h 18m
8
▀▀▀
sgueissa
🥉
2
4d 21h 28m
▀▀▀
8
▀▀▀
emonnin-epfl
2
7h 27m
1
matteosz
2
3d 3h 33m
▀▀
6
▀▀▀
jbsv
2
1d 7h 33m
0
Tyratox
1
2d 4h 54m
0
arnauds5
1
6h 55m
0
osm-alt
1
5h 52m
0
ljankoschek
1
20h 9m
0
K1li4nL
1
18m
0

@Kaz-ookid
Copy link
Contributor Author

ready for review 🎉

Copy link
Contributor

@matteosz matteosz left a 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")
Copy link
Contributor

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

Copy link
Contributor Author

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.

Copy link
Contributor

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

Copy link

sonarcloud bot commented Mar 4, 2024

Quality Gate Passed Quality Gate passed for 'PoP - PoPCHA-Web-Client'

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
No data about Duplication

See analysis details on SonarCloud

Copy link

sonarcloud bot commented Mar 4, 2024

Quality Gate Passed Quality Gate passed for 'PoP - Be2-Scala'

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
No data about Duplication

See analysis details on SonarCloud

Copy link

sonarcloud bot commented Mar 4, 2024

Quality Gate Passed Quality Gate passed for 'PoP - Be1-Go'

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
No data about Duplication

See analysis details on SonarCloud

Copy link

sonarcloud bot commented Mar 4, 2024

Copy link

sonarcloud bot commented Mar 4, 2024

Quality Gate Passed Quality Gate passed for 'PoP - Fe1-Web'

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
No data about Duplication

See analysis details on SonarCloud

Copy link
Contributor

@quadcopterman quadcopterman left a 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

@matteosz matteosz self-requested a review March 4, 2024 18:27
Copy link
Contributor

@matteosz matteosz left a 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

@Kaz-ookid Kaz-ookid merged commit 44bebc7 into master Mar 4, 2024
18 checks passed
@Kaz-ookid Kaz-ookid deleted the work-fe2-maxime-plainvote-validation branch March 4, 2024 19:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants