From 56346874e11185d2ef30b85a16b682d55f7b7d8a Mon Sep 17 00:00:00 2001 From: pajlada Date: Tue, 31 Oct 2023 18:24:47 +0100 Subject: [PATCH] ci: Use clang-format 16 (#4929) --- .github/workflows/check-formatting.yml | 8 ++++++-- CHANGELOG.md | 1 + README.md | 2 +- src/controllers/hotkeys/HotkeyController.cpp | 4 ++-- src/controllers/hotkeys/HotkeyController.hpp | 4 ++-- src/providers/twitch/TwitchChannel.cpp | 4 ++-- src/widgets/splits/SplitContainer.cpp | 4 ++-- 7 files changed, 16 insertions(+), 11 deletions(-) diff --git a/.github/workflows/check-formatting.yml b/.github/workflows/check-formatting.yml index 574a98d45..ca8789627 100644 --- a/.github/workflows/check-formatting.yml +++ b/.github/workflows/check-formatting.yml @@ -23,10 +23,14 @@ jobs: run: sudo apt-get update - name: Install clang-format - run: sudo apt-get -y install clang-format dos2unix + run: sudo apt-get -y install dos2unix - name: Check formatting - run: ./tools/check-format.sh + uses: DoozyX/clang-format-lint-action@v0.16.2 + with: + source: "./src ./tests/src ./benchmarks/src ./mocks/include" + extensions: "hpp,cpp" + clangFormatVersion: 16 - name: Check line-endings run: ./tools/check-line-endings.sh diff --git a/CHANGELOG.md b/CHANGELOG.md index 4b34ffec2..cbe665295 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,6 +24,7 @@ - Bugfix: Fixed the input completion popup from disappearing when clicking on it on Windows and macOS. (#4876) - Bugfix: Fixed double-click text selection moving its position with each new message. (#4898) - Bugfix: Fixed an issue where notifications on Windows would contain no or an old avatar. (#4899) +- Dev: Change clang-format from v14 to v16. (#4929) - Dev: Fixed UTF16 encoding of `modes` file for the installer. (#4791) - Dev: Temporarily disable High DPI scaling on Qt6 builds on Windows. (#4767) - Dev: Tests now run on Ubuntu 22.04 instead of 20.04 to loosen C++ restrictions in tests. (#4774) diff --git a/README.md b/README.md index b1001408b..61c28ae72 100644 --- a/README.md +++ b/README.md @@ -62,7 +62,7 @@ The code is formatted using clang format in Qt Creator. [.clang-format](src/.cla ### Get it automated with QT Creator + Beautifier + Clang Format -1. Download LLVM: https://github.com/llvm/llvm-project/releases/download/llvmorg-15.0.5/LLVM-15.0.5-win64.exe +1. Download LLVM: https://github.com/llvm/llvm-project/releases/download/llvmorg-16.0.6/LLVM-16.0.6-win64.exe 2. During the installation, make sure to add it to your path 3. In QT Creator, select `Help` > `About Plugins` > `C++` > `Beautifier` to enable the plugin 4. Restart QT Creator diff --git a/src/controllers/hotkeys/HotkeyController.cpp b/src/controllers/hotkeys/HotkeyController.cpp index 9c2297071..0fc85f97e 100644 --- a/src/controllers/hotkeys/HotkeyController.cpp +++ b/src/controllers/hotkeys/HotkeyController.cpp @@ -189,8 +189,8 @@ QString HotkeyController::categoryName(HotkeyCategory category) const return categoryData.name; } -const std::map - &HotkeyController::categories() const +const std::map & + HotkeyController::categories() const { return this->hotkeyCategories_; } diff --git a/src/controllers/hotkeys/HotkeyController.hpp b/src/controllers/hotkeys/HotkeyController.hpp index d5e74f3fb..57187ca8b 100644 --- a/src/controllers/hotkeys/HotkeyController.hpp +++ b/src/controllers/hotkeys/HotkeyController.hpp @@ -81,8 +81,8 @@ public: /** * @returns a const map with the HotkeyCategory enum as its key, and HotkeyCategoryData as the value. **/ - [[nodiscard]] const std::map - &categories() const; + [[nodiscard]] const std::map & + categories() const; pajlada::Signals::NoArgSignal onItemsUpdated; diff --git a/src/providers/twitch/TwitchChannel.cpp b/src/providers/twitch/TwitchChannel.cpp index 110cc4efa..6dc19510b 100644 --- a/src/providers/twitch/TwitchChannel.cpp +++ b/src/providers/twitch/TwitchChannel.cpp @@ -1251,8 +1251,8 @@ void TwitchChannel::addReplyThread(const std::shared_ptr &thread) this->threads_[thread->rootId()] = thread; } -const std::unordered_map> - &TwitchChannel::threads() const +const std::unordered_map> & + TwitchChannel::threads() const { return this->threads_; } diff --git a/src/widgets/splits/SplitContainer.cpp b/src/widgets/splits/SplitContainer.cpp index 43463f083..d6b08645a 100644 --- a/src/widgets/splits/SplitContainer.cpp +++ b/src/widgets/splits/SplitContainer.cpp @@ -973,8 +973,8 @@ qreal SplitContainer::Node::getVerticalFlex() const return this->flexV_; } -const std::vector> - &SplitContainer::Node::getChildren() +const std::vector> & + SplitContainer::Node::getChildren() { return this->children_; }