Skip to content

Conversation

@csfercoci
Copy link

@csfercoci csfercoci commented Oct 9, 2025

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

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.
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.
@deepin-ci-robot
Copy link

[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
Copy link

Hi @csfercoci. Thanks for your PR. 😃

@deepin-ci-robot
Copy link

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.

@github-actions
Copy link

github-actions bot commented Oct 9, 2025

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

@sourcery-ai
Copy link

sourcery-ai bot commented Oct 9, 2025

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
Loading

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
Loading

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

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey there - I've reviewed your changes and they look great!

Prompt for AI Agents
Please address the comments from this code review:

## Individual Comments

### Comment 1
<location> `keybinding1/manager_test.go:7-9` </location>
<code_context>
+	"testing"
+)
+
+func TestFix(t *testing.T) {
+
+}
\ No newline at end of file
</code_context>

<issue_to_address>
**issue (testing):** TestFix is empty and does not verify any functionality.

Please add tests that cover WiFi restoration and the related bugfix, including scenarios where the wireless adapter is down.
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Comment on lines +7 to +9
func TestFix(t *testing.T) {

} No newline at end of file
Copy link

Choose a reason for hiding this comment

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

issue (testing): TestFix is empty and does not verify any functionality.

Please add tests that cover WiFi restoration and the related bugfix, including scenarios where the wireless adapter is down.

@deepin-bot
Copy link
Contributor

deepin-bot bot commented Oct 10, 2025

TAG Bot

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

@deepin-bot
Copy link
Contributor

deepin-bot bot commented Oct 16, 2025

TAG Bot

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

@deepin-bot
Copy link
Contributor

deepin-bot bot commented Oct 30, 2025

TAG Bot

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

@deepin-bot
Copy link
Contributor

deepin-bot bot commented Nov 7, 2025

TAG Bot

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants