Skip to content

Conversation

haslinghuis
Copy link
Member

@haslinghuis haslinghuis commented Oct 3, 2025

Summary by CodeRabbit

  • Refactor

    • Removed many unused parameters and variables across the app; behavior unchanged.
    • Standardized try/catch handlers to ignore non-critical errors.
  • API Changes

    • Simplified several public methods to accept fewer arguments; typical usage remains compatible.
    • One UI plugin no longer accepts an argument.
  • UI / Behavior

    • Minor adjustments to on-screen preset positioning that may affect advanced preview placement.
    • Small event-handler signature changes with no user-facing behavior changes.
  • Debug/Developer Tools

    • Improved USB flashing error messages for clearer diagnostics.
    • Added telemetry for data-logging events.

@haslinghuis haslinghuis added this to the 2025.12 milestone Oct 3, 2025
@haslinghuis haslinghuis self-assigned this Oct 3, 2025
@haslinghuis haslinghuis moved this to App in 2025.12.0 Oct 3, 2025
Copy link
Contributor

coderabbitai bot commented Oct 3, 2025

Warning

Rate limit exceeded

@haslinghuis has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 19 minutes and 51 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between 1cf2708 and 611d674.

📒 Files selected for processing (24)
  • src/js/DarkTheme.js (0 hunks)
  • src/js/TuningSliders.js (1 hunks)
  • src/js/model.js (1 hunks)
  • src/js/msp/MSPHelper.js (0 hunks)
  • src/js/msp/debug/msp_queue_monitor.js (1 hunks)
  • src/js/msp/debug/msp_stress_test.js (1 hunks)
  • src/js/protocols/WebSocket.js (1 hunks)
  • src/js/protocols/webusbdfu.js (6 hunks)
  • src/js/receiver_msp/receiver_msp.js (1 hunks)
  • src/js/serial_backend.js (2 hunks)
  • src/js/tabs/cli.js (2 hunks)
  • src/js/tabs/firmware_flasher.js (3 hunks)
  • src/js/tabs/landing.js (1 hunks)
  • src/js/tabs/led_strip.js (2 hunks)
  • src/js/tabs/onboard_logging.js (3 hunks)
  • src/js/tabs/osd.js (8 hunks)
  • src/js/tabs/pid_tuning.js (2 hunks)
  • src/js/utils/EscProtocols.js (2 hunks)
  • src/js/utils/VtxDeviceStatus/SmartAudioDeviceStatus.js (0 hunks)
  • src/js/utils/common.js (1 hunks)
  • src/js/utils/three/CanvasRenderer.js (1 hunks)
  • src/js/utils/three/Projector.js (1 hunks)
  • src/tabs/presets/SourcesDialog/SourcesDialog.js (1 hunks)
  • src/tabs/presets/presets.js (1 hunks)

Walkthrough

Removed unused constants and parameters, simplified many callback signatures by dropping unused arguments, tightened several catch clauses to not bind the error, renamed a few local variables, and expanded some USB error logs. A few public method signatures were changed (notably Websocket.connect, led_strip.initialize, EscProtocols methods, TuningSliders.calculateNewPids).

Changes

