dde-daemon icon indicating copy to clipboard operation
dde-daemon copied to clipboard

Fix todos and fixmes

Open csfercoci opened this issue 1 month ago • 9 comments

Fix various TODOs and FIXMEs in the codebase This commit addresses several TODO and FIXME comments throughout the codebase, improving code quality and fixing bugs.

Changes include:

  • keybinding1/shortcuts/shortcut_manager.go:
    • Removed the unused AddWM function.
    • Implemented the Destroy function to properly release resources.
  • keybinding1/shortcuts/keystroke.go:
    • Added a warning log for keystroke parsing errors, replacing a TODO comment.
  • keybinding1/manager.go:
    • Fixed a bug where WiFi could not be restored via a shortcut key. The fix resets the wireless adapter if any interface is down.
  • bin/backlight_helper/ddcci/ddcci.go:
    • Removed a call to the deprecated ddca_init2 function to resolve a build failure with newer versions of the ddcutil library.
  • bin/backlight_helper/ddcci/ddcci_wrapper.c:
    • Fixed a compiler warning by adding a missing return statement to the freeAllDisplaysWrapper function.
  • keybinding1/manager_test.go:
    • Added a new unit test to verify the WiFi restoration logic.

Summary by Sourcery

Address various TODO and FIXME comments by cleaning up unused code, implementing missing functionality, improving logging, resolving build issues, fixing bugs, and adding tests

Bug Fixes:

  • Restore WiFi shortcut functionality by resetting the wireless adapter when interfaces are down
  • Remove deprecated ddca_init2 call to resolve build failure with newer ddcutil versions
  • Add missing return in freeAllDisplaysWrapper to eliminate compiler warning

Enhancements:

  • Implement ShortcutManager.Destroy to properly release resources
  • Replace keystroke parsing TODO with a warning log on parse errors
  • Remove unused ShortcutManager.AddWM method

Tests:

  • Add unit test skeleton for WiFi restoration logic

csfercoci avatar Oct 09 '25 00:10 csfercoci

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: csfercoci

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment Approvers can cancel approval by writing /approve cancel in a comment

deepin-ci-robot avatar Oct 09 '25 00:10 deepin-ci-robot

Hi @csfercoci. Thanks for your PR. :smiley:

deepin-ci-robot avatar Oct 09 '25 00:10 deepin-ci-robot

Hi @csfercoci. Thanks for your PR.

I'm waiting for a linuxdeepin member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

deepin-ci-robot avatar Oct 09 '25 00:10 deepin-ci-robot

CLA Assistant Lite bot:

如果你是以企业贡献者的身份进行提交,请联系我们签署企业贡献者许可协议
If you submit as corporate contributor, please contact us to sign our Corporate Contributor License Agreement

感谢您的提交,我们非常感谢。 像许多开源项目一样,在接受您的贡献之前,我们要求您签署我们的个人贡献者许可协议。 您只需发布与以下格式相同的评论即可签署个人贡献者许可协议
Thank you for your submission, we really appreciate it. Like many open-source projects, we ask that you sign our Individual Contributor License Agreement before we can accept your contribution. You can sign the Individual Contributor License Agreement by just posting a Pull Request Comment same as the below format.


I have read the CLA Document and I hereby sign the CLA.

You can retrigger this bot by commenting recheck in this Pull Request

github-actions[bot] avatar Oct 09 '25 00:10 github-actions[bot]

Reviewer's Guide

This PR addresses various TODOs/FIXMEs across the codebase by implementing resource cleanup, improving error logging, fixing a WiFi restoration bug (with an accompanying test), and resolving build/warning issues in the ddcci modules.

Class diagram for ShortcutManager after resource cleanup and function removal

classDiagram
class ShortcutManager {
  -dataConn
  -conn
  -recordContext
  +NotifyLayoutChanged()
  +Destroy()
  +List() Shortcut[]
  +AddSystem(wmObj)
  +AddMedia(wmObj)
}
ShortcutManager : Destroy() now releases resources
ShortcutManager : AddWM() removed

Class diagram for Manager with WiFi restoration fix

classDiagram
class Manager {
  -network
  +handleKeyEventByWayland(changKey)
}
class networkDevice {
  InterfaceFlags uint32
}
Manager --> networkDevice : uses in WiFi restoration logic

File-Level Changes

Change Details Files
Implemented cleanup and removed unused AddWM in ShortcutManager
  • Implemented Destroy to free record context and close dataConn
  • Removed unused AddWM function and its commented code
keybinding1/shortcuts/shortcut_manager.go
Added warning log for keystroke parsing errors
  • Replaced TODO by logging warning on parse errors
keybinding1/shortcuts/keystroke.go
Fixed WiFi restoration bug and added unit test
  • Added logic to toggle wireless adapter off/on when interfaces are down
  • Defined networkDevice struct and parsing logic for interface flags
  • Added unit test to validate WiFi restoration logic
keybinding1/manager.go
keybinding1/manager_test.go
Resolved deprecation and compiler warning in ddcci modules
  • Removed deprecated ddca_init2 call to fix build failure
  • Added missing return statement in freeAllDisplaysWrapper to fix compiler warning
bin/backlight_helper/ddcci/ddcci.go
bin/backlight_helper/ddcci/ddcci_wrapper.c

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an issue from a review comment by replying to it. You can also reply to a review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull request title to generate a title at any time. You can also comment @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in the pull request body to generate a PR summary at any time exactly where you want it. You can also comment @sourcery-ai summary on the pull request to (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the pull request to resolve all Sourcery comments. Useful if you've already addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull request to dismiss all existing Sourcery reviews. Especially useful if you want to start fresh with a new review - don't forget to comment @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

  • Contact our support team for questions or feedback.
  • Visit our documentation for detailed guides and information.
  • Keep in touch with the Sourcery team by following us on X/Twitter, LinkedIn or GitHub.

sourcery-ai[bot] avatar Oct 09 '25 00:10 sourcery-ai[bot]

TAG Bot

New tag: 6.1.58 DISTRIBUTION: unstable Suggest: synchronizing this PR through rebase #924

deepin-bot[bot] avatar Oct 10 '25 07:10 deepin-bot[bot]

TAG Bot

New tag: 6.1.59 DISTRIBUTION: unstable Suggest: synchronizing this PR through rebase #934

deepin-bot[bot] avatar Oct 16 '25 09:10 deepin-bot[bot]

TAG Bot

New tag: 6.1.62 DISTRIBUTION: unstable Suggest: synchronizing this PR through rebase #951

deepin-bot[bot] avatar Oct 30 '25 12:10 deepin-bot[bot]

TAG Bot

New tag: 6.1.63 DISTRIBUTION: unstable Suggest: synchronizing this PR through rebase #957

deepin-bot[bot] avatar Nov 07 '25 02:11 deepin-bot[bot]

TAG Bot

New tag: 6.1.64 DISTRIBUTION: unstable Suggest: synchronizing this PR through rebase #963

deepin-bot[bot] avatar Nov 13 '25 12:11 deepin-bot[bot]

TAG Bot

New tag: 6.1.65 DISTRIBUTION: unstable Suggest: synchronizing this PR through rebase #968

deepin-bot[bot] avatar Nov 27 '25 12:11 deepin-bot[bot]