Skip to content

Conversation

@wjyrich
Copy link
Contributor

@wjyrich wjyrich commented Aug 18, 2025

as title.

Log:

Summary by Sourcery

Silence compiler warnings and update build configuration

Enhancements:

  • Mark many unused function parameters and variables with Q_UNUSED to suppress warnings
  • Remove or comment out unused variables and code snippets across models, views, and utilities
  • Add missing qtpreprocessorsupport.h include

Build:

  • Comment out strict warning flags in CMakeLists.txt

Tests:

  • Apply Q_UNUSED in test lambdas and remove unused local variables in test files

@sourcery-ai
Copy link

sourcery-ai bot commented Aug 18, 2025

Reviewer's Guide

This PR systematically suppresses compiler warnings by marking unused parameters and variables with Q_UNUSED or [[maybe_unused]], commenting out or wrapping unused code, introducing explicit casts to resolve type mismatches, and adjusting build flags to relax strict warning settings.

Class diagram for updated model classes with Q_UNUSED usage

classDiagram
    class RoleCombineModel {
        +RoleCombineModel(QAbstractItemModel* major, QAbstractItemModel* minor, QObject* parent)
        +rowCount(const QModelIndex &parent) const
        +columnCount(const QModelIndex &parent) const
        +index(int row, int column, const QModelIndex &parent) const
        +parent(const QModelIndex &child) const
        +roleNames() const
        // Many signal/slot lambdas now use Q_UNUSED for unused parameters
    }
    class DockGlobalElementModel {
        +DockGlobalElementModel(QAbstractItemModel *appsModel, DockPanel *panel, QObject *parent)
        +rowCount(const QModelIndex &parent) const
        +columnCount(const QModelIndex &parent) const
        +index(int row, int column, const QModelIndex &parent) const
        +parent(const QModelIndex &child) const
        // Many signal/slot lambdas now use Q_UNUSED for unused parameters
    }
    class DockItemModel {
        +rowCount(const QModelIndex &parent) const
        +columnCount(const QModelIndex &parent) const
        +index(int row, int column, const QModelIndex &parent) const
        +parent(const QModelIndex &child) const
        // Q_UNUSED added for parent/child parameters
    }
    class DockGroupModel {
        +requestOpenUrls(const QModelIndex &index, const QList<QUrl> &urls) const
        +requestUpdateWindowGeometry(const QModelIndex &index, const QRect &geometry, QObject *delegate) const
        // Q_UNUSED added for unused parameters
    }
    class NotifyModel {
        +rowCount(const QModelIndex &parent) const
        +sort(int column, Qt::SortOrder order)
        // Q_UNUSED added for parent, column, order parameters
    }
    class NotifyStagingModel {
        +rowCount(const QModelIndex &parent) const
        // Q_UNUSED added for parent parameter
    }
    class AbstractWindowMonitor {
        +rowCount(const QModelIndex &parent) const
        // Q_UNUSED added for parent parameter
    }
Loading

Class diagram for constructor member initialization order fixes

classDiagram
    class AMAppItem {
        +AMAppItem(const QDBusObjectPath &path, QObject *parent)
        // Now initializes Application before AppItem
    }
    class AppGroupManager {
        +AppGroupManager(AMAppItemModel * referenceModel, QObject *parent)
        // m_config initialization order fixed
    }
    class TreeLandDockPreviewContext {
        +TreeLandDockPreviewContext(struct ::treeland_dock_preview_context_v1 *context)
        // m_hideTimer initialization order fixed
    }
    class WaylandDockHelper {
        +WaylandDockHelper(DockPanel *panel)
        // m_panel initialization order fixed
    }
    class X11WindowPreviewContainer {
        +X11WindowPreviewContainer(X11WindowMonitor* monitor, QWidget *parent)
        // m_direction initialization order fixed
    }
Loading

Class diagram for updated copy constructors

classDiagram
    class DAppletData {
        +DAppletData(const DAppletData &other)
        // Now calls QObject() in copy constructor
    }
    class DPluginMetaData {
        +DPluginMetaData(const DPluginMetaData &other)
        // Now calls QObject() in copy constructor
    }
Loading

Class diagram for updated signal/slot lambdas with Q_UNUSED

classDiagram
    class RoleGroupModel {
        +setSourceModel(QAbstractItemModel *model)
        // rowsInserted, rowsRemoved lambdas now use Q_UNUSED for parent
    }
    class AMAppItemModel {
        +AMAppItemModel(QObject *parent)
        // InterfacesRemoved lambda now uses Q_UNUSED for interfaces
    }
    class AppearanceApplet {
        +AppearanceApplet(QObject *parent)
        // serviceRegistered lambda now uses Q_UNUSED for service
    }
    class AMApplet {
        +onInterfacesRemoved(const QDBusObjectPath &objPath, const QStringList &interfaces)
        // Q_UNUSED for interfaces
    }
Loading