Cohort / File(s) Summary of changes
Constants & simple local renames
src/js/DarkTheme.js, src/js/msp/MSPHelper.js, src/js/receiver_msp/receiver_msp.js, src/js/utils/VtxDeviceStatus/SmartAudioDeviceStatus.js
Removed unused constants (css_dark, MAX_GYROS), removed unused event param in a mouseup handler, and renamed local sa_sa. No control-flow changes.
Public API / signature changes
src/js/protocols/WebSocket.js, src/js/tabs/led_strip.js, src/js/tabs/pid_tuning.js, src/js/utils/EscProtocols.js, src/js/TuningSliders.js
Updated method signatures: Websocket.connect(path, options)connect(path); led_strip.initialize(callback, scrollPosition)initialize(callback); pid_tuning.sliderOnScroll(slider, e)sliderOnScroll(slider); EscProtocols first param apiVersion_apiVersion for affected static methods; TuningSliders.calculateNewPids(updateSlidersOnly = false)calculateNewPids() and now calls this.readSimplifiedPids().
Callback arity / event handler simplifications
src/js/model.js, src/js/serial_backend.js, src/js/tabs/landing.js, src/js/tabs/firmware_flasher.js, src/js/tabs/cli.js, src/tabs/presets/SourcesDialog/SourcesDialog.js, src/js/tabs/led_strip.js, src/js/receiver_msp/receiver_msp.js
Dropped unused parameters from many callbacks and event handlers (forEach/findIndex callbacks, click handlers, executeSnippet, auto-select listener). Behaviour preserved.
Error handling: catch without binding
src/js/msp/debug/msp_queue_monitor.js, src/js/msp/debug/msp_stress_test.js, src/js/utils/three/CanvasRenderer.js, src/tabs/presets/presets.js
Replaced catch (err) / catch (_) with bare catch {} in several places, ignoring thrown errors without binding the exception object.
USB / DFU transfers & logging
src/js/protocols/webusbdfu.js
Simplified reduce/findIndex and controlTransfer callback signatures (removed unused params) and augmented USB controlTransfer error messages to include ${error} in logs. Core transfer flow preserved.
Potential scope/risk note
src/js/utils/three/Projector.js, src/js/TuningSliders.js
Local rename _material introduced; ensure no unintended outer-scope assignment. TuningSliders removed branching parameter updateSlidersOnly, changing internal call flow to always call readSimplifiedPids().
Onboard logging & telemetry
src/js/tabs/onboard_logging.js
Replaced debugFieldsSelect usage with a local _debugFieldsSelect, adjusted populateDebugFields() to no-arg form, and added tracking.sendEvent telemetry calls reporting DataLogging events.
OSD and UI small refactors
src/js/tabs/osd.js, src/js/utils/common.js
Renamed coords callback params (use of _w/_h variants) and internal enabledCount_enabledCount; $.fn.sortSelect(text = "")$.fn.sortSelect() with commented-out body and preserved chainable return.

Sequence Diagram(s)

No sequence diagram — changes are parameter/catch/variable simplifications and small signature adjustments without new control-flow interactions warranting a diagram.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested reviewers

  • nerdCopter
  • blckmn

Pre-merge checks and finishing touches

❌ Failed checks (2 warnings)
Check name Status Explanation Resolution
Description Check ⚠️ Warning The pull request description is missing and does not include the required information from the repository’s template such as a summary of the changes, context, or any details about the lint fixes. Please add a descriptive pull request description using the provided template, including a concise summary of the lint fixes, any relevant issue references, and confirmation that CI and tests pass.
Docstring Coverage ⚠️ Warning Docstring coverage is 5.26% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (1 passed)
Check name Status Explanation
Title Check ✅ Passed The title “Fix lint issues” accurately and concisely summarizes the primary changes, which consist of removing unused variables, parameters, and simplifying callback signatures to satisfy lint rules across the codebase.

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 4

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (3)
src/js/tabs/firmware_flasher.js (1)

266-270: Undefined variable reference after parameter removal.

The target parameter was removed from the forEach callback, but line 267 still references targets[target]. This will cause a runtime error since target is now undefined.

Apply this diff to fix the issue:

