diff --git a/.gitignore b/.gitignore index 620f233a9..9a55427ca 100644 --- a/.gitignore +++ b/.gitignore @@ -84,6 +84,7 @@ Thumbs.db dependencies .cache .editorconfig +vim.log ### CMake ### CMakeLists.txt.user diff --git a/CHANGELOG.md b/CHANGELOG.md index be8d0ff38..9febd055e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ - Dev: Tests now run on Ubuntu 22.04 instead of 20.04 to loosen C++ restrictions in tests. (#4774) - Dev: Do a pretty major refactor of the Settings classes. List settings (e.g. highlights) are most heavily modified, and should have an extra eye kept on them. (#4775) - Dev: Remove `boost::noncopyable` use & `boost_random` dependency. (#4776) +- Dev: Fix clang-tidy `cppcoreguidelines-pro-type-member-init` warnings. (#4426) ## 2.4.5 diff --git a/src/Application.hpp b/src/Application.hpp index 1d637cda1..d926ab447 100644 --- a/src/Application.hpp +++ b/src/Application.hpp @@ -70,8 +70,8 @@ public: class Application : public IApplication { std::vector> singletons_; - int argc_; - char **argv_; + int argc_{}; + char **argv_{}; public: static Application *instance; diff --git a/src/common/DownloadManager.hpp b/src/common/DownloadManager.hpp index b1f6b6fb5..d704ea265 100644 --- a/src/common/DownloadManager.hpp +++ b/src/common/DownloadManager.hpp @@ -17,8 +17,8 @@ public: private: QNetworkAccessManager *manager_; - QNetworkReply *reply_; - QFile *file_; + QNetworkReply *reply_{}; + QFile *file_{}; private slots: void onDownloadProgress(qint64, qint64); diff --git a/src/controllers/commands/Command.hpp b/src/controllers/commands/Command.hpp index 774be6a62..08438110e 100644 --- a/src/controllers/commands/Command.hpp +++ b/src/controllers/commands/Command.hpp @@ -10,7 +10,7 @@ namespace chatterino { struct Command { QString name; QString func; - bool showInMsgContextMenu; + bool showInMsgContextMenu{}; Command() = default; explicit Command(const QString &text); diff --git a/src/messages/MessageElement.hpp b/src/messages/MessageElement.hpp index 175537bf1..c35f9616e 100644 --- a/src/messages/MessageElement.hpp +++ b/src/messages/MessageElement.hpp @@ -209,7 +209,7 @@ private: Link link_; QString tooltip_; ImagePtr thumbnail_; - ThumbnailType thumbnailType_; + ThumbnailType thumbnailType_{}; MessageElementFlags flags_; }; diff --git a/src/messages/layouts/MessageLayoutContainer.hpp b/src/messages/layouts/MessageLayoutContainer.hpp index bdbe1b486..a6daebb28 100644 --- a/src/messages/layouts/MessageLayoutContainer.hpp +++ b/src/messages/layouts/MessageLayoutContainer.hpp @@ -90,10 +90,10 @@ struct MessageLayoutContainer { private: struct Line { - int startIndex; - int endIndex; - int startCharIndex; - int endCharIndex; + int startIndex{}; + int endIndex{}; + int startCharIndex{}; + int endCharIndex{}; QRect rect; }; diff --git a/src/providers/emoji/Emojis.cpp b/src/providers/emoji/Emojis.cpp index 7872d6e68..dbf22aa36 100644 --- a/src/providers/emoji/Emojis.cpp +++ b/src/providers/emoji/Emojis.cpp @@ -27,14 +27,14 @@ namespace { const rapidjson::Value &unparsedEmoji, QString shortCode = QString()) { - std::array unicodeBytes; + std::array unicodeBytes{}; struct { bool apple; bool google; bool twitter; bool facebook; - } capabilities; + } capabilities{}; if (!shortCode.isEmpty()) { diff --git a/src/providers/seventv/SeventvEmotes.cpp b/src/providers/seventv/SeventvEmotes.cpp index 6d64cd37a..31d0724fa 100644 --- a/src/providers/seventv/SeventvEmotes.cpp +++ b/src/providers/seventv/SeventvEmotes.cpp @@ -41,7 +41,7 @@ struct CreateEmoteResult { Emote emote; EmoteId id; EmoteName name; - bool hasImages; + bool hasImages{}; }; EmotePtr cachedOrMake(Emote &&emote, const EmoteId &id) diff --git a/src/providers/twitch/TwitchChannel.hpp b/src/providers/twitch/TwitchChannel.hpp index 9d3e3e49a..2ef71de3a 100644 --- a/src/providers/twitch/TwitchChannel.hpp +++ b/src/providers/twitch/TwitchChannel.hpp @@ -328,7 +328,7 @@ private: const QString subscriptionUrl_; const QString channelUrl_; const QString popoutPlayerUrl_; - int chatterCount_; + int chatterCount_{}; UniqueAccess streamStatus_; UniqueAccess roomModes_; std::atomic_flag loadingRecentMessages_ = ATOMIC_FLAG_INIT; @@ -376,7 +376,7 @@ private: * The index of the twitch connection in * 7TV's user representation. */ - size_t seventvUserTwitchConnectionIndex_; + size_t seventvUserTwitchConnectionIndex_{}; /** * The next moment in time to signal activity in this channel to 7TV. diff --git a/src/providers/twitch/TwitchMessageBuilder.hpp b/src/providers/twitch/TwitchMessageBuilder.hpp index 0d1f34726..645dc3aaf 100644 --- a/src/providers/twitch/TwitchMessageBuilder.hpp +++ b/src/providers/twitch/TwitchMessageBuilder.hpp @@ -127,7 +127,7 @@ private: QString roomID_; bool hasBits_ = false; QString bits; - int bitsLeft; + int bitsLeft{}; bool bitsStacked = false; bool historicalMessage_ = false; std::shared_ptr thread_; diff --git a/src/providers/twitch/api/Helix.hpp b/src/providers/twitch/api/Helix.hpp index dc8593815..973c3c59a 100644 --- a/src/providers/twitch/api/Helix.hpp +++ b/src/providers/twitch/api/Helix.hpp @@ -355,7 +355,7 @@ struct HelixVip { struct HelixChatters { std::unordered_set chatters; - int total; + int total{}; QString cursor; HelixChatters() = default; diff --git a/src/widgets/AttachedWindow.hpp b/src/widgets/AttachedWindow.hpp index 630f9d4ae..6763fb412 100644 --- a/src/widgets/AttachedWindow.hpp +++ b/src/widgets/AttachedWindow.hpp @@ -46,7 +46,7 @@ protected: private: struct { Split *split; - } ui_; + } ui_{}; struct Item { void *hwnd; @@ -61,7 +61,7 @@ private: void *target_; int yOffset_; - int currentYOffset_; + int currentYOffset_{}; double x_ = -1; double pixelRatio_ = -1; int width_ = 360; diff --git a/src/widgets/dialogs/ColorPickerDialog.hpp b/src/widgets/dialogs/ColorPickerDialog.hpp index 71b44604e..2362a79ed 100644 --- a/src/widgets/dialogs/ColorPickerDialog.hpp +++ b/src/widgets/dialogs/ColorPickerDialog.hpp @@ -71,7 +71,7 @@ private: struct { QLabel *label; ColorButton *color; - } selected; + } selected{}; struct { QColorPicker *colorPicker; @@ -82,7 +82,7 @@ private: QLabel *htmlLabel; QLineEdit *htmlEdit; - } picker; + } picker{}; } ui_; enum SpinBox : size_t { RED = 0, GREEN = 1, BLUE = 2, ALPHA = 3, END }; diff --git a/src/widgets/dialogs/QualityPopup.hpp b/src/widgets/dialogs/QualityPopup.hpp index f0820218d..d4e1ad385 100644 --- a/src/widgets/dialogs/QualityPopup.hpp +++ b/src/widgets/dialogs/QualityPopup.hpp @@ -25,7 +25,7 @@ private: QVBoxLayout *vbox; QComboBox *selector; QDialogButtonBox *buttonBox; - } ui_; + } ui_{}; QString channelURL_; }; diff --git a/src/widgets/dialogs/UserInfoPopup.hpp b/src/widgets/dialogs/UserInfoPopup.hpp index 831f96da7..956668831 100644 --- a/src/widgets/dialogs/UserInfoPopup.hpp +++ b/src/widgets/dialogs/UserInfoPopup.hpp @@ -39,8 +39,8 @@ private: void updateLatestMessages(); void loadAvatar(const QUrl &url); - bool isMod_; - bool isBroadcaster_; + bool isMod_{}; + bool isBroadcaster_{}; Split *split_; diff --git a/src/widgets/helper/ChannelView.hpp b/src/widgets/helper/ChannelView.hpp index f5a7da174..f28abf408 100644 --- a/src/widgets/helper/ChannelView.hpp +++ b/src/widgets/helper/ChannelView.hpp @@ -256,8 +256,8 @@ private: void showReplyThreadPopup(const MessagePtr &message); bool canReplyToMessages() const; - QTimer *layoutCooldown_; - bool layoutQueued_; + QTimer *layoutCooldown_{}; + bool layoutQueued_{}; QTimer updateTimer_; bool updateQueued_ = false; @@ -286,7 +286,7 @@ private: Split *split_ = nullptr; Scrollbar *scrollBar_; - EffectLabel *goToBottom_; + EffectLabel *goToBottom_{}; bool showScrollBar_ = false; FilterSetPtr channelFilters_; diff --git a/src/widgets/helper/NotebookTab.hpp b/src/widgets/helper/NotebookTab.hpp index dfc5b370f..2260d1eb6 100644 --- a/src/widgets/helper/NotebookTab.hpp +++ b/src/widgets/helper/NotebookTab.hpp @@ -24,7 +24,7 @@ public: void updateSize(); - QWidget *page; + QWidget *page{}; void setCustomTitle(const QString &title); void resetCustomTitle(); diff --git a/src/widgets/helper/ScrollbarHighlight.hpp b/src/widgets/helper/ScrollbarHighlight.hpp index 420f2caa4..1005aff97 100644 --- a/src/widgets/helper/ScrollbarHighlight.hpp +++ b/src/widgets/helper/ScrollbarHighlight.hpp @@ -35,9 +35,9 @@ public: private: std::shared_ptr color_; Style style_; - bool isRedeemedHighlight_; - bool isFirstMessageHighlight_; - bool isElevatedMessageHighlight_; + bool isRedeemedHighlight_{}; + bool isFirstMessageHighlight_{}; + bool isElevatedMessageHighlight_{}; }; } // namespace chatterino diff --git a/src/widgets/helper/TitlebarButton.hpp b/src/widgets/helper/TitlebarButton.hpp index 463582370..9599fa8e1 100644 --- a/src/widgets/helper/TitlebarButton.hpp +++ b/src/widgets/helper/TitlebarButton.hpp @@ -27,7 +27,7 @@ protected: void paintEvent(QPaintEvent *) override; private: - TitleBarButtonStyle style_; + TitleBarButtonStyle style_{}; }; } // namespace chatterino diff --git a/src/widgets/settingspages/AboutPage.hpp b/src/widgets/settingspages/AboutPage.hpp index 2ffd8a1e7..72fcdba57 100644 --- a/src/widgets/settingspages/AboutPage.hpp +++ b/src/widgets/settingspages/AboutPage.hpp @@ -16,7 +16,7 @@ private: void addLicense(QFormLayout *form, const QString &name_, const QString &website, const QString &licenseLink); - QLabel *logo_; + QLabel *logo_{}; }; } // namespace chatterino diff --git a/src/widgets/settingspages/AccountsPage.hpp b/src/widgets/settingspages/AccountsPage.hpp index fd24c8422..c129acae5 100644 --- a/src/widgets/settingspages/AccountsPage.hpp +++ b/src/widgets/settingspages/AccountsPage.hpp @@ -14,9 +14,9 @@ public: AccountsPage(); private: - QPushButton *addButton_; - QPushButton *removeButton_; - AccountSwitchWidget *accountSwitchWidget_; + QPushButton *addButton_{}; + QPushButton *removeButton_{}; + AccountSwitchWidget *accountSwitchWidget_{}; }; } // namespace chatterino diff --git a/src/widgets/settingspages/SettingsPage.hpp b/src/widgets/settingspages/SettingsPage.hpp index 245f482ce..1b69e656c 100644 --- a/src/widgets/settingspages/SettingsPage.hpp +++ b/src/widgets/settingspages/SettingsPage.hpp @@ -85,7 +85,7 @@ public: } protected: - SettingsDialogTab *tab_; + SettingsDialogTab *tab_{}; pajlada::Signals::NoArgSignal onCancel_; pajlada::Signals::SignalHolder managedConnections_; }; diff --git a/src/widgets/splits/InputCompletionPopup.hpp b/src/widgets/splits/InputCompletionPopup.hpp index 2726f4e0c..4709878e4 100644 --- a/src/widgets/splits/InputCompletionPopup.hpp +++ b/src/widgets/splits/InputCompletionPopup.hpp @@ -57,7 +57,7 @@ private: struct { GenericListView *listView; - } ui_; + } ui_{}; GenericListModel model_; ActionCallback callback_; diff --git a/src/widgets/splits/SplitContainer.hpp b/src/widgets/splits/SplitContainer.hpp index 7e4d752f8..e7472af02 100644 --- a/src/widgets/splits/SplitContainer.hpp +++ b/src/widgets/splits/SplitContainer.hpp @@ -121,7 +121,7 @@ public: Type type_; Split *split_; - Node *preferedFocusTarget_; + Node *preferedFocusTarget_{}; Node *parent_; QRectF geometry_; qreal flexH_ = 1; @@ -158,7 +158,7 @@ private: { public: SplitContainer *parent; - Node *node; + Node *node{}; void setVertical(bool isVertical); ResizeHandle(SplitContainer *_parent = nullptr); @@ -173,7 +173,7 @@ private: private: void resetFlex(); - bool vertical_; + bool vertical_{}; bool isMouseDown_ = false; }; diff --git a/src/widgets/splits/SplitInput.hpp b/src/widgets/splits/SplitInput.hpp index 192795c73..fe9693b02 100644 --- a/src/widgets/splits/SplitInput.hpp +++ b/src/widgets/splits/SplitInput.hpp @@ -129,7 +129,7 @@ protected: QHBoxLayout *replyHbox; QLabel *replyLabel; EffectLabel *cancelReplyButton; - } ui_; + } ui_{}; std::shared_ptr replyThread_ = nullptr; bool enableInlineReplying_;