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

Art P 15 & 17 Kieswet: assign seats to candidates with preference threshold and to the rest #1110

Draft
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

Lionqueen94
Copy link
Contributor

@Lionqueen94 Lionqueen94 commented Mar 3, 2025

Description

  • Moved apportionment/mod.rs code to seat_assignment.rs and renamed all functions, structs, etc. accordingly.
  • Added candidate_nomination.rs with structs and functions for the preferential candidate nomination and other candidate nomination.
  • Changed all seats variables from u64 to u32 in accordance with number_of_seats in Election struct
  • Renamed allocate to assign
  • Update links to Kieswet to currently valid version in documentation
  • Added candidate nomination (aanwijzing van de gekozen kandidaat) to woordenlijst

Not in scope

  • Chosen candidates
  • Candidate list ranking

… functions, structs, etc. accordingly. Added candidate_nomination.rs with structs.
…didates-with-preference-threshold-and-to-the-rest
Copy link

github-actions bot commented Mar 3, 2025

Sigrid maintainability feedback

✅ You wrote maintainable code and achieved your objective of 3.5 stars

Show details

Sigrid compared your code against the baseline of 2025-03-06.

👍 What went well?

You fixed or improved 0 refactoring candidates.

👎 What could be better?

Unfortunately, 21 refactoring candidates were introduced or got worse.

Risk System property Location
🔴 Duplication
(Introduced)
backend/src/apportionment/seat_assignment.rs line 189-195
backend/src/apportionment/seat_assignment.rs line 239-245
🔴 Duplication
(Introduced)
backend/src/apportionment/seat_assignment.rs line 629-636
backend/src/apportionment/seat_assignment.rs line 645-652
🔴 Unit Size
(Worsened)
backend/src/lib.rs
create_openapi()
🟠 Unit Size
(Introduced)
backend/src/apportionment/candidate_nomination.rs
preferential_candidate_nomination([CandidateVotes],u32)
🟠 Unit Size
(Introduced)
backend/src/apportionment/seat_assignment.rs
assign_remainder([PoliticalGroupStanding],ElectionSummary,u32,u32)
🟠 Unit Size
(Introduced)
backend/src/apportionment/seat_assignment.rs
step_assign_remainder_using_largest_remainder([PoliticalGroupStanding],u32,[SeatAssignmentStep])
🟠 Unit Size
(Introduced)
backend/src/apportionment/seat_assignment.rs
reassign_residual_seat_for_absolute_majority(u32,ElectionSummary,[PGNumber],Vec<PoliticalGroupStanding>)
🟠 Unit Interfacing
(Introduced)
backend/src/apportionment/seat_assignment.rs
pg_assigned_from_previous_step(PoliticalGroupStanding,[SeatAssignmentStep],any,any,any)
⚫️ + 13 more

📚 Remaining technical debt

2 refactoring candidates didn't get better or worse, but are still present in the code you touched.

View this system in Sigrid to explore your technical debt

⭐️ Sigrid ratings

System property System on 2025-03-06 Before changes New/changed code
Volume 5.1 N/A N/A
Duplication 4.4 4.4 4.5
Unit Size 2.4 1.6 1.8
Unit Complexity 3.4 3.9 4.2
Unit Interfacing 3.1 1.4 1.3
Module Coupling 3.6 5.5 5.5
Component Independence 2.6 N/A N/A
Component Entanglement 2.9 N/A N/A
Maintainability 3.5 3.7 3.8

💬 Did you find this feedback helpful?

We would like to know your thoughts to make Sigrid better.
Your username will remain confidential throughout the process.


View this system in Sigrid

Copy link

codecov bot commented Mar 3, 2025

Codecov Report

Attention: Patch coverage is 73.34410% with 165 lines in your changes missing coverage. Please review.

Project coverage is 91.47%. Comparing base (bc7215e) to head (4dd8743).
Report is 6 commits behind head on main.

✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
backend/src/apportionment/candidate_nomination.rs 1.51% 130 Missing ⚠️
backend/src/apportionment/seat_assignment.rs 92.09% 17 Missing and 18 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1110      +/-   ##
==========================================
- Coverage   91.99%   91.47%   -0.53%     
==========================================
  Files         281      285       +4     
  Lines       17084    17450     +366     
  Branches     1494     1511      +17     
==========================================
+ Hits        15717    15962     +245     
- Misses       1265     1376     +111     
- Partials      102      112      +10     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Art P 15 & 17 Kieswet: assign seats to candidates with preference threshold and to the rest
1 participant