-                .forEach(function () {
-                    const descriptor = targets[target];
+                .forEach(function (target) {
+                    const descriptor = targets[target];

Alternatively, use the arrow function with parameter:

-                .forEach(function () {
-                    const descriptor = targets[target];
+                .forEach((target) => {
+                    const descriptor = targets[target];
src/js/tabs/osd.js (2)

29-208: Misleading parameter naming convention.

The parameters have been renamed from w, h to _w, _h throughout the coords functions in positionConfigs. The underscore prefix typically signals intentionally unused parameters in JavaScript linting conventions (e.g., ESLint's no-unused-vars), but these parameters are actively used in coordinate calculations (lines 38, 50, 64, 76, 87, 88, 101, 112, 113, 126, 127, and many others).

This creates a semantic contradiction that could confuse future maintainers or cause linting tools to flag false positives. Consider reverting to w, h or using a different naming convention that doesn't imply the parameters are unused.

Based on learnings: The OSD positioning system relies on width/height calculations working in conjunction with centering coordinate formulas, so these parameters are essential to the positioning logic.

</review_comment_end -->


900-911: Misleading variable naming convention.

The variable has been renamed from enabledCount to _enabledCount (line 900), but it's actively used at line 911 (_enabledCount++). The underscore prefix typically signals intentionally unused variables in JavaScript linting conventions, creating a semantic contradiction. Consider reverting to enabledCount or using a different naming convention.

</review_comment_end -->

🧹 Nitpick comments (2)
src/js/utils/EscProtocols.js (2)

52-67: Unused parameter could be removed or documented.

The parameter _apiVersion is correctly prefixed with an underscore since it's unused in the function body. However, this raises a question: if the parameter isn't used, should it be removed from the signature to simplify the API, or is it intentionally kept for future extension?

If it's a future extension point, consider adding a comment to clarify this intent. Otherwise, consider removing the unused parameter to reduce the public API surface.

</review_comment_end -->


69-71: Unused parameter and identity function.

The parameter _apiVersion is correctly prefixed with an underscore since it's unused in the function body. However, this method currently just returns protocolIndex unchanged, making it an identity function with an unused parameter. This suggests it's either a stub for future implementation or dead code that could be removed.

Consider:

  1. If this is a placeholder for future protocol reordering logic, add a comment to clarify.
  2. If the reordering logic is no longer needed, consider removing the method and updating callers to use protocolIndex directly.

</review_comment_end -->

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 34036b9 and 35a96f9.

📒 Files selected for processing (24)
  • src/js/DarkTheme.js (0 hunks)
  • src/js/TuningSliders.js (1 hunks)
  • src/js/model.js (1 hunks)
  • src/js/msp/MSPHelper.js (0 hunks)
  • src/js/msp/debug/msp_queue_monitor.js (1 hunks)
  • src/js/msp/debug/msp_stress_test.js (1 hunks)
  • src/js/protocols/WebSocket.js (1 hunks)
  • src/js/protocols/webusbdfu.js (6 hunks)
  • src/js/receiver_msp/receiver_msp.js (1 hunks)
  • src/js/serial_backend.js (2 hunks)
  • src/js/tabs/cli.js (1 hunks)
  • src/js/tabs/firmware_flasher.js (3 hunks)
  • src/js/tabs/landing.js (1 hunks)
  • src/js/tabs/led_strip.js (2 hunks)
  • src/js/tabs/onboard_logging.js (4 hunks)
  • src/js/tabs/osd.js (18 hunks)
  • src/js/tabs/pid_tuning.js (2 hunks)
  • src/js/utils/EscProtocols.js (2 hunks)
  • src/js/utils/VtxDeviceStatus/SmartAudioDeviceStatus.js (1 hunks)
  • src/js/utils/common.js (1 hunks)
  • src/js/utils/three/CanvasRenderer.js (1 hunks)
  • src/js/utils/three/Projector.js (0 hunks)
  • src/tabs/presets/SourcesDialog/SourcesDialog.js (1 hunks)
  • src/tabs/presets/presets.js (1 hunks)
💤 Files with no reviewable changes (3)
  • src/js/msp/MSPHelper.js
  • src/js/DarkTheme.js
  • src/js/utils/three/Projector.js
🧰 Additional context used
🧠 Learnings (2)
📚 Learning: 2025-09-02T07:45:48.606Z
Learnt from: blckmn
PR: betaflight/betaflight-configurator#4583
File: src/js/tabs/firmware_flasher.js:949-961
Timestamp: 2025-09-02T07:45:48.606Z
Learning: In src/js/tabs/firmware_flasher.js, the config file loading code path after firmware loading (in the load_file click handler) cannot be reached when UF2 firmware is loaded, according to the maintainer blckmn. This code is maintained for backward compatibility with unified target settings and will be refactored in a future PR.

Applied to files:

  • src/js/tabs/firmware_flasher.js
📚 Learning: 2025-06-14T13:42:41.217Z
Learnt from: syahmizul
PR: betaflight/betaflight-configurator#4516
File: src/js/tabs/osd.js:3544-3559
Timestamp: 2025-06-14T13:42:41.217Z
Learning: In OSD positioning systems, width/height calculations like `limits.maxX - limits.minX` work in conjunction with centering coordinate formulas like `Math.floor((OSD.data.displaySize.x - w) / 2)`. Adding +1 to width calculations breaks centering by making elements off-center by half a character position. The entire positioning system must be considered holistically when making changes.

Applied to files:

  • src/js/tabs/osd.js
🧬 Code graph analysis (3)
src/js/serial_backend.js (1)
src/components/eventBus.js (2)
  • EventBus (3-8)
  • EventBus (3-8)
src/js/utils/EscProtocols.js (2)
src/js/tabs/gps.js (1)
  • protocolIndex (118-118)
src/js/tabs/motors.js (1)
  • escProtocols (704-704)
src/js/tabs/onboard_logging.js (2)
src/js/Analytics.js (1)
  • tracking (7-7)
src/js/fc.js (1)
  • FC (131-998)
🔇 Additional comments (31)
src/tabs/presets/presets.js (1)

378-378: LGTM! Unused parameter removed.

The reason parameter was not used in the catch block. Removing it improves code clarity and aligns with ESLint's no-unused-vars rule.

src/js/msp/debug/msp_stress_test.js (1)

279-279: LGTM! Unused error binding removed.

The catch clause no longer binds the error object, satisfying lint requirements. The timeout recovery logic remains intact.

src/js/utils/three/CanvasRenderer.js (1)

554-554: LGTM! Unused exception binding removed.

The catch clause no longer binds the exception object, satisfying lint requirements. The fallback to colorStyle1 remains unchanged.

src/js/msp/debug/msp_queue_monitor.js (1)

126-128: LGTM! Unused error binding removed.

The catch clause no longer binds the error object, satisfying lint requirements. The duplicate detection error handling remains unchanged.

src/js/protocols/webusbdfu.js (6)

474-477: LGTM!

Removing the unused index parameter from the reduce callback improves code clarity without affecting functionality.


502-505: LGTM!

Appending error details to the log message improves debugging capability for USB transfer failures.


527-529: LGTM!

Consistent error logging improvement for OUT transfers, matching the IN transfer enhancement.


903-905: LGTM!

Removing unused parameters from the findIndex callback improves readability without affecting the sector/page lookup logic.


1164-1180: LGTM!

The UPLOAD callback logic is intact. The simplified signature (removing any unused parameters) improves readability while maintaining the verification flow.


1256-1258: LGTM!

Removing the unused data parameter from the GETSTATUS callback is a valid cleanup. The DFU exit sequence logic remains correct.

src/js/receiver_msp/receiver_msp.js (1)

192-194: LGTM!

The removal of the unused event parameter is correct and aligns with the broader cleanup pattern across this PR.

src/tabs/presets/SourcesDialog/SourcesDialog.js (1)

69-72: LGTM!

The removal of the unused sourcesCount parameter is correct. The call site at line 41 still passes the argument, but JavaScript silently ignores extra arguments, so no behavioral change occurs.

src/js/tabs/landing.js (1)

20-30: LGTM!

The removal of the unused index parameter from the jQuery .each() callback is correct and doesn't affect functionality.

src/js/tabs/cli.js (1)

149-153: LGTM!

The removal of the unused fileName parameter is correct. The call site at line 163 still passes the argument, but it's harmlessly ignored.

src/js/tabs/led_strip.js (2)

229-275: LGTM!

The removal of the unused event parameter from the color button click handler is correct and doesn't affect functionality.


16-16: No callers rely on the removed scrollPosition parameter
Call sites invoke led_strip.initialize(content_ready) with a single callback argument.

src/js/tabs/firmware_flasher.js (2)

992-995: LGTM!

The removal of the unused event parameter is correct.


1021-1031: LGTM!

The removal of the unused event parameter is correct.

src/js/utils/common.js (1)

64-104: Document and track re-enabling disabled sortSelect functionality
The current no-op implementation affects all dropdowns relying on alphabetical/grouped ordering. Add a TODO and create a tracking issue referencing the Chrome v140 bug, then verify no user-facing regressions in select dropdown sorting.

src/js/protocols/WebSocket.js (1)

60-94: No direct callers to the WebSocket protocol’s connect method were found; removing the options parameter is safe.

src/js/model.js (1)

162-162: LGTM!

Removing the unused index parameter from the forEach callback simplifies the code without changing behavior.

src/js/tabs/pid_tuning.js (2)

2108-2110: LGTM!

The callback doesn't use the index or element parameters, only $(this) to reference the current element. Removing unused parameters simplifies the signature.


3321-3342: LGTM!

The e parameter was never used in the method body. The event object is accessed through the inner event listener callback parameter at line 3322, making the outer parameter unnecessary.

src/js/serial_backend.js (2)

62-73: LGTM!

The callback doesn't use the device parameter. It only checks conditions and calls connectDisconnect(). Removing the unused parameter simplifies the signature.


661-679: LGTM!

The filter predicate doesn't use the index parameter, only $(this) and other context variables. Removing the unused parameter is appropriate.

src/js/TuningSliders.js (1)

442-456: Incorrect: updateSlidersOnly is a parameter of readSimplifiedPids (defaulting to false), so its use in the .then(() => this.updateFormPids(updateSlidersOnly)) callback is in scope and won’t cause a ReferenceError.

Likely an incorrect or invalid review comment.

src/js/tabs/osd.js (2)

547-551: LGTM!

The multi-line formatting of this complex conditional improves readability without changing logic.

</review_comment_end -->


827-830: LGTM!

The multi-line formatting of this complex conditional improves readability without changing logic.

</review_comment_end -->

src/js/tabs/onboard_logging.js (3)

140-140: LGTM!

The call to populateDebugFields() correctly matches the updated function signature.


265-278: LGTM!

The removal of the unused debugFieldsSelect parameter simplifies the function signature, and the function body correctly operates on global state.


411-414: No null-check needed for tracking.sendEvent. The app’s startup sequence in main.js invokes checkSetupAnalytics which calls createAnalytics (and sets window.tracking) before any tab initialization or user interaction, so tracking will always be non-null by the time onboard_logging.sendEvent is reached.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/js/protocols/webusbdfu.js (1)

474-478: Guard against null descriptors before populating chipInfo.

Line 474: parseDescriptor deliberately returns null when a descriptor is malformed. After this refactor we dereference v.type unconditionally, so any such descriptor now throws Cannot read properties of null, breaking DFU detection on affected boards. Please skip null entries before using them.

-            const chipInfo = descriptors.map(parseDescriptor).reduce((o, v) => {
-                o[v.type.toLowerCase().replace(" ", "_")] = v;
-                return o;
-            }, {});
+            const chipInfo = descriptors
+                .map(parseDescriptor)
+                .reduce((o, v) => {
+                    if (!v) {
+                        return o;
+                    }
+                    o[v.type.toLowerCase().replace(" ", "_")] = v;
+                    return o;
+                }, {});
♻️ Duplicate comments (1)
src/js/utils/VtxDeviceStatus/SmartAudioDeviceStatus.js (1)

17-17: Remove the unused variable.

The renaming from sa to _sa marks it as intentionally unused, but the computation still serves no purpose and should be removed entirely.

Apply this diff to remove the unused variable:

-        const _sa = this._version * 100 + this._mode;
🧹 Nitpick comments (1)
src/js/tabs/osd.js (1)

3900-3900: Consider removing unused counter.

_enabledCount is incremented but never read. If this was intended for debugging or a future feature, the underscore prefix correctly signals it's intentionally unused. However, if it serves no purpose, consider removing both the declaration (line 3900) and the increment (line 3911) entirely to reduce code clutter.

Also applies to: 3911-3911

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 35a96f9 and 0ab779e.

📒 Files selected for processing (24)
  • src/js/DarkTheme.js (0 hunks)
  • src/js/TuningSliders.js (1 hunks)
  • src/js/model.js (1 hunks)
  • src/js/msp/MSPHelper.js (0 hunks)
  • src/js/msp/debug/msp_queue_monitor.js (1 hunks)
  • src/js/msp/debug/msp_stress_test.js (1 hunks)
  • src/js/protocols/WebSocket.js (1 hunks)
  • src/js/protocols/webusbdfu.js (6 hunks)
  • src/js/receiver_msp/receiver_msp.js (1 hunks)
  • src/js/serial_backend.js (2 hunks)
  • src/js/tabs/cli.js (1 hunks)
  • src/js/tabs/firmware_flasher.js (3 hunks)
  • src/js/tabs/landing.js (1 hunks)
  • src/js/tabs/led_strip.js (2 hunks)
  • src/js/tabs/onboard_logging.js (4 hunks)
  • src/js/tabs/osd.js (10 hunks)
  • src/js/tabs/pid_tuning.js (2 hunks)
  • src/js/utils/EscProtocols.js (2 hunks)
  • src/js/utils/VtxDeviceStatus/SmartAudioDeviceStatus.js (1 hunks)
  • src/js/utils/common.js (1 hunks)
  • src/js/utils/three/CanvasRenderer.js (1 hunks)
  • src/js/utils/three/Projector.js (0 hunks)
  • src/tabs/presets/SourcesDialog/SourcesDialog.js (1 hunks)
  • src/tabs/presets/presets.js (1 hunks)
💤 Files with no reviewable changes (3)
  • src/js/DarkTheme.js
  • src/js/utils/three/Projector.js
  • src/js/msp/MSPHelper.js
🚧 Files skipped from review as they are similar to previous changes (14)
  • src/js/tabs/landing.js
  • src/js/serial_backend.js
  • src/tabs/presets/presets.js
  • src/js/msp/debug/msp_stress_test.js
  • src/js/model.js
  • src/js/utils/EscProtocols.js
  • src/js/tabs/pid_tuning.js
  • src/js/receiver_msp/receiver_msp.js
  • src/js/TuningSliders.js
  • src/js/msp/debug/msp_queue_monitor.js
  • src/js/utils/three/CanvasRenderer.js
  • src/tabs/presets/SourcesDialog/SourcesDialog.js
  • src/js/tabs/cli.js
  • src/js/tabs/onboard_logging.js
🧰 Additional context used
🧠 Learnings (2)
📚 Learning: 2025-09-02T07:45:48.606Z
Learnt from: blckmn
PR: betaflight/betaflight-configurator#4583
File: src/js/tabs/firmware_flasher.js:949-961
Timestamp: 2025-09-02T07:45:48.606Z
Learning: In src/js/tabs/firmware_flasher.js, the config file loading code path after firmware loading (in the load_file click handler) cannot be reached when UF2 firmware is loaded, according to the maintainer blckmn. This code is maintained for backward compatibility with unified target settings and will be refactored in a future PR.

Applied to files:

  • src/js/tabs/firmware_flasher.js
📚 Learning: 2025-06-14T13:42:41.217Z
Learnt from: syahmizul
PR: betaflight/betaflight-configurator#4516
File: src/js/tabs/osd.js:3544-3559
Timestamp: 2025-06-14T13:42:41.217Z
Learning: In OSD positioning systems, width/height calculations like `limits.maxX - limits.minX` work in conjunction with centering coordinate formulas like `Math.floor((OSD.data.displaySize.x - w) / 2)`. Adding +1 to width calculations breaks centering by making elements off-center by half a character position. The entire positioning system must be considered holistically when making changes.

Applied to files:

  • src/js/tabs/osd.js
🧬 Code graph analysis (1)
src/js/protocols/webusbdfu.js (1)
src/js/gui.js (1)
  • TABS (8-8)
🔇 Additional comments (5)
src/js/tabs/osd.js (5)

29-29: LGTM—unused parameters correctly prefixed.

The callback never references w or h, so prefixing both with _ properly signals they are intentionally unused.


37-37: LGTM—unused parameter correctly prefixed.

The callback uses w for centering but never references h, so the _h prefix is appropriate.


49-49: LGTM—unused parameters correctly prefixed across multiple callbacks.

Each callback only uses one dimension:

  • TR (line 49) uses w for horizontal positioning → _h is correct.
  • TML, LMC, BML, BL (lines 62, 99, 138, 174) use h for vertical positioning → _w is correct.

Also applies to: 62-62, 99-99, 138-138, 174-174


3547-3553: LGTM—formatting adjustment with no logic change.

The conditional logic remains identical; only whitespace/formatting was adjusted for consistency.


3827-3832: LGTM—formatting adjustment with no logic change.

The conditional logic remains identical; only whitespace/formatting was adjusted.

@haslinghuis haslinghuis force-pushed the fix-lint branch 2 times, most recently from 36faebe to 20f9f99 Compare October 3, 2025 21:00
@nerdCopter
Copy link
Member

36faebe flashed 2 fc, tested successful most tabs and save. brief tests only. saw a new push but no time to test.

Copy link
Member

@nerdCopter nerdCopter left a comment

Choose a reason for hiding this comment

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

pre-approving for workflow deferring to tests

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/js/utils/common.js (1)

57-103: Clarify disabled sortSelect behavior

  • Update JSDoc: remove @param text, describe that sorting is disabled due to Chrome v140 and the method simply returns the select element for chaining.
  • Add a TODO (with issue/bug-tracker reference) above the commented-out block to indicate when/how sorting will be re-enabled.
  • Confirm impact: sortSelect is called across many tabs (failsafe, receiver, onboard_logging, led_strip, osd, etc.); verify skipping sort doesn’t degrade UX.
♻️ Duplicate comments (1)
src/js/utils/VtxDeviceStatus/SmartAudioDeviceStatus.js (1)

17-17: Remove unused variable _sa.

The variable _sa is computed but never referenced in the function. This is dead code that should be removed.

Apply this diff to remove the unused variable:

-        const _sa = this._version * 100 + this._mode;
🧹 Nitpick comments (1)
src/js/tabs/osd.js (1)

3900-3900: Correctly marked as unused, but consider removing.

The variable _enabledCount is incremented but never read. The underscore prefix correctly marks it as unused for linting purposes. If this counter serves no purpose, consider removing it entirely along with line 3911.

If the counter truly serves no purpose, apply this diff:

-                let _enabledCount = 0;
 
                 OSD.data.displaySize.total = OSD.data.displaySize.x * OSD.data.displaySize.y;
 
                 for (const field of OSD.data.displayItems) {
                     // versioning related, if the field doesn't exist at the current flight controller version, just skip it
                     if (!field.name) {
                         continue;
                     }
 
                     if (field.isVisible[OSD.getCurrentPreviewProfile()]) {
-                        _enabledCount++;
                     }

Also applies to: 3911-3911

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 0ab779e and 1cf2708.

📒 Files selected for processing (24)
  • src/js/DarkTheme.js (0 hunks)
  • src/js/TuningSliders.js (1 hunks)
  • src/js/model.js (1 hunks)
  • src/js/msp/MSPHelper.js (0 hunks)
  • src/js/msp/debug/msp_queue_monitor.js (1 hunks)
  • src/js/msp/debug/msp_stress_test.js (1 hunks)
  • src/js/protocols/WebSocket.js (1 hunks)
  • src/js/protocols/webusbdfu.js (6 hunks)
  • src/js/receiver_msp/receiver_msp.js (1 hunks)
  • src/js/serial_backend.js (2 hunks)
  • src/js/tabs/cli.js (2 hunks)
  • src/js/tabs/firmware_flasher.js (3 hunks)
  • src/js/tabs/landing.js (1 hunks)
  • src/js/tabs/led_strip.js (2 hunks)
  • src/js/tabs/onboard_logging.js (4 hunks)
  • src/js/tabs/osd.js (10 hunks)
  • src/js/tabs/pid_tuning.js (2 hunks)
  • src/js/utils/EscProtocols.js (2 hunks)
  • src/js/utils/VtxDeviceStatus/SmartAudioDeviceStatus.js (1 hunks)
  • src/js/utils/common.js (1 hunks)
  • src/js/utils/three/CanvasRenderer.js (1 hunks)
  • src/js/utils/three/Projector.js (1 hunks)
  • src/tabs/presets/SourcesDialog/SourcesDialog.js (1 hunks)
  • src/tabs/presets/presets.js (1 hunks)
💤 Files with no reviewable changes (2)
  • src/js/msp/MSPHelper.js
  • src/js/DarkTheme.js
🚧 Files skipped from review as they are similar to previous changes (16)
  • src/js/msp/debug/msp_queue_monitor.js
  • src/js/protocols/WebSocket.js
  • src/js/msp/debug/msp_stress_test.js
  • src/js/model.js
  • src/js/tabs/led_strip.js
  • src/js/serial_backend.js
  • src/js/tabs/firmware_flasher.js
  • src/js/protocols/webusbdfu.js
  • src/js/utils/three/CanvasRenderer.js
  • src/tabs/presets/SourcesDialog/SourcesDialog.js
  • src/js/tabs/pid_tuning.js
  • src/js/receiver_msp/receiver_msp.js
  • src/js/utils/EscProtocols.js
  • src/js/tabs/cli.js
  • src/js/tabs/onboard_logging.js
  • src/js/TuningSliders.js
🔇 Additional comments (7)
src/tabs/presets/presets.js (1)

378-378: LGTM! Valid cleanup of unused parameter.

The removal of the unused error parameter from the catch handler is appropriate. The logic correctly collects failed repositories and continues loading the rest, which is the intended behavior for graceful degradation when some preset sources are unavailable.

src/js/utils/three/Projector.js (1)

136-136: LGTM! Valid lint fix for unused variable.

The variable is assigned but never read within the RenderList scope. Renaming to _material correctly signals to linters that this is intentionally unused, suppressing warnings without altering behavior.

Also applies to: 142-142

src/js/tabs/landing.js (1)

20-20: LGTM!

Removing the unused index parameter from the jQuery callback is a clean lint fix with no functional impact.

src/js/tabs/osd.js (4)

29-32: LGTM! Unused parameters correctly marked.

The underscore prefix correctly indicates that both width and height parameters are unused in this positioning function, which returns a fixed top-left position.


37-40: LGTM! Parameter usage correctly reflected in naming.

The underscore prefix correctly marks unused parameters while keeping the used parameters named normally:

  • TC and TR use width (w) but not height (_h)
  • TML, LMC, BML, and BL use height (h) but not width (_w)

This improves code clarity by signaling intent.

Also applies to: 49-52, 62-65, 99-102, 138-141, 174-177


3547-3553: LGTM! Formatting improvement.

The multi-line conditional is easier to read with the logical operators aligned. The logic remains unchanged—this shows a warning when an OSD font device is configured but not physically detected.


3827-3832: LGTM! Formatting improvement.

The multi-line conditional improves readability while maintaining the same logic. This correctly disables font-related UI features when the required hardware is unavailable.

Copy link

sonarqubecloud bot commented Oct 3, 2025

Copy link
Contributor

github-actions bot commented Oct 3, 2025

@haslinghuis
Copy link
Member Author

Thanks @nerdCopter - this is mainly running npm run lint and removing warnings - all of them being parameters not being used. Should be settled now.

@blckmn blckmn merged commit 114fd7e into betaflight:master Oct 3, 2025
8 checks passed
@github-project-automation github-project-automation bot moved this from App to Done in 2025.12.0 Oct 3, 2025
@haslinghuis haslinghuis deleted the fix-lint branch October 3, 2025 21:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants