Skip to content

Conversation

@Lionqueen94
Copy link
Contributor

@Lionqueen94 Lionqueen94 commented Dec 22, 2025

Closes #2650

Tip: Review per commit!

Description

Functions improved (removed #[allow(clippy::too_many_lines)]):

  • src/
    • committee_session/status.rs: change_committee_session_status
    • election/api.rs: election_import
    • eml/eml230.rs: candidates_from_abacus_election
    • investigation/api.rs: polling_station_investigation_update
    • pdf_gen/votes_table.rs: VotesTable new
    • report/api.rs:
      • into_pdf_file_models
      • get_files
    • summary/mod.rs: from_results
  • test_data_gen/
    • generators.rs: create_test_election

Functions improved (removed #[allow(clippy::cognitive_complexity)]):

  • src/
    • pdf_gen/external.rs: generate_pdfs (also had #[allow(clippy::too_many_lines)] but this was not needed)
    • report/api.rs: get_files

13 instances of #[allow(clippy::too_many_lines)] left in the codebase of which 3 related to generating test elections

@Lionqueen94 Lionqueen94 self-assigned this Dec 22, 2025
@github-actions
Copy link

github-actions bot commented Dec 22, 2025

Sigrid maintainability feedback

↗️ You improved your code towards your objective of 3.5 stars.

Show details

Sigrid compared your code against the baseline of 2025-12-29.

👍 What went well?

You fixed or improved 59 refactoring candidates.

Risk System property Location
🔴 Duplication
(Fixed)
backend/src/investigation/api.rs line 227-242
backend/src/investigation/api.rs line 322-337
🔴 Duplication
(Fixed)
backend/src/investigation/api.rs line 375-381
backend/src/polling_station/api.rs line 285-291
backend/src/investigation/api.rs line 291-297
🔴 Duplication
(Fixed)
backend/src/investigation/api.rs line 134-142
backend/src/investigation/api.rs line 307-315
backend/src/investigation/api.rs line 210-218
🔴 Duplication
(Fixed)
backend/src/pdf_gen/embedded/mod.rs line 33-38
backend/src/pdf_gen/external.rs line 15-20
🔴 Duplication
(Fixed)
backend/src/document/api.rs line 127-134
backend/src/document/api.rs line 45-52
backend/src/report/api.rs line 520-527
🔴 Duplication
(Fixed)
backend/src/eml/eml_230.rs line 179-185
backend/src/eml/eml_110.rs line 295-301
🔴 Duplication
(Fixed)
backend/src/committee_session/api.rs line 294-304
backend/src/investigation/api.rs line 392-404
🔴 Duplication
(Fixed)
backend/src/data_entry/structs.rs line 241-247
backend/src/summary/mod.rs line 80-86
⚫️ + 51 more

👎 What could be better?

Unfortunately, 55 refactoring candidates were introduced or got worse.

Risk System property Location
🔴 Duplication
(Introduced)
backend/src/document/api.rs line 36-52
backend/src/report/api.rs line 469-485
backend/src/document/api.rs line 118-134
🔴 Duplication
(Introduced)
backend/src/document/api.rs line 201-217
backend/src/report/api.rs line 541-557
🔴 Duplication
(Introduced)
backend/src/document/api.rs line 201-216
backend/src/investigation/api.rs line 423-438
backend/src/report/api.rs line 541-556
🔴 Duplication
(Introduced)
backend/src/investigation/api.rs line 405-420
backend/src/polling_station/api.rs line 312-327
🔴 Duplication
(Introduced)
backend/src/committee_session/api.rs line 135-145
backend/src/committee_session/api.rs line 262-272
🔴 Duplication
(Introduced)
backend/src/eml/eml_230.rs line 22-30
backend/src/eml/eml_110.rs line 24-32
🔴 Duplication
(Introduced)
backend/src/investigation/api.rs line 87-98
backend/src/investigation/api.rs line 259-270
🔴 Duplication
(Introduced)
backend/src/committee_session/api.rs line 172-183
backend/src/election/api.rs line 189-200
⚫️ + 47 more

📚 Remaining technical debt

46 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-12-29 Before changes New/changed code
Volume 3.4 N/A N/A
Duplication 3.7 3.2 3.3
Unit Size 2.2 1.5 1.5
Unit Complexity 3.0 2.7 3.4
Unit Interfacing 2.9 1.1 1.0
Module Coupling 3.3 3.8 3.9
Component Independence 2.0 N/A N/A
Component Entanglement 2.3 N/A N/A
Maintainability 2.9 2.7 2.9

💬 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

@Lionqueen94 Lionqueen94 changed the title Removed #[allow(clippy::too_many_lines)] by reducing length of functions WIP: Removed #[allow(clippy::too_many_lines)] by reducing length of functions Dec 22, 2025
@codecov
Copy link

codecov bot commented Dec 22, 2025

Codecov Report

❌ Patch coverage is 90.65817% with 44 lines in your changes missing coverage. Please review.
✅ Project coverage is 91.89%. Comparing base (314a273) to head (2ad51af).

Files with missing lines Patch % Lines
backend/src/eml/common.rs 0.00% 33 Missing ⚠️
backend/src/report/api.rs 97.02% 2 Missing and 3 partials ⚠️
backend/src/files/mod.rs 92.30% 1 Missing and 1 partial ⚠️
backend/src/pdf_gen/votes_table.rs 95.74% 1 Missing and 1 partial ⚠️
backend/src/eml/eml_230.rs 0.00% 1 Missing ⚠️
backend/src/test_data_gen/generators.rs 97.29% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2664      +/-   ##
==========================================
+ Coverage   91.82%   91.89%   +0.07%     
==========================================
  Files         376      376              
  Lines       18380    18492     +112     
  Branches     1711     1710       -1     
==========================================
+ Hits        16877    16993     +116     
+ Misses       1409     1406       -3     
+ Partials       94       93       -1     

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

@Lionqueen94 Lionqueen94 added backend Issues or pull requests that relate to the backend tech debt Tech debt, potential refactorings labels Dec 23, 2025
…rten candidates_from_abacus_election function
@Lionqueen94
Copy link
Contributor Author

Lionqueen94 commented Dec 24, 2025

I'll make a new PR for improvements to the validation.rs file. This one can be reviewed now :)

Edit: Done: #2665

@Lionqueen94 Lionqueen94 marked this pull request as ready for review December 24, 2025 12:40
@Lionqueen94 Lionqueen94 requested a review from a team as a code owner December 24, 2025 12:40
@praseodym praseodym changed the title WIP: Removed #[allow(clippy::too_many_lines)] by reducing length of functions Refactor long Rust functions Dec 24, 2025
@github-actions
Copy link

PDF Diff Summary

Comparing against base branch: main

File Status
model-n-10-2.pdf ✅ No changes
model-na-14-2-bijlage1.pdf ✅ No changes
model-na-14-2.pdf ✅ No changes
model-na-31-2-bijlage1.pdf ✅ No changes
model-na-31-2-inlegvel.pdf ✅ No changes
model-na-31-2.pdf ✅ No changes
model-p-2a.pdf ✅ No changes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backend Issues or pull requests that relate to the backend tech debt Tech debt, potential refactorings

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Remove #[allow(clippy::too_many_lines)] by reducing length of functions

3 participants