⚠ This page is served via a proxy. Original site: https://github.com
This service does not collect credentials or authentication data.
Skip to content

Conversation

@shaeespring
Copy link
Contributor

@shaeespring shaeespring commented Dec 25, 2025

Fixes 3/5 maintainability issues outlined in dev's PR to main #56

  • Reduces the complexity of the calculateRankedChoice function (check my math, I might need helper functions to get the number lower, or it might just be fine)
  • Fixes a variable name

Notes

Doesn't touch the TODO comments (the other 2 SonarQube issues).
Labeled $match issue (sonarqube wanted this to be a constant) as a false positive

Copy link
Contributor

@costowell costowell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall looks good. Still not totally sold on the MATCH thing, but totally open to feedback.

database/poll.go Outdated

const POLL_TYPE_SIMPLE = "simple"
const POLL_TYPE_RANKED = "ranked"
const MATCH = "$match"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can see where you're (SonarQube is?) going with this, but I'm not so sure this improves maintainability. I think it'd be better to keep this in the query because that's how mongo queries look like i.e.

{ $match: { salary: 9000 } }

I would like more input though, I could be totally crazy.

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 can mark it in SonarQube as a false positive because of the query reasoning

Copy link
Contributor

@BigSpaceships BigSpaceships left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Copy link
Contributor

@costowell costowell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@shaeespring shaeespring merged commit a402df0 into dev Jan 13, 2026
1 check passed
shaeespring added a commit that referenced this pull request Jan 20, 2026
* fixed bug where it would crash if you filled in all canidates + write in (#46)

* Check that candidates are not ranked identically (#47)

* Check that candidates are not ranked identically

* fix bug where write in candidates weren't checked for duplicate rankings

* simplified range cause yeah

* i think i actually fixed it this time

* http response for consistency

* removed extra period

---------

Co-authored-by: Noah <[email protected]>

* Always stop once the majority is hit (#50) @tallen42

* Always stop at majority

* End is always true if finalResult is calculated

* If hidden, say results soon, otherwise URL (#51) @tallen42

* yippee sonarqube support (#54) @Will-Hellinger

* Set up golang CI

* go mod tidy

* gofmt

* Allow hiding results while poll is open

this replaces the current hide functionality

* Clarify dev setup for compose

* go mod download as a separate layer for caching

* Allow alumni to dev

* Make polls modifiable by removing Reveal

Polls that are hidden really shouldn't be revealed

* Create dev mode evals override

* Clarify gatekeep autoclose for evals

* Initial setup for golang tests

* Rewrite orderOptions to avoid hanging

Also write tests

* Run go vet

* Maintainability (#58)

* min number and cognitive complexity

* variable name

* revert match constant and import math

* Logging dependabot readme pr template (#59)

* remove debug log call and added dev flags log messages

* update readme with some todos

* Create pull request template

* Add Dependabot configuration for Go modules

* oops forgot target-branch

---------

Co-authored-by: Noah Hanford <[email protected]>
Co-authored-by: Tyler Allen <[email protected]>
Co-authored-by: William Hellinger <[email protected]>
Co-authored-by: Max Meinhold <[email protected]>
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.

4 participants