Skip to content

chore: [log]More logs#357

Merged
deepin-bot[bot] merged 1 commit into
linuxdeepin:masterfrom
re2zero:bugfix
May 23, 2025
Merged

chore: [log]More logs#357
deepin-bot[bot] merged 1 commit into
linuxdeepin:masterfrom
re2zero:bugfix

Conversation

@re2zero
Copy link
Copy Markdown
Contributor

@re2zero re2zero commented May 23, 2025

Add more logs for log coverage.

Log: Add more logs.

Summary by Sourcery

Add comprehensive logging statements across the application to improve traceability of configuration, file operations, editor actions, UI interactions, theming, commands, and application lifecycle.

Enhancements:

  • Log Settings backend and Settings singleton events including construction, sync, option reads/writes, and destruction
  • Log editor core activities such as TextEdit lifecycle, text insertion/deletion, and search/replace operations
  • Trace file I/O and encoding workflows in EditWrapper and FileLoadThread including open, read, save, encoding detection/conversion, and load completion
  • Instrument utility functions in Utils and DetectCode for path resolution, file checks, memory info, and text‐encoding detection
  • Record undo/redo command flows and UndoList operations with logs for command creation, execution, progress, and cleanup
  • Log UI control lifecycle and user interactions in FindBar, ReplaceBar, JumpLineBar, Tabbar, LineBar, BottomBar, ToolBar, WarningNotices, and window/theme modules
  • Add startup/shutdown logs in main.cpp, EditorApplication, PerformanceMonitor, and DBus registration to trace application lifecycle

@github-actions
Copy link
Copy Markdown

  • 敏感词检查失败, 检测到2个文件存在敏感词
详情
{
    "src/editorapplication.cpp": [
        {
            "line": "    const QString acknowledgementLink = \"https://www.deepin.org/original/deepin-editor/\";",
            "line_number": 14,
            "rule": "S35",
            "reason": "Url link | 6859e7727a"
        }
    ],
    "src/widgets/window.cpp": [
        {
            "line": "    QString key = \"base/enable\";",
            "line_number": 376,
            "rule": "S106",
            "reason": "Var naming | 64f28539d9"
        }
    ]
}

@sourcery-ai
Copy link
Copy Markdown

sourcery-ai Bot commented May 23, 2025

Reviewer's Guide

This PR adds extensive logging instrumentation across the codebase—using qDebug, qInfo, and qWarning—to capture method entries/exits, parameter values, branch outcomes, and error conditions without altering business logic.

Class Diagram for common/settings.cpp: Logging Updates

classDiagram
  class CustemBackend {
    +CustemBackend(QString filepath, QObject *parent) "+ logging added"
    +doSync() "+ logging added"
    +doSetOption(QString key, QVariant value) "+ logging added"
    +QStringList keys() const "+ logging added"
    +QVariant getOption(QString key) const "+ logging added"
    +~CustemBackend() "+ logging added"
  }
  class Settings {
    +Settings(QWidget *parent) "+ logging added"
    +setSavePath(int id, QString path) "+ logging added"
    +QString getSavePath(int id) "+ logging added"
    +setSavePathId(int id) "+ logging added"
    +~Settings() "+ logging added"
    +setSettingDialog(DSettingsDialog *settingsDialog) "+ logging added"
    +dtkThemeWorkaround(QWidget *parent, QString theme) "+ logging added"
    +createSavingPathWgt(QObject* obj) "+ logging added"
    +instance() "+ logging added"
    +updateAllKeysWithKeymap(QString keymap) "+ logging added"
    +removeLockFiles() "+ logging added"
    +slotsigAdjustFont(QVariant value) "+ logging added"
    +slotsigAdjustFontSize(QVariant value) "+ logging added"
    +slotsigAdjustWordWrap(QVariant value) "+ logging added"
    +slotsigSetLineNumberShow(QVariant value) "+ logging added"
    +slotsigAdjustBookmark(QVariant value) "+ logging added"
    +slotsigShowCodeFlodFlag(QVariant value) "+ logging added"
    +slotsigShowBlankCharacter(QVariant value) "+ logging added"
    +slotsigHightLightCurrentLine(QVariant value) "+ logging added"
    +slotsigAdjustTabSpaceNumber(QVariant value) "+ logging added"
  }
Loading

Class Diagram for editor/dtextedit.cpp: Logging Updates

classDiagram
  class TextEdit {
    +TextEdit(QWidget *parent) "+ logging added"
    +~TextEdit() "+ logging added"
    +insertTextEx(QTextCursor cursor, QString text) "+ logging added"
    +insertMultiTextEx(QList~QPair~QTextCursor, QString~~ multiText) "+ logging added"
    +deleteSelectTextEx(QTextCursor cursor) "+ logging added"
    +deleteTextEx(QTextCursor cursor) "+ logging added"
    +moveLineDownUp(bool up) "+ logging added"
    +replaceAll(QString replaceText, QString withText, Qt::CaseSensitivity caseFlag) "+ logging added"
    +replaceRest(QString replaceText, QString withText, Qt::CaseSensitivity caseFlag) "+ logging added"
    +findKeywordForward(QString keyword) "+ logging added"
    +redo_() "+ logging added"
    +undo_() "+ logging added"
    +findCursor(QString substr, QString text, int from, bool backward, int cursorPos, Qt::CaseSensitivity caseFlag) "+ logging added"
  }
Loading

Class Diagram for editor/editwrapper.cpp: Logging Updates

classDiagram
  class EditWrapper {
    +setQuitFlag() "+ logging added"
    +isQuit() "+ logging added"
    +openFile(QString filepath, QString qstrTruePath, bool bIsTemFile) "+ logging added"
    +readFile(QByteArray encode) "+ logging added"
    +saveAsFile(QString newFilePath, QByteArray encodeName) "+ logging added"
    +reloadFileEncode(QByteArray encode) "+ logging added"
    +reloadFileHighlight(QString definitionName) "+ logging added"
    +handleFileLoadFinished(QByteArray encode, QByteArray content, bool error) "+ logging added"
    +updateModifyStatus(bool bModified) "+ logging added"
  }
Loading

Class Diagram for controls/findbar.cpp: Logging Updates

classDiagram
  class FindBar {
    +FindBar(QWidget *parent) "+ logging added"
    +activeInput(QString text, QString file, int row, int column, int scrollOffset) "+ logging added"
    +findCancel() "+ logging added"
    +handleContentChanged() "+ logging added"
    +handleFindPrev() "+ logging added"
    +handleFindNext() "+ logging added"
    +hideEvent(QHideEvent *event) "+ logging added"
    +keyPressEvent(QKeyEvent *e) "+ logging added"
    +updateSizeMode() "+ logging added"
    +setMismatchAlert(bool isAlert) "+ logging added"
    +setSearched(bool searched) "+ logging added"
  }
Loading

Class Diagram for common/iflytek_ai_assistant.cpp: Logging Updates

classDiagram
  class IflytekAiAssistant {
    +IflytekAiAssistant(QObject *parent) "+ logging added"
    +CallStatus checkValid() "+ logging added"
    +CallStatus isTtsInWorking() const "+ logging added"
    +CallStatus isTtsEnable() const "+ logging added"
    +CallStatus textToSpeech() "+ logging added"
    +CallStatus stopTtsDirectly() const "+ logging added"
    +CallStatus stopTtsDirectlyInternal() const "+ logging added"
    +CallStatus getIatEnable() const "+ logging added"
    +CallStatus speechToText() "+ logging added"
    +CallStatus getTransEnable() const "+ logging added"
    +CallStatus textToTranslate() "+ logging added"
    +QString errorString(CallStatus ret) const "+ logging added"
    +CallStatus isCopilotEnabled(QSharedPointer~QDBusInterface~ copilot) "+ logging added"
    +checkAiExists() "+ logging added"
  }
Loading

Class Diagram for common/utils.cpp: Logging Updates

