Skip to content

feat: hide specific version of UFS#178

Merged
deepin-bot[bot] merged 1 commit intolinuxdeepin:release/1071from
itsXuSt:1071
Oct 10, 2025
Merged

feat: hide specific version of UFS#178
deepin-bot[bot] merged 1 commit intolinuxdeepin:release/1071from
itsXuSt:1071

Conversation

@itsXuSt
Copy link
Contributor

@itsXuSt itsXuSt commented Oct 10, 2025

only shows USF and hide the versions.

Log: as above.

Task: https://pms.uniontech.com/task-view-382543.html

Summary by Sourcery

Enhancements:

  • Hide specific UFS version numbers (3.0, 3.1, 4.0) in disk interface detection and show only generic “UFS”

only shows USF and hide the versions.

Log: as above.

Task: https://pms.uniontech.com/task-view-382543.html
@sourcery-ai
Copy link

sourcery-ai bot commented Oct 10, 2025

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Simplify UFS interface labeling by collapsing version-specific checks into a single generic UFS label.

Class diagram for updated DeviceStorage::getDiskInfoInterface() logic

classDiagram
class DeviceStorage {
    +void getDiskInfoInterface(devicePath: QString, interface: QString)
}
class Utils {
    +QString readContent(path: QString)
}
DeviceStorage --> Utils: uses
Loading

File-Level Changes

Change Details Files
Condensed UFS version checks into a unified condition and updated label assignment
  • Removed separate branches for UFS 3.0, 3.1, and 4.0
  • Merged version checks into one combined conditional
  • Assigned generic “UFS” interface regardless of specific version
service/diskoperation/DeviceStorage.cpp

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

@deepin-ci-robot
Copy link

deepin pr auto review

这段代码审查如下:

  1. 语法逻辑:
  • 原代码通过多个if-else判断来识别不同的UFS版本,修改后的代码简化了判断逻辑,但丢失了版本信息
  • 修改后的代码将所有版本统一标记为"UFS",这可能导致调用方无法区分具体版本
  1. 代码质量:
  • 原代码的版本判断逻辑更清晰,便于维护和扩展
  • 修改后的代码虽然更简洁,但降低了代码的可读性和精确性
  • 建议保留原版本的判断逻辑,或者使用更结构化的方式来处理版本信息
  1. 代码性能:
  • 修改后的代码减少了条件判断次数,性能略有提升
  • 但这种性能提升微不足道,不值得牺牲代码的精确性和可读性
  1. 代码安全:
  • 两个版本在安全性上没有明显差异
  • 但修改后的版本统一返回"UFS"可能导致依赖版本信息的功能出现问题

改进建议:

  1. 如果需要保留版本信息,建议恢复原来的if-else结构:
if (spec_version.contains("300")) {
    interface = "UFS 3.0";
} else if (spec_version.contains("310")) {
    interface = "UFS 3.1";
} else if (spec_version.contains("400")) {
    interface = "UFS 4.0";
}
  1. 如果确实需要统一为"UFS",建议添加注释说明原因:
// 统一返回UFS接口类型,不区分具体版本
if (spec_version.contains("300") || spec_version.contains("310") || spec_version.contains("400")) {
    interface = "UFS";
}
  1. 更好的改进方案是使用枚举或映射表来管理版本信息:
QMap<QString, QString> ufsVersionMap = {
    {"300", "UFS 3.0"},
    {"310", "UFS 3.1"},
    {"400", "UFS 4.0"}
};

for (auto it = ufsVersionMap.constBegin(); it != ufsVersionMap.constEnd(); ++it) {
    if (spec_version.contains(it.key())) {
        interface = it.value();
        break;
    }
}

这样的改进既保持了代码的清晰性,又便于后续添加新的UFS版本,同时提高了代码的可维护性。

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

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: itsXuSt, max-lvs

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

@itsXuSt
Copy link
Contributor Author

itsXuSt commented Oct 10, 2025

/merge

@deepin-bot deepin-bot bot merged commit 39c0532 into linuxdeepin:release/1071 Oct 10, 2025
18 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