Skip to content

Fix sonarqube quality issues - #3836

Merged
jmthomas merged 2 commits into
mainfrom
sonar-reliability
Sep 8, 2026
Merged

Fix sonarqube quality issues#3836
jmthomas merged 2 commits into
mainfrom
sonar-reliability

Conversation

@jmthomas

@jmthomas jmthomas commented Sep 6, 2026

Copy link
Copy Markdown
Member

What changed

Implement a few SonarQube quality fixes. No functionality change.

Why it changed

SonarQube marked it as high

Testing strategy

CI/CD

@jmthomas
jmthomas requested review from calmonroe and mcosgriff and a lite review from Copilot September 6, 2026 22:08
@codecov

codecov Bot commented Sep 6, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 79.28%. Comparing base (679c8b9) to head (3d9035c).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3836      +/-   ##
==========================================
- Coverage   79.30%   79.28%   -0.02%     
==========================================
  Files         896      896              
  Lines       67371    67373       +2     
  Branches     2608     2608              
==========================================
- Hits        53426    53420       -6     
- Misses      13276    13287      +11     
+ Partials      669      666       -3     
Flag Coverage Δ
frontend 66.55% <ø> (-0.01%) ⬇️
python 79.36% <ø> (+<0.01%) ⬆️
ruby-api 82.03% <ø> (-0.15%) ⬇️
ruby-backend 84.58% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

The updated asyncio shutdown flow can have cleanup interrupted by cancellation and also risks silently suppressing unexpected task exceptions.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

Implements small “quality” refactors flagged by SonarQube across Python and Ruby code, primarily around comparison helpers, environment-variable access, and asyncio cancellation/cleanup behavior.

Changes:

  • Add @total_ordering to SegmentedPolynomialConversion.Segment to synthesize missing comparison operators.
  • Reduce repeated env-var lookups in JsonApi#_generate_url by caching OPENC3_OPERATOR_HOSTNAME.
  • Refactor asyncio task cancellation/cleanup logic in the throughput server example.
File summaries
File Description
openc3/python/openc3/conversions/segmented_polynomial_conversion.py Adds total_ordering to complete ordering operations on Segment.
openc3/lib/openc3/io/json_api.rb Caches OPENC3_OPERATOR_HOSTNAME lookup to avoid repeated ENV access.
examples/throughput_server/throughput_server.py Refactors cancellation/cleanup logic for background tasks and server shutdown.
Review details
  • Files reviewed: 3/3 changed files
  • Comments generated: 2
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread examples/throughput_server/throughput_server.py Outdated
Comment thread examples/throughput_server/throughput_server.py
@sonarqubecloud

sonarqubecloud Bot commented Sep 6, 2026

Copy link
Copy Markdown

# A polynomial conversion segment which applies the conversion from the
# lower bound (inclusive) until another segment's lower bound is
# encountered.
@total_ordering

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Neat decorator, it will create the remaining rich comparison functions as well, is that alright?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Yes, we're only using the less than and equal for the logic. Note that our less than only compares bounds while the equal compares bounds and coeffs. Not sure if the comparison with coeffs is strictly necessary in production but it looks like it helps our unit tests.

@jmthomas
jmthomas merged commit 0d5bf80 into main Sep 8, 2026
36 checks passed
@jmthomas
jmthomas deleted the sonar-reliability branch September 8, 2026 15:33
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.

3 participants