classDiagram
  class Utils {
    <<static>> +QString getQrcPath(QString imageName) "+ logging added"
    <<static>> +QString getQssPath(QString qssName) "+ logging added"
    <<static>> +bool fileExists(QString path) "+ logging added"
    <<static>> +bool fileIsWritable(QString path) "+ logging added"
    <<static>> +QVariantMap getThemeMapFromPath(QString filepath) "+ logging added"
    <<static>> +bool getSystemMemoryInfo(qlonglong totalMemory, qlonglong freeMemory) "+ logging added"
    <<static>> +bool isMemorySufficientForOperation(OperationType operationType, qlonglong operationDataSize, qlonglong currentDocumentSize) "+ logging added"
  }
Loading

Class Diagram for encodes/detectcode.cpp: Logging Updates

classDiagram
  class DetectCode {
    +QByteArray GetFileEncodingFormat(QString filepath, QByteArray content) "+ logging added"
    +QByteArray UchardetCode(QString filepath) "+ logging added"
    +void icuDetectTextEncoding(QString filePath, QByteArrayList listDetectRet) "+ logging added"
    +bool detectTextEncoding(char *data, size_t len, char **detected, QByteArrayList listDetectRet) "+ logging added"
    +QByteArray selectCoding(QByteArray ucharDetectdRet, QByteArrayList icuDetectRetList, float confidence) "+ logging added"
    +bool ChangeFileEncodingFormat(QByteArray inputStr, QByteArray outStr, QString fromCode, QString toCode) "+ logging added"
    +bool convertEncodingTextCodec(QByteArray inputStr, QByteArray outStr, QString fromCode, QString toCode) "+ logging added"
  }
Loading

Class Diagram for startmanager.cpp: Logging Updates

classDiagram
  class StartManager {
    +StartManager *instance() "+ logging added"
    +StartManager(QObject *parent) "+ logging added"
    +bool checkPath(QString file) "+ logging added"
    +void autoBackupFile() "+ logging added"
    +int recoverFile(Window *window) "+ logging added"
    +void openFilesInWindow(QStringList files) "+ logging added"
    +void openFilesInTab(QStringList files) "+ logging added"
    +Window *createWindow(bool alwaysCenter) "+ logging added"
    +void slotCloseWindow() "+ logging added"
    +void initBlockShutdown() "+ logging added"
    +void slotCheckUnsaveTab() "+ logging added"
  }
Loading

Class Diagram for editor/undolist.cpp: Logging Updates

classDiagram
  class UndoList {
    +UndoList() "+ logging added"
    +~UndoList() "+ logging added"
    +void appendCom(QUndoCommand* com) "+ logging added"
    +void undo() "+ logging added"
    +void redo() "+ logging added"
  }
Loading

Class Diagram for controls/replacebar.cpp: Logging Updates

classDiagram
  class ReplaceBar {
    +ReplaceBar(QWidget *parent) "+ logging added"
    +activeInput(QString text, QString file, int row, int column, int scrollOffset) "+ logging added"
    +handleReplaceNext() "+ logging added"
    +updateSizeMode() "+ logging added"
  }
Loading

Class Diagram for editor/deletebackcommond.cpp: Logging Updates

classDiagram
  class DeleteBackCommand {
    +DeleteBackCommand(QTextCursor cursor, QPlainTextEdit *edit) "+ logging added"
    +~DeleteBackCommand() "+ logging added"
    +void undo() "+ logging added"
    +void redo() "+ logging added"
  }
  class DeleteBackAltCommand {
    +DeleteBackAltCommand(QList~QTextEdit::ExtraSelection~ selections, bool backward, QPlainTextEdit *edit) "+ logging added"
    +~DeleteBackAltCommand() "+ logging added"
    +void undo() "+ logging added"
    +void redo() "+ logging added"
  }
Loading

Class Diagram for widgets/ddropdownmenu.cpp: Logging Updates

classDiagram
  class DDropdownMenu {
    +DDropdownMenu(QWidget *parent) "+ logging added"
    +~DDropdownMenu() "+ logging added"
    +createEncodeMenu() "+ logging added in internal lambda"
    +createHighLightMenu() "+ logging added in internal lambdas"
    +eventFilter(QObject *object, QEvent *event) "+ logging added"
  }
Loading

Class Diagram for common/text_file_saver.cpp: Logging Updates

