-
Notifications
You must be signed in to change notification settings - Fork 15
sync: from linuxdeepin/dtkcore #179
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
|
Note
详情{
"CMakeLists.txt": [
{
"line": " HOMEPAGE_URL \"https://github.com/linuxdeepin/dtkcore\"",
"line_number": 9,
"rule": "S35",
"reason": "Url link | e18a6b5679"
}
],
"docs/CMakeLists.txt": [
{
"line": "execute_process(COMMAND git clone https://github.com/linuxdeepin/doxygen-theme.git --depth=1",
"line_number": 41,
"rule": "S35",
"reason": "Url link | d2deace9b0"
}
]
} |
05250a0 to
4833e32
Compare
|
Note
详情{
"CMakeLists.txt": [
{
"line": " HOMEPAGE_URL \"https://github.com/linuxdeepin/dtkcore\"",
"line_number": 9,
"rule": "S35",
"reason": "Url link | e18a6b5679"
}
],
"docs/CMakeLists.txt": [
{
"line": "execute_process(COMMAND git clone https://github.com/linuxdeepin/doxygen-theme.git --depth=1",
"line_number": 41,
"rule": "S35",
"reason": "Url link | d2deace9b0"
}
]
} |
4833e32 to
8366a1c
Compare
|
Note
详情{
"CMakeLists.txt": [
{
"line": " HOMEPAGE_URL \"https://github.com/linuxdeepin/dtkcore\"",
"line_number": 9,
"rule": "S35",
"reason": "Url link | e18a6b5679"
}
],
"docs/CMakeLists.txt": [
{
"line": "execute_process(COMMAND git clone https://github.com/linuxdeepin/doxygen-theme.git --depth=1",
"line_number": 41,
"rule": "S35",
"reason": "Url link | d2deace9b0"
}
]
} |
8366a1c to
0d8c3d6
Compare
|
Note
详情{
"CMakeLists.txt": [
{
"line": " HOMEPAGE_URL \"https://github.com/linuxdeepin/dtkcore\"",
"line_number": 9,
"rule": "S35",
"reason": "Url link | e18a6b5679"
}
],
"docs/CMakeLists.txt": [
{
"line": "execute_process(COMMAND git clone https://github.com/linuxdeepin/doxygen-theme.git --depth=1",
"line_number": 41,
"rule": "S35",
"reason": "Url link | d2deace9b0"
}
]
} |
0d8c3d6 to
847e158
Compare
|
Note
详情{
"CMakeLists.txt": [
{
"line": " HOMEPAGE_URL \"https://github.com/linuxdeepin/dtkcore\"",
"line_number": 9,
"rule": "S35",
"reason": "Url link | e18a6b5679"
}
],
"docs/CMakeLists.txt": [
{
"line": "execute_process(COMMAND git clone https://github.com/linuxdeepin/doxygen-theme.git --depth=1",
"line_number": 41,
"rule": "S35",
"reason": "Url link | d2deace9b0"
}
]
} |
847e158 to
81a530e
Compare
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: deepin-ci-robot The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
Note
详情{
"CMakeLists.txt": [
{
"line": " HOMEPAGE_URL \"https://github.com/linuxdeepin/dtkcore\"",
"line_number": 9,
"rule": "S35",
"reason": "Url link | e18a6b5679"
}
],
"docs/CMakeLists.txt": [
{
"line": "execute_process(COMMAND git clone https://github.com/linuxdeepin/doxygen-theme.git --depth=1",
"line_number": 41,
"rule": "S35",
"reason": "Url link | d2deace9b0"
}
]
} |
81a530e to
b02a3f0
Compare
|
Note
详情{
"CMakeLists.txt": [
{
"line": " HOMEPAGE_URL \"https://github.com/linuxdeepin/dtkcore\"",
"line_number": 9,
"rule": "S35",
"reason": "Url link | e18a6b5679"
}
],
"docs/CMakeLists.txt": [
{
"line": "execute_process(COMMAND git clone https://github.com/linuxdeepin/doxygen-theme.git --depth=1",
"line_number": 41,
"rule": "S35",
"reason": "Url link | d2deace9b0"
}
]
} |
b02a3f0 to
9cb61b0
Compare
|
Note
详情{
"CMakeLists.txt": [
{
"line": " HOMEPAGE_URL \"https://github.com/linuxdeepin/dtkcore\"",
"line_number": 9,
"rule": "S35",
"reason": "Url link | e18a6b5679"
}
],
"docs/CMakeLists.txt": [
{
"line": "execute_process(COMMAND git clone https://github.com/linuxdeepin/doxygen-theme.git --depth=1",
"line_number": 41,
"rule": "S35",
"reason": "Url link | d2deace9b0"
}
]
} |
9cb61b0 to
df42b25
Compare
|
Note
详情{
"CMakeLists.txt": [
{
"line": " HOMEPAGE_URL \"https://github.com/linuxdeepin/dtkcore\"",
"line_number": 9,
"rule": "S35",
"reason": "Url link | e18a6b5679"
}
],
"docs/CMakeLists.txt": [
{
"line": "execute_process(COMMAND git clone https://github.com/linuxdeepin/doxygen-theme.git --depth=1",
"line_number": 41,
"rule": "S35",
"reason": "Url link | d2deace9b0"
}
]
} |
df42b25 to
daab7f2
Compare
|
Note
详情{
"CMakeLists.txt": [
{
"line": " HOMEPAGE_URL \"https://github.com/linuxdeepin/dtkcore\"",
"line_number": 9,
"rule": "S35",
"reason": "Url link | e18a6b5679"
}
],
"docs/CMakeLists.txt": [
{
"line": "execute_process(COMMAND git clone https://github.com/linuxdeepin/doxygen-theme.git --depth=1",
"line_number": 41,
"rule": "S35",
"reason": "Url link | d2deace9b0"
}
]
} |
daab7f2 to
6298f29
Compare
|
Note
详情{
"CMakeLists.txt": [
{
"line": " HOMEPAGE_URL \"https://github.com/linuxdeepin/dtkcore\"",
"line_number": 9,
"rule": "S35",
"reason": "Url link | e18a6b5679"
}
],
"docs/CMakeLists.txt": [
{
"line": "execute_process(COMMAND git clone https://github.com/linuxdeepin/doxygen-theme.git --depth=1",
"line_number": 41,
"rule": "S35",
"reason": "Url link | d2deace9b0"
}
]
} |
6298f29 to
6662bdf
Compare
|
Note
详情{
"CMakeLists.txt": [
{
"line": " HOMEPAGE_URL \"https://github.com/linuxdeepin/dtkcore\"",
"line_number": 9,
"rule": "S35",
"reason": "Url link | e18a6b5679"
}
],
"docs/CMakeLists.txt": [
{
"line": "execute_process(COMMAND git clone https://github.com/linuxdeepin/doxygen-theme.git --depth=1",
"line_number": 41,
"rule": "S35",
"reason": "Url link | d2deace9b0"
}
]
} |
6662bdf to
0e09405
Compare
|
Note
详情{
"CMakeLists.txt": [
{
"line": " HOMEPAGE_URL \"https://github.com/linuxdeepin/dtkcore\"",
"line_number": 9,
"rule": "S35",
"reason": "Url link | e18a6b5679"
}
],
"docs/CMakeLists.txt": [
{
"line": "execute_process(COMMAND git clone https://github.com/linuxdeepin/doxygen-theme.git --depth=1",
"line_number": 41,
"rule": "S35",
"reason": "Url link | d2deace9b0"
}
]
} |
0e09405 to
970cfdf
Compare
|
Note
详情{
"CMakeLists.txt": [
{
"line": " HOMEPAGE_URL \"https://github.com/linuxdeepin/dtkcore\"",
"line_number": 9,
"rule": "S35",
"reason": "Url link | e18a6b5679"
}
],
"docs/CMakeLists.txt": [
{
"line": "execute_process(COMMAND git clone https://github.com/linuxdeepin/doxygen-theme.git --depth=1",
"line_number": 41,
"rule": "S35",
"reason": "Url link | d2deace9b0"
}
]
} |
970cfdf to
e263fd7
Compare
|
Note
详情{
"CMakeLists.txt": [
{
"line": " HOMEPAGE_URL \"https://github.com/linuxdeepin/dtkcore\"",
"line_number": 9,
"rule": "S35",
"reason": "Url link | e18a6b5679"
}
],
"docs/CMakeLists.txt": [
{
"line": "execute_process(COMMAND git clone https://github.com/linuxdeepin/doxygen-theme.git --depth=1",
"line_number": 41,
"rule": "S35",
"reason": "Url link | d2deace9b0"
}
]
} |
e263fd7 to
e20259c
Compare
|
Note
详情{
"CMakeLists.txt": [
{
"line": " HOMEPAGE_URL \"https://github.com/linuxdeepin/dtkcore\"",
"line_number": 9,
"rule": "S35",
"reason": "Url link | e18a6b5679"
}
],
"docs/CMakeLists.txt": [
{
"line": "execute_process(COMMAND git clone https://github.com/linuxdeepin/doxygen-theme.git --depth=1",
"line_number": 41,
"rule": "S35",
"reason": "Url link | d2deace9b0"
}
]
} |
e20259c to
ecd8569
Compare
|
Note
详情{
"CMakeLists.txt": [
{
"line": " HOMEPAGE_URL \"https://github.com/linuxdeepin/dtkcore\"",
"line_number": 9,
"rule": "S35",
"reason": "Url link | e18a6b5679"
}
],
"docs/CMakeLists.txt": [
{
"line": "execute_process(COMMAND git clone https://github.com/linuxdeepin/doxygen-theme.git --depth=1",
"line_number": 41,
"rule": "S35",
"reason": "Url link | d2deace9b0"
}
]
} |
ecd8569 to
e4c6c2e
Compare
|
Note
详情{
"CMakeLists.txt": [
{
"line": " HOMEPAGE_URL \"https://github.com/linuxdeepin/dtkcore\"",
"line_number": 9,
"rule": "S35",
"reason": "Url link | e18a6b5679"
}
],
"docs/CMakeLists.txt": [
{
"line": "execute_process(COMMAND git clone https://github.com/linuxdeepin/doxygen-theme.git --depth=1",
"line_number": 41,
"rule": "S35",
"reason": "Url link | d2deace9b0"
}
]
} |
e4c6c2e to
706e843
Compare
|
Note
详情{
"CMakeLists.txt": [
{
"line": " HOMEPAGE_URL \"https://github.com/linuxdeepin/dtkcore\"",
"line_number": 9,
"rule": "S35",
"reason": "Url link | e18a6b5679"
}
],
"docs/CMakeLists.txt": [
{
"line": "execute_process(COMMAND git clone https://github.com/linuxdeepin/doxygen-theme.git --depth=1",
"line_number": 41,
"rule": "S35",
"reason": "Url link | d2deace9b0"
}
]
} |
706e843 to
cbb19b7
Compare
|
Note
详情{
"CMakeLists.txt": [
{
"line": " HOMEPAGE_URL \"https://github.com/linuxdeepin/dtkcore\"",
"line_number": 9,
"rule": "S35",
"reason": "Url link | e18a6b5679"
}
],
"docs/CMakeLists.txt": [
{
"line": "execute_process(COMMAND git clone https://github.com/linuxdeepin/doxygen-theme.git --depth=1",
"line_number": 41,
"rule": "S35",
"reason": "Url link | d2deace9b0"
}
]
} |
cbb19b7 to
98291ec
Compare
|
Note
详情{
"CMakeLists.txt": [
{
"line": " HOMEPAGE_URL \"https://github.com/linuxdeepin/dtkcore\"",
"line_number": 9,
"rule": "S35",
"reason": "Url link | e18a6b5679"
}
],
"docs/CMakeLists.txt": [
{
"line": "execute_process(COMMAND git clone https://github.com/linuxdeepin/doxygen-theme.git --depth=1",
"line_number": 41,
"rule": "S35",
"reason": "Url link | d2deace9b0"
}
]
} |
Synchronize source files from linuxdeepin/dtkcore. Source-pull-request: linuxdeepin/dtkcore#531
98291ec to
812146e
Compare
|
Note
详情{
"CMakeLists.txt": [
{
"line": " HOMEPAGE_URL \"https://github.com/linuxdeepin/dtkcore\"",
"line_number": 9,
"rule": "S35",
"reason": "Url link | e18a6b5679"
}
],
"docs/CMakeLists.txt": [
{
"line": "execute_process(COMMAND git clone https://github.com/linuxdeepin/doxygen-theme.git --depth=1",
"line_number": 41,
"rule": "S35",
"reason": "Url link | d2deace9b0"
}
]
} |
deepin pr auto review代码审查报告1. 总体评估本次代码变更主要涉及DTK(Deepin Tool Kit)项目的版本管理和构建系统调整,包括:
整体来看,代码质量较高,但存在一些可以改进的地方。 2. 语法和逻辑审查2.1 CMakeLists.txt 中的改进点
# 原代码
if("${PROJECT_VERSION_MAJOR}" STREQUAL "5")
set(QT_VERSION_MAJOR "5")
elseif("${PROJECT_VERSION_MAJOR}" STREQUAL "6")
set(QT_VERSION_MAJOR "6")
set(DTK_VERSION_MAJOR "6")
else()
message(SEND_ERROR "not support Prject Version ${PROJECT_VERSION}.")
endif()
# 新代码
option(DTK5 "Build DTK5." ON)
if(DTK5)
set(DTK_VERSION_MAJOR "5")
set(DTK_NAME_SUFFIX "") # Empty name suffix for DTK5 products.
else()
set(DTK_VERSION_MAJOR "6")
set(DTK_NAME_SUFFIX "6")
endif()评价:新代码通过option提供了更灵活的构建选项,逻辑更清晰。 建议:
if(DTK5 AND NOT QT_VERSION_MAJOR EQUAL 5)
message(FATAL_ERROR "DTK5 requires Qt 5")
endif()
if(NOT DTK5 AND NOT QT_VERSION_MAJOR EQUAL 6)
message(FATAL_ERROR "DTK6 requires Qt 6")
endif()
option(BUIILD_TESTING "Build tests" OFF)问题:BUIILD_TESTING拼写错误,应为BUILD_TESTING 2.2 线程安全改进在 优点:
潜在问题:
QMetaObject::invokeMethod(this, [this, newValue, key, value]() {
Q_ASSERT(QThread::currentThread() == m_userConfig->thread());
if (m_userConfig && p_autoDisplayFeature != newValue) {
p_autoDisplayFeature = newValue;
Q_EMIT m_userConfig->autoDisplayFeatureChanged();
Q_EMIT m_userConfig->valueChanged(key, value);
}
});建议:考虑使用
~dconfig_org_deepin_dtk_preference() {
int oldStatus = m_data->m_status.fetchAndStoreOrdered(static_cast<int>(Data::Status::Destroyed));
// ...
}建议:添加更详细的注释说明线程安全保证,并考虑添加单元测试验证多线程场景。 2.3 测试框架改进# 原代码
add_compile_options(-fsanitize=address)
add_link_options(-fsanitize=address)
# 新代码
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
add_compile_options(-fsanitize=address)
add_link_options(-fsanitize=address)
endif()评价:改进合理,只在Debug模式下启用地址检查,避免影响Release性能。 建议:
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
add_compile_options(-fsanitize=address -fsanitize=undefined)
add_link_options(-fsanitize=address -fsanitize=undefined)
endif()3. 代码质量改进3.1 命名一致性在多个文件中,版本后缀从 # dtkcore.cmake
set (INCLUDE_INSTALL_DIR "${CMAKE_INSTALL_INCLUDEDIR}/dtk${DTK_VERSION_MAJOR}/DCore")建议:统一使用 3.2 代码注释部分关键逻辑缺少注释,例如: QPointer<Data> safeData(m_data);
QMetaObject::invokeMethod(worker, [safeData, backend, name, appId, subpath, isGeneric, worker]() mutable {
delete worker;
worker = nullptr;
// ...建议:添加注释说明使用QPointer的原因和线程安全保证。 3.3 错误处理在配置初始化失败时: if (!config || !config->isValid()) {
qWarning() << QLatin1String("Failed to create DConfig instance.");
// ...
}建议:
4. 性能优化建议
if (key == QStringLiteral("autoDisplayFeature")) {
// ...
}建议:使用QStringLiteral或静态字符串常量,避免重复构造。
connect(config, &DTK_CORE_NAMESPACE::DConfig::valueChanged, this, [this](const QString &key) {
updateValue(key);
}, Qt::DirectConnection);评价:使用DirectConnection是合理的,但需要确保线程安全。 建议:添加注释说明为什么使用DirectConnection,以及线程安全保证。 5. 安全性改进
QJsonDocument doc = QJsonDocument::fromJson(jsonData);
if (doc.isNull()) {
// 处理错误
}建议:添加更严格的输入验证,包括:
if (!config || !config->isValid()) {
// ...
if (config)
delete config;
return;
}评价:处理得当,避免了资源泄漏。 建议:考虑使用智能指针(如QScopedPointer)自动管理资源。 6. 兼容性考虑版本变更可能影响现有代码: set(DTK_NAME_SUFFIX "") # Empty name suffix for DTK5 products.建议:
7. 测试建议
8. 文档改进建议
9. 总结本次代码变更整体质量较高,主要改进包括:
主要改进建议:
这些改进将进一步提高代码的可维护性、可靠性和性能。 |
Synchronize source files from linuxdeepin/dtkcore.
Source-pull-request: linuxdeepin/dtkcore#531