File-Level Changes

Change Details Files
Suppress unused parameter and variable warnings throughout source code
  • Insert Q_UNUSED() macros for unused function parameters and lambda captures
  • Comment out or remove unused local variable declarations
  • Wrap unneeded functions or code blocks in #if 0 / #endif for future reference
panels/dock/taskmanager/rolecombinemodel.cpp
panels/dock/taskmanager/dockglobalelementmodel.cpp
panels/dock/taskmanager/dockgroupmodel.cpp
panels/dock/pluginmanagerextension.cpp
applets/dde-apps/appgroupmanager.cpp
frame/models/listtotableproxymodel.cpp
panels/dock/taskmanager/x11preview.cpp
panels/dock/taskmanager/rolegroupmodel.cpp
panels/notification/center/notifymodel.cpp
tests/panels/dock/taskmanager/combinemodela.cpp
tests/panels/dock/taskmanager/combinemodelb.cpp
Mark rarely used variables and objects as maybe unused and adjust initializer lists
  • Use [[maybe_unused]] attribute for tester object to silence unused warnings
  • Rearrange or add Q_UNUSED() for member initializers moved between constructor lists
  • Comment unused return values when not needed
tests/panels/dock/taskmanager/rolecombinemodeltests.cpp
panels/dock/pluginmanagerextension.cpp
panels/dock/dockpanel.cpp
applets/dde-apps/appsdockedhelper.cpp
Resolve type mismatch and implicit conversion warnings
  • Add explicit static_cast for integral comparisons in X11DockHelper
  • Initialize iterator structs fully to avoid uninitialized fields
panels/dock/x11dockhelper.cpp
panels/dock/taskmanager/x11utils.cpp
Adjust build configuration to relax strict compiler flags
  • Comment out -Wall -Wextra -Werror flags in CMakeLists.txt
CMakeLists.txt

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!


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.

@deepin-ci-robot
Copy link

deepin pr auto review

根据提供的代码 diff,我来对代码进行审查,并提出改进意见:

  1. 代码安全性改进:
  • 在多个文件中发现未使用的参数添加了 Q_UNUSED 宏,这是好的实践,可以避免编译器警告
  • 建议在所有明确不使用的参数上都添加 Q_UNUSED 宏,保持代码一致性
  1. 代码质量改进:
  • 在 amapplet.cpp 和 appearanceapplet.cpp 中,lambda 表达式中添加了 Q_UNUSED(service) 是正确的
  • 在 appgroupmanager.cpp 中,m_config 的初始化顺序调整是正确的,应该在使用前初始化
  • 在 appsdockedhelper.cpp 中,setDocked 方法参数被标记为未使用,但注释 TODO 表示需要实现功能,建议尽快实现
  1. 代码逻辑改进:
  • 在 amappitem.cpp 中,构造函数初始化列表顺序调整是正确的,应该先初始化基类
  • 在 x11dockhelper.cpp 中,类型转换添加了 static_cast 是正确的,提高了类型安全性
  • 在 main.cpp 中,for 循环中使用 const auto & 是正确的,避免不必要的拷贝
  1. 代码性能优化:
  • 在多个模型类中,对于 parent 参数使用 Q_UNUSED 是正确的,因为这些模型通常是平铺结构
  • 在 RoleCombineModel 中,使用引用传递参数是正确的,避免不必要的拷贝
  1. 潜在问题:
  • 在 dockpanel.cpp 中,adaptor 和 dockFrontAdaptor 被标记为未使用,但这些对象需要保持存在,建议添加注释说明原因
  • 在 notificationcenterpanel.cpp 中,notifyCenterInterface 函数被删除但可能被其他地方使用,需要确认没有引用
  • 在 taskmanagersettings.cpp 中,YAML 异常捕获应该记录具体的错误信息,方便调试
  1. 建议改进:
  • 对于所有标记为 TODO 的代码(如 appsdockedhelper.cpp 中的 setDocked),应该添加优先级和预计完成时间
  • 对于 DAppletData 和 DPluginMetaData 的拷贝构造函数,应该考虑实现深拷贝
  • 在 YAML 异常处理中,建议添加具体的错误日志输出
  • 对于大量使用的 Q_UNUSED,可以考虑在文件开头添加注释说明原因

总体而言,代码质量较好,大部分遵循了良好的 C++ 实践。主要需要关注的是实现被标记为 TODO 的功能,以及确保所有未使用的参数都有适当的 Q_UNUSED 宏和注释说明。

@deepin-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: 18202781743, wjyrich

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

Details 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

@wjyrich
Copy link
Contributor Author

wjyrich commented Aug 18, 2025

/forcemerge

@deepin-bot
Copy link

deepin-bot bot commented Aug 18, 2025

This pr force merged! (status: blocked)

@deepin-bot deepin-bot bot merged commit ed2eefc into linuxdeepin:master Aug 18, 2025
7 of 10 checks passed
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