classDiagram
  class TextFileSaver {
    +TextFileSaver(QTextDocument *document) "+ logging added"
    +void setFilePath(QString filePath) "+ logging added"
    +void setEncoding(QByteArray toEncode) "+ logging added"
    +bool save() "+ logging added"
    +bool saveAs(QString newFilePath) "+ logging added"
    +bool saveToFile(QFileDevice file) "+ logging added"
    +bool convertEncoding(QByteArray input, QByteArray output) const "+ logging added"
  }
Loading

Class Diagram for editor/inserttextundocommand.cpp: Logging Updates

classDiagram
  class InsertTextUndoCommand {
    +InsertTextUndoCommand(QTextCursor textcursor, QString text, QPlainTextEdit *edit) "+ logging added"
    +InsertTextUndoCommand(QList~QTextEdit::ExtraSelection~ selections, QString text, QPlainTextEdit *edit) "+ logging added"
    +void undo() "+ logging added"
    +void redo() "+ logging added"
  }
  class MidButtonInsertTextUndoCommand {
    +MidButtonInsertTextUndoCommand(QTextCursor textcursor, QString text, TextEdit *edit) "+ logging added"
    +void undo() "+ logging added"
    +void redo() "+ logging added"
  }
  class DragInsertTextUndoCommand {
    +DragInsertTextUndoCommand(QTextCursor textcursor, QString text, TextEdit *edit) "+ logging added"
    +void undo() "+ logging added"
    +void redo() "+ logging added"
  }
Loading

Class Diagram for common/fileloadthread.cpp: Logging Updates

classDiagram
  class FileLoadThread {
    +FileLoadThread(QString filepath, QObject *parent) "+ logging added"
    +~FileLoadThread() "+ logging added"
    +void run() "+ logging added"
  }
Loading

Class Diagram for controls/jumplinebar.cpp: Logging Updates

classDiagram
  class JumpLineBar {
    +JumpLineBar(DFloatingWidget *parent) "+ logging added"
    +void focus() "+ logging added"
    +void activeInput(QString file, int row, int column, int lineCount, int scrollOffset) "+ logging added"
    +void updateSizeMode() "+ logging added"
  }
Loading

Class Diagram for controls/tabbar.cpp: Logging Updates

classDiagram
  class Tabbar {
    +Tabbar(QWidget *parent) "+ logging added"
    +void addTab(QString filePath, QString tabName, QString tipPath) "+ logging added"
    +void closeTab(int index) "+ logging added"
    +void updateTab(int index, QString filePath, QString tabName) "+ logging added"
    +void onTabDrapStart() "+ logging added"
  }
Loading

Class Diagram for controls/linebar.cpp: Logging Updates

classDiagram
  class LineBar {
    +LineBar(DLineEdit *parent) "+ logging added"
    +void handleTextChangeTimer() "+ logging added"
    +void handleTextChanged(QString str) "+ logging added"
    +void focusOutEvent(QFocusEvent *e) "+ logging added"
    +void keyPressEvent(QKeyEvent *e) "+ logging added"
  }
Loading

Class Diagram for editor/FlashTween.cpp: Logging Updates

classDiagram
  class FlashTween {
    +FlashTween() "+ logging added"
    +~FlashTween() "+ logging added"
    +void startY(qreal t, qreal b, qreal c, qreal d, FunSlideInertial f) "+ logging added"
    +void startX(qreal t, qreal b, qreal c, qreal d, FunSlideInertial f) "+ logging added"
    +void __runY() "+ logging added"
    +void __runX() "+ logging added"
  }
Loading

Class Diagram for editor/insertblockbytextcommond.cpp: Logging Updates

classDiagram
  class InsertBlockByTextCommand {
    +InsertBlockByTextCommand(QString text, TextEdit *edit, EditWrapper* wrapper) "+ logging added"
    +~InsertBlockByTextCommand() "+ logging added"
    +void redo() "+ logging added"
    +void undo() "+ logging added"
    +void insertByBlock() "+ logging added"
  }
Loading

Class Diagram for editor/showflodcodewidget.cpp: Logging Updates

classDiagram
  class ShowFlodCodeWidget {
    +ShowFlodCodeWidget(DWidget *parent) "+ logging added"
    +~ShowFlodCodeWidget() "+ logging added"
    +void clear() "+ logging added"
    +void initHighLight(QString filepath, bool bIsLight) "+ logging added"
    +void setStyle(bool bIsLineWrap) "+ logging added"
    +void hideFirstBlock() "+ logging added"
    +void appendText(QString strText, int maxWidth) "+ logging added"
  }
Loading

Class Diagram for editorapplication.cpp: Logging Updates

classDiagram
  class EditorApplication {
    +EditorApplication(int &argc, char *argv[]) "+ logging added"
    +~EditorApplication() "+ logging added"
    +void handleQuitAction() "+ logging added"
    +bool notify(QObject *object, QEvent *event) "+ logging added"
    +void pressSpace(DPushButton *pushButton) "+ logging added"
  }
Loading

Class Diagram for widgets/pathsettintwgt.cpp: Logging Updates

classDiagram
  class PathSettingWgt {
    +PathSettingWgt(QWidget* parent) "+ logging added"
    +~PathSettingWgt() "+ logging added"
    +void onBoxClicked(int id) "+ logging added"
    +void onBtnClicked() "+ logging added"
  }
Loading

Class Diagram for widgets/window.cpp: Logging Updates

classDiagram
  class Window {
    +Window(DMainWindow *parent) "+ logging added"
    +~Window() "+ logging added"
    +void showCenterWindow(bool bIsCenter) "+ logging added"
    +void openFile() "+ logging added"
    +bool saveFile() "+ logging added"
    +void loadTheme(QString path) "+ logging added"
  }
Loading

Class Diagram for common/eventlogutils.cpp: Logging Updates

classDiagram
  class Eventlogutils {
    +Eventlogutils *GetInstance() "+ logging added"
    +void writeLogs(QJsonObject data) "+ logging added"
    +Eventlogutils() "+ logging added"
  }
Loading

Class Diagram for editor/uncommentselection.cpp: Logging Updates

classDiagram
  class CommentDefinition {
    +CommentDefinition() "+ logging added"
    +void setComments(QString singleLineComment, QString multiLineCommentStart, QString multiLineCommentEnd) "+ logging added"
  }
Loading

Class Diagram for common/config.cpp: Logging Updates

classDiagram
  class ConfigModule {
    <<static>> +bool detectIconvUse2005Standard() "+ logging added"
  }
  class Config {
    +Config(QObject *parent) "+ logging added"
    +~Config() "+ logging added"
    +Config *instance() "+ logging added"
  }
Loading

Class Diagram for editor/indenttextcommond.cpp: Logging Updates

classDiagram
  class IndentTextCommand {
    +IndentTextCommand(TextEdit* edit, int startpos, int endpos, int startline, int endline) "+ logging added"
    +~IndentTextCommand() "+ logging added"
    +void redo() "+ logging added"
    +void undo() "+ logging added"
  }
Loading

Class Diagram for main.cpp: Logging Updates

classDiagram
  class ApplicationMain {
    <<static>> +int main(int argc, char *argv[]) "+ logging added"
    <<static>> +lambda_DGuiApplicationHelper_sizeModeChanged() "+ logging added"
  }
Loading

Class Diagram for widgets/ColorSelectWdg.cpp: Logging Updates

classDiagram
  class ColorSelectWdg {
    +ColorSelectWdg(QString text, QWidget *parent) "+ logging added"
    +~ColorSelectWdg() "+ logging added"
    +void initWidget() "+ logging added in internal lambda"
  }
Loading

Class Diagram for editor/replaceallcommond.cpp: Logging Updates

classDiagram
  class ReplaceAllCommand {
    +ReplaceAllCommand(QString oldText, QString newText, QTextCursor cursor, QUndoCommand *parent) "+ logging added"
    +~ReplaceAllCommand() "+ logging added"
    +void redo() "+ logging added"
    +void undo() "+ logging added"
  }
Loading

Class Diagram for thememodule/themelistview.cpp: Logging Updates

