refactor: extract hardcoded plot-math literals into named constants - #172
Conversation
Adds NYQUIST_DIVISOR, MIN_PLOT_FREQUENCY_HZ, MOTOR_SPECTRUM_AXIS_ORIGIN, MOTOR_SPECTRUM_Y_LABEL_PRECISION_THRESHOLD, and STFT_OVERLAP_COMPLEMENT_BASE to constants.rs, replacing hardcoded literals in plot_bode.rs, plot_motor_spectrums.rs, and plot_psd_db_heatmap.rs. Pure naming refactor, no logic change; output verified byte-identical to master via md5sum across 4 flight logs with --extended --bode --butterworth --estimate-optimal-p. Closes #167
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Team Run ID: 📒 Files selected for processing (4)
Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review. 📜 Recent review details🧰 Additional context used📓 Path-based instructions (1)All constants go in `src/constants.rs` — no hardcoded magic numbers in function code Axis indices (0=Roll, 1=Pitch, 2=Yaw) must use the `src/axis_names.rs` module with `AXIS_COUNT`, `AXIS_NAMES`, and `axis_name()` function instead of creati...📄 CodeRabbit inference engine (AGENTS.md) Files:
🔇 Additional comments (4)
📝 WalkthroughWalkthroughThe change extracts plot-math literals into public constants. Bode, motor spectrum, and STFT heatmap code now use named constants while preserving the existing numeric behavior. ChangesPlot Math Constants
Estimated code review effort: 2 (Simple) | ~10 minutes Merge Risk: ⚪ Minimal · up to This change only names existing plot-math values without changing generated behavior; the validated outputs remain identical, so no actionable merge-blocking risk remains beyond normal checks and review. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Full details: Linked Issues checkExplanation The pull request satisfies issue ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
@coderabbitai review |
|
|
@coderabbitai review |
|
|
@coderabbitai review |
✅ Action performedReview finished.
|
AI Generated pull-request
Extracts hardcoded numeric literals flagged by CodeRabbit on PR#166 (pre-existing on master, relocated but not introduced by that PR) into named constants per
AGENTS.md's constants policy.Constants added (
src/constants.rs)NYQUIST_DIVISOR(2.0) — shared Nyquist-divisor pattern inplot_bode.rsandplot_motor_spectrums.rsMIN_PLOT_FREQUENCY_HZ(1.0) — Bode plot frequency-axis floorMOTOR_SPECTRUM_AXIS_ORIGIN(0.0) — shared X/Y axis origin inplot_motor_spectrums.rsMOTOR_SPECTRUM_Y_LABEL_PRECISION_THRESHOLD(5.0) — label-precision threshold inplot_motor_spectrums.rs, distinct fromMOTOR_SPECTRUM_Y_AXIS_MAXSTFT_OVERLAP_COMPLEMENT_BASE(1.0) — overlap-complement base inplot_psd_db_heatmap.rsVerification
cargo clippy --all-targets --all-features -- -D warnings: cleancargo fmt --all: appliedcargo test --verbose: 83 passed, 0 failedcargo build --release: succeedsbc439f0) and this branch, ran both with--extended --bode --butterworth --estimate-optimal-pagainst 4 flight logs (BTFL, EmuFlight, LUX, HELIO), md5sum-compared all 62 generated PNG/markdown outputs — byte-identical.Closes #167
Summary by CodeRabbit