classDiagram
  class ThemeListView {
    +ThemeListView(QWidget *parent) "+ logging added"
    +~ThemeListView() "+ logging added"
    +void adjustScrollbarMargins() "+ logging added"
    +bool eventFilter(QObject *obj, QEvent *event) "+ logging added"
    +void selectionChanged(QItemSelection selected, QItemSelection deselected) "+ logging added"
  }
Loading

Class Diagram for editor/endlineformatcommond.cpp: Logging Updates

classDiagram
  class EndlineFormartCommand {
    +EndlineFormartCommand(TextEdit* edit, BottomBar* bar, BottomBar::EndlineFormat from, BottomBar::EndlineFormat to) "+ logging added"
    +~EndlineFormartCommand() "+ logging added"
    +void undo() "+ logging added"
    +void redo() "+ logging added"
  }
Loading

Class Diagram for thememodule/themeitemdelegate.cpp: Logging Updates

classDiagram
  class ThemeItemDelegate {
    +ThemeItemDelegate(QObject *parent) "+ logging added"
    +~ThemeItemDelegate() "+ logging added"
    +void paint(QPainter *painter, QStyleOptionViewItem option, QModelIndex index) const "+ logging added"
    +QSize sizeHint(QStyleOptionViewItem option, QModelIndex index) const "+ logging added"
  }
Loading

Class Diagram for thememodule/themelistmodel.cpp: Logging Updates

classDiagram
  class ThemeListModel {
    +ThemeListModel(QObject *parent) "+ logging added"
    +~ThemeListModel() "+ logging added"
    +void setFrameColor(QString selectedColor, QString normalColor) "+ logging added"
    +void setSelection(QString path) "+ logging added"
    +QVariant data(QModelIndex index, int role) const "+ logging added"
    +void initThemes() "+ logging added"
  }
Loading

Class Diagram for common/dbusinterface.cpp: Logging Updates

classDiagram
  class SaveFileInterface {
    +SaveFileInterface(QString service, QString path, QDBusConnection connection, QObject *parent) "+ logging added"
    +~SaveFileInterface() "+ logging added"
  }
Loading

File-Level Changes

Change Details Files
Instrument Settings and configuration handling with logs
  • Log constructor/destructor and singleton access
  • Log option get/set, sync, keys operations
  • Log save-path and lock-file removal routines
src/common/settings.cpp
src/common/config.cpp
Add detailed logs for text editing operations
  • Log TextEdit component lifecycle (init/destroy)
  • Log text insertion, deletion, move-line, replace operations
  • Log undo/redo and search/find progress
src/editor/dtextedit.cpp
src/editor/editwrapper.cpp
Enhance file I/O and encoding detection with logging
  • Log FileLoadThread start/end and encoding decisions
  • Log TextFileSaver chunked writes and conversion steps
  • Log DetectCode detection and conversion paths
src/common/fileloadthread.cpp
src/common/text_file_saver.cpp
src/encodes/detectcode.cpp
Instrument UI controls and widgets with logs
  • Log constructors, events, actions for FindBar/ReplaceBar/JumpLineBar
  • Log Tabbar, BottomBar, LineBar interactions and state changes
  • Log theme panel, menu, dropdown, and color-widget events
src/controls/findbar.cpp
src/controls/replacebar.cpp
src/controls/jumplinebar.cpp
src/controls/tabbar.cpp
src/controls/linebar.cpp
src/widgets/*
Add logging to undo/redo commands and infrastructure
  • Log UndoList append, undo/redo progress
  • Log Delete/InsertTextUndoCommand creation and execution
  • Log Indent, ReplaceAll, ChangeMark, EndlineFormat commands
src/editor/undolist.cpp
src/editor/inserttextundocommand.cpp
src/editor/deletebackcommond.cpp
src/editor/deletetextundocommand.cpp
src/editor/indenttextcommond.cpp
src/editor/replaceallcommond.cpp
src/editor/changemarkcommand.cpp
src/editor/endlineformatcommond.cpp
Instrument application lifecycle and managers
  • Log EditorApplication startup, notify, quit actions
  • Log StartManager initialization, file recovery, open operations
  • Log PerformanceMonitor, Eventlogutils, SaveFileInterface actions
src/main.cpp
src/editorapplication.cpp
src/startmanager.cpp
src/common/performancemonitor.cpp
src/common/eventlogutils.cpp
src/common/dbusinterface.cpp
Log utility and syntax-highlighting operations
  • Log Utils path/file checks and memory sufficiency
  • Log CSyntaxHighlighter enable/highlight calls
  • Log theme list/model events and painting steps
src/common/utils.cpp
src/common/CSyntaxHighlighter.cpp
src/thememodule/*

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
Copy Markdown

@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 @re2zero - I've reviewed your changes - here's some feedback:

  • This change sprinkles qDebug calls across almost every constructor, event handler, and method—which will flood logs and could hurt performance; consider centralizing logging via Qt logging categories and guarding verbose messages behind log‐level checks so you can disable them in production builds.
  • You’re adding debug statements into very high-frequency paths (keyPressEvent, paintEvent, etc.); wrap those in conditional compilation or log-level checks to avoid runtime overhead and excessive log churn.
  • Instead of mixing qDebug and qInfo everywhere, define and use meaningful logging levels and categories (e.g. startup, file IO, UI events) so logs can be filtered and you avoid logging trivial or redundant information.
Here's what I looked at during the review
  • 🟡 General issues: 1 issue found
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

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.


CodeFlodArea::CodeFlodArea(LeftAreaTextEdit *leftAreaWidget)
{
qDebug() << "CodeFlodArea created";
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

suggestion: Constructor/destructor logs are very consistent—consider a macro

A TRACE_OBJECT macro would help reduce repetition and maintain consistent logging across widgets.

Suggested implementation:

#include <QDebug>

#define TRACE_OBJECT(CLASSNAME) \
    qDebug() << #CLASSNAME " created"; \
    struct CLASSNAME##_DestructorTracer { \
        ~CLASSNAME##_DestructorTracer() { qDebug() << #CLASSNAME " destroyed"; } \
    } CLASSNAME##_destructorTracerInstance;
CodeFlodArea::CodeFlodArea(LeftAreaTextEdit *leftAreaWidget)
{
    TRACE_OBJECT(CodeFlodArea)
    m_pLeftAreaWidget = leftAreaWidget;
}

CodeFlodArea::~CodeFlodArea()
{
    // Destructor log handled by TRACE_OBJECT macro
}

For best practices, the TRACE_OBJECT macro should be defined in a common header (e.g., trace_object.h) and included where needed. If you want to trace only construction and destruction, you may want to refine the macro or use a base class for tracing. Adjust the macro location and usage as appropriate for your codebase.

Comment thread src/common/settings.cpp Outdated
Add more logs for log coverage.

Log: Add more logs.
@github-actions
Copy link
Copy Markdown

  • 敏感词检查失败, 检测到2个文件存在敏感词
详情
{
    "src/editorapplication.cpp": [
        {
            "line": "    const QString acknowledgementLink = \"https://www.deepin.org/original/deepin-editor/\";",
            "line_number": 14,
            "rule": "S35",
            "reason": "Url link | 6859e7727a"
        }
    ],
    "src/widgets/window.cpp": [
        {
            "line": "    QString key = \"base/enable\";",
            "line_number": 376,
            "rule": "S106",
            "reason": "Var naming | 64f28539d9"
        }
    ]
}

@deepin-ci-robot
Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: lzwind, re2zero

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

@deepin-bot
Copy link
Copy Markdown
Contributor

deepin-bot Bot commented May 23, 2025

This pr cannot be merged! (status: unstable)

@re2zero
Copy link
Copy Markdown
Contributor Author

re2zero commented May 23, 2025

/forcemerge

@deepin-bot
Copy link
Copy Markdown
Contributor

deepin-bot Bot commented May 23, 2025

This pr force merged! (status: unstable)

@deepin-bot deepin-bot Bot merged commit 072c004 into linuxdeepin:master May 23, 2025
18 of 20 checks passed
@re2zero re2zero deleted the bugfix branch May 23, 2025 07:48
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