From 8bbeee11734d3ba8e2cf15d19cb3c302f8bfdbf2 Mon Sep 17 00:00:00 2001 From: Vaxry <43317083+vaxerski@users.noreply.github.com> Date: Sat, 7 Dec 2024 18:51:18 +0100 Subject: core: Add clang-tidy (#8664) This adds a .clang-tidy file for us. It's not a strict requirement to be compliant, but I tuned it to be alright. --- src/helpers/AnimatedVariable.cpp | 10 +++--- src/helpers/AnimatedVariable.hpp | 59 +++++++++++++++--------------- src/helpers/ByteOperations.hpp | 12 ++++--- src/helpers/Color.cpp | 19 +++------- src/helpers/Format.cpp | 24 ++++++------- src/helpers/Format.hpp | 2 +- src/helpers/MiscFunctions.cpp | 5 +-- src/helpers/Monitor.cpp | 4 +-- src/helpers/Monitor.hpp | 2 +- src/helpers/SdDaemon.cpp | 77 +++++++++++++++++++--------------------- src/helpers/SdDaemon.hpp | 6 ++-- src/helpers/TagKeeper.hpp | 8 ++--- src/helpers/Watchdog.cpp | 7 ++-- src/helpers/math/Math.hpp | 1 + src/helpers/memory/Memory.hpp | 1 + src/helpers/signal/Signal.hpp | 1 + src/helpers/varlist/VarList.hpp | 1 + 17 files changed, 115 insertions(+), 124 deletions(-) (limited to 'src/helpers') diff --git a/src/helpers/AnimatedVariable.cpp b/src/helpers/AnimatedVariable.cpp index 117cd25b..6deeff39 100644 --- a/src/helpers/AnimatedVariable.cpp +++ b/src/helpers/AnimatedVariable.cpp @@ -2,11 +2,11 @@ #include "../managers/AnimationManager.hpp" #include "../config/ConfigManager.hpp" -CBaseAnimatedVariable::CBaseAnimatedVariable(ANIMATEDVARTYPE type) : m_Type(type) { +CBaseAnimatedVariable::CBaseAnimatedVariable(eAnimatedVarType type) : m_Type(type) { ; // dummy var } -void CBaseAnimatedVariable::create(SAnimationPropertyConfig* pAnimConfig, PHLWINDOW pWindow, AVARDAMAGEPOLICY policy) { +void CBaseAnimatedVariable::create(SAnimationPropertyConfig* pAnimConfig, PHLWINDOW pWindow, eAVarDamagePolicy policy) { m_eDamagePolicy = policy; m_pConfig = pAnimConfig; m_pWindow = pWindow; @@ -14,7 +14,7 @@ void CBaseAnimatedVariable::create(SAnimationPropertyConfig* pAnimConfig, PHLWIN m_bDummy = false; } -void CBaseAnimatedVariable::create(SAnimationPropertyConfig* pAnimConfig, PHLLS pLayer, AVARDAMAGEPOLICY policy) { +void CBaseAnimatedVariable::create(SAnimationPropertyConfig* pAnimConfig, PHLLS pLayer, eAVarDamagePolicy policy) { m_eDamagePolicy = policy; m_pConfig = pAnimConfig; m_pLayer = pLayer; @@ -22,7 +22,7 @@ void CBaseAnimatedVariable::create(SAnimationPropertyConfig* pAnimConfig, PHLLS m_bDummy = false; } -void CBaseAnimatedVariable::create(SAnimationPropertyConfig* pAnimConfig, PHLWORKSPACE pWorkspace, AVARDAMAGEPOLICY policy) { +void CBaseAnimatedVariable::create(SAnimationPropertyConfig* pAnimConfig, PHLWORKSPACE pWorkspace, eAVarDamagePolicy policy) { m_eDamagePolicy = policy; m_pConfig = pAnimConfig; m_pWorkspace = pWorkspace; @@ -30,7 +30,7 @@ void CBaseAnimatedVariable::create(SAnimationPropertyConfig* pAnimConfig, PHLWOR m_bDummy = false; } -void CBaseAnimatedVariable::create(SAnimationPropertyConfig* pAnimConfig, AVARDAMAGEPOLICY policy) { +void CBaseAnimatedVariable::create(SAnimationPropertyConfig* pAnimConfig, eAVarDamagePolicy policy) { m_eDamagePolicy = policy; m_pConfig = pAnimConfig; diff --git a/src/helpers/AnimatedVariable.hpp b/src/helpers/AnimatedVariable.hpp index 7cea72a0..a2a06675 100644 --- a/src/helpers/AnimatedVariable.hpp +++ b/src/helpers/AnimatedVariable.hpp @@ -10,38 +10,39 @@ #include "../debug/Log.hpp" #include "../desktop/DesktopTypes.hpp" -enum ANIMATEDVARTYPE { +enum eAnimatedVarType : int8_t { AVARTYPE_INVALID = -1, AVARTYPE_FLOAT, AVARTYPE_VECTOR, AVARTYPE_COLOR }; -// Utility to bind a type with its corresponding ANIMATEDVARTYPE +// Utility to bind a type with its corresponding eAnimatedVarType template -struct typeToANIMATEDVARTYPE_t { - static constexpr ANIMATEDVARTYPE value = AVARTYPE_INVALID; +// NOLINTNEXTLINE(readability-identifier-naming) +struct STypeToAnimatedVarType_t { + static constexpr eAnimatedVarType value = AVARTYPE_INVALID; }; template <> -struct typeToANIMATEDVARTYPE_t { - static constexpr ANIMATEDVARTYPE value = AVARTYPE_FLOAT; +struct STypeToAnimatedVarType_t { + static constexpr eAnimatedVarType value = AVARTYPE_FLOAT; }; template <> -struct typeToANIMATEDVARTYPE_t { - static constexpr ANIMATEDVARTYPE value = AVARTYPE_VECTOR; +struct STypeToAnimatedVarType_t { + static constexpr eAnimatedVarType value = AVARTYPE_VECTOR; }; template <> -struct typeToANIMATEDVARTYPE_t { - static constexpr ANIMATEDVARTYPE value = AVARTYPE_COLOR; +struct STypeToAnimatedVarType_t { + static constexpr eAnimatedVarType value = AVARTYPE_COLOR; }; template -inline constexpr ANIMATEDVARTYPE typeToANIMATEDVARTYPE = typeToANIMATEDVARTYPE_t::value; +inline constexpr eAnimatedVarType typeToeAnimatedVarType = STypeToAnimatedVarType_t::value; -enum AVARDAMAGEPOLICY { +enum eAVarDamagePolicy : int8_t { AVARDAMAGE_NONE = -1, AVARDAMAGE_ENTIRE = 0, AVARDAMAGE_BORDER, @@ -67,11 +68,11 @@ concept Animable = OneOf; class CBaseAnimatedVariable { public: - CBaseAnimatedVariable(ANIMATEDVARTYPE type); - void create(SAnimationPropertyConfig* pAnimConfig, PHLWINDOW pWindow, AVARDAMAGEPOLICY policy); - void create(SAnimationPropertyConfig* pAnimConfig, PHLLS pLayer, AVARDAMAGEPOLICY policy); - void create(SAnimationPropertyConfig* pAnimConfig, PHLWORKSPACE pWorkspace, AVARDAMAGEPOLICY policy); - void create(SAnimationPropertyConfig* pAnimConfig, AVARDAMAGEPOLICY policy); + CBaseAnimatedVariable(eAnimatedVarType type); + void create(SAnimationPropertyConfig* pAnimConfig, PHLWINDOW pWindow, eAVarDamagePolicy policy); + void create(SAnimationPropertyConfig* pAnimConfig, PHLLS pLayer, eAVarDamagePolicy policy); + void create(SAnimationPropertyConfig* pAnimConfig, PHLWORKSPACE pWorkspace, eAVarDamagePolicy policy); + void create(SAnimationPropertyConfig* pAnimConfig, eAVarDamagePolicy policy); CBaseAnimatedVariable(const CBaseAnimatedVariable&) = delete; CBaseAnimatedVariable(CBaseAnimatedVariable&&) = delete; @@ -103,7 +104,7 @@ class CBaseAnimatedVariable { float getCurveValue(); // checks if an animation is in progress - inline bool isBeingAnimated() { + bool isBeingAnimated() const { return m_bIsBeingAnimated; } @@ -111,7 +112,7 @@ class CBaseAnimatedVariable { if an animation is not running, runs instantly. if "remove" is set to true, will remove the callback when ran. */ void setCallbackOnEnd(std::function func, bool remove = true) { - m_fEndCallback = func; + m_fEndCallback = std::move(func); m_bRemoveEndAfterRan = remove; if (!isBeingAnimated()) @@ -121,14 +122,14 @@ class CBaseAnimatedVariable { /* sets a function to be ran when an animation is started. if "remove" is set to true, will remove the callback when ran. */ void setCallbackOnBegin(std::function func, bool remove = true) { - m_fBeginCallback = func; + m_fBeginCallback = std::move(func); m_bRemoveBeginAfterRan = remove; } /* Sets the update callback, called every time the value is animated and a step is done Warning: calling unregisterVar/registerVar in this handler will cause UB */ void setUpdateCallback(std::function func) { - m_fUpdateCallback = func; + m_fUpdateCallback = std::move(func); } /* resets all callbacks. Does not call any. */ @@ -157,8 +158,8 @@ class CBaseAnimatedVariable { std::chrono::steady_clock::time_point animationBegin; - AVARDAMAGEPOLICY m_eDamagePolicy = AVARDAMAGE_NONE; - ANIMATEDVARTYPE m_Type; + eAVarDamagePolicy m_eDamagePolicy = AVARDAMAGE_NONE; + eAnimatedVarType m_Type; bool m_bRemoveEndAfterRan = true; bool m_bRemoveBeginAfterRan = true; @@ -206,24 +207,26 @@ class CBaseAnimatedVariable { template class CAnimatedVariable : public CBaseAnimatedVariable { public: - CAnimatedVariable() : CBaseAnimatedVariable(typeToANIMATEDVARTYPE) {} // dummy var + CAnimatedVariable() : CBaseAnimatedVariable(typeToeAnimatedVarType) { + ; + } // dummy var - void create(const VarType& value, SAnimationPropertyConfig* pAnimConfig, PHLWINDOW pWindow, AVARDAMAGEPOLICY policy) { + void create(const VarType& value, SAnimationPropertyConfig* pAnimConfig, PHLWINDOW pWindow, eAVarDamagePolicy policy) { create(pAnimConfig, pWindow, policy); m_Value = value; m_Goal = value; } - void create(const VarType& value, SAnimationPropertyConfig* pAnimConfig, PHLLS pLayer, AVARDAMAGEPOLICY policy) { + void create(const VarType& value, SAnimationPropertyConfig* pAnimConfig, PHLLS pLayer, eAVarDamagePolicy policy) { create(pAnimConfig, pLayer, policy); m_Value = value; m_Goal = value; } - void create(const VarType& value, SAnimationPropertyConfig* pAnimConfig, PHLWORKSPACE pWorkspace, AVARDAMAGEPOLICY policy) { + void create(const VarType& value, SAnimationPropertyConfig* pAnimConfig, PHLWORKSPACE pWorkspace, eAVarDamagePolicy policy) { create(pAnimConfig, pWorkspace, policy); m_Value = value; m_Goal = value; } - void create(const VarType& value, SAnimationPropertyConfig* pAnimConfig, AVARDAMAGEPOLICY policy) { + void create(const VarType& value, SAnimationPropertyConfig* pAnimConfig, eAVarDamagePolicy policy) { create(pAnimConfig, policy); m_Value = value; m_Goal = value; diff --git a/src/helpers/ByteOperations.hpp b/src/helpers/ByteOperations.hpp index 13e98500..bdd429dc 100644 --- a/src/helpers/ByteOperations.hpp +++ b/src/helpers/ByteOperations.hpp @@ -30,25 +30,27 @@ constexpr LD operator""_TB(const LD BYTES) { return BYTES * 1024 * 1024 * 1024 * 1024; } +//NOLINTBEGIN template -using __acceptable_byte_operation_type = typename std::enable_if::value || std::is_trivially_constructible::value>::type; +using internal_hl_acceptable_byte_operation_type = typename std::enable_if::value || std::is_trivially_constructible::value>::type; -template > +template > constexpr X kBtoBytes(const X kB) { return kB * 1024; } -template > +template > constexpr X MBtoBytes(const X MB) { return MB * 1024 * 1024; } -template > +template > constexpr X GBtoBytes(const X GB) { return GB * 1024 * 1024 * 1024; } -template > +template > constexpr X TBtoBytes(const X TB) { return TB * 1024 * 1024 * 1024 * 1024; } +//NOLINTEND #undef ULL #undef LD \ No newline at end of file diff --git a/src/helpers/Color.cpp b/src/helpers/Color.cpp index fe217c0f..7952ef55 100644 --- a/src/helpers/Color.cpp +++ b/src/helpers/Color.cpp @@ -5,32 +5,21 @@ #define GREEN(c) ((double)(((c) >> 8) & 0xff) / 255.0) #define BLUE(c) ((double)(((c)) & 0xff) / 255.0) -CHyprColor::CHyprColor() {} - -CHyprColor::CHyprColor(float r_, float g_, float b_, float a_) { - r = r_; - g = g_; - b = b_; - a = a_; +CHyprColor::CHyprColor() = default; +CHyprColor::CHyprColor(float r_, float g_, float b_, float a_) : r(r_), g(g_), b(b_), a(a_) { okLab = Hyprgraphics::CColor(Hyprgraphics::CColor::SSRGB{r, g, b}).asOkLab(); } -CHyprColor::CHyprColor(uint64_t hex) { - r = RED(hex); - g = GREEN(hex); - b = BLUE(hex); - a = ALPHA(hex); - +CHyprColor::CHyprColor(uint64_t hex) : r(RED(hex)), g(GREEN(hex)), b(BLUE(hex)), a(ALPHA(hex)) { okLab = Hyprgraphics::CColor(Hyprgraphics::CColor::SSRGB{r, g, b}).asOkLab(); } -CHyprColor::CHyprColor(const Hyprgraphics::CColor& color, float a_) { +CHyprColor::CHyprColor(const Hyprgraphics::CColor& color, float a_) : a(a_) { const auto SRGB = color.asRgb(); r = SRGB.r; g = SRGB.g; b = SRGB.b; - a = a_; okLab = color.asOkLab(); } diff --git a/src/helpers/Format.cpp b/src/helpers/Format.cpp index bc54b76e..6679e869 100644 --- a/src/helpers/Format.cpp +++ b/src/helpers/Format.cpp @@ -231,7 +231,7 @@ inline const std::vector GLES3_FORMATS = { }, }; -SHMFormat FormatUtils::drmToShm(DRMFormat drm) { +SHMFormat NFormatUtils::drmToShm(DRMFormat drm) { switch (drm) { case DRM_FORMAT_XRGB8888: return WL_SHM_FORMAT_XRGB8888; case DRM_FORMAT_ARGB8888: return WL_SHM_FORMAT_ARGB8888; @@ -241,7 +241,7 @@ SHMFormat FormatUtils::drmToShm(DRMFormat drm) { return drm; } -DRMFormat FormatUtils::shmToDRM(SHMFormat shm) { +DRMFormat NFormatUtils::shmToDRM(SHMFormat shm) { switch (shm) { case WL_SHM_FORMAT_XRGB8888: return DRM_FORMAT_XRGB8888; case WL_SHM_FORMAT_ARGB8888: return DRM_FORMAT_ARGB8888; @@ -251,7 +251,7 @@ DRMFormat FormatUtils::shmToDRM(SHMFormat shm) { return shm; } -const SPixelFormat* FormatUtils::getPixelFormatFromDRM(DRMFormat drm) { +const SPixelFormat* NFormatUtils::getPixelFormatFromDRM(DRMFormat drm) { for (auto const& fmt : GLES3_FORMATS) { if (fmt.drmFormat == drm) return &fmt; @@ -260,7 +260,7 @@ const SPixelFormat* FormatUtils::getPixelFormatFromDRM(DRMFormat drm) { return nullptr; } -const SPixelFormat* FormatUtils::getPixelFormatFromGL(uint32_t glFormat, uint32_t glType, bool alpha) { +const SPixelFormat* NFormatUtils::getPixelFormatFromGL(uint32_t glFormat, uint32_t glType, bool alpha) { for (auto const& fmt : GLES3_FORMATS) { if (fmt.glFormat == (int)glFormat && fmt.glType == (int)glType && fmt.withAlpha == alpha) return &fmt; @@ -269,23 +269,23 @@ const SPixelFormat* FormatUtils::getPixelFormatFromGL(uint32_t glFormat, uint32_ return nullptr; } -bool FormatUtils::isFormatOpaque(DRMFormat drm) { - const auto FMT = FormatUtils::getPixelFormatFromDRM(drm); +bool NFormatUtils::isFormatOpaque(DRMFormat drm) { + const auto FMT = NFormatUtils::getPixelFormatFromDRM(drm); if (!FMT) return false; return !FMT->withAlpha; } -int FormatUtils::pixelsPerBlock(const SPixelFormat* const fmt) { +int NFormatUtils::pixelsPerBlock(const SPixelFormat* const fmt) { return fmt->blockSize.x * fmt->blockSize.y > 0 ? fmt->blockSize.x * fmt->blockSize.y : 1; } -int FormatUtils::minStride(const SPixelFormat* const fmt, int32_t width) { +int NFormatUtils::minStride(const SPixelFormat* const fmt, int32_t width) { return std::ceil((width * fmt->bytesPerBlock) / pixelsPerBlock(fmt)); } -uint32_t FormatUtils::drmFormatToGL(DRMFormat drm) { +uint32_t NFormatUtils::drmFormatToGL(DRMFormat drm) { switch (drm) { case DRM_FORMAT_XRGB8888: case DRM_FORMAT_XBGR8888: return GL_RGBA; // doesn't matter, opengl is gucci in this case. @@ -302,7 +302,7 @@ uint32_t FormatUtils::drmFormatToGL(DRMFormat drm) { return GL_RGBA; } -uint32_t FormatUtils::glFormatToType(uint32_t gl) { +uint32_t NFormatUtils::glFormatToType(uint32_t gl) { return gl != GL_RGBA ? #ifdef GLES2 GL_UNSIGNED_INT_2_10_10_10_REV_EXT : @@ -312,14 +312,14 @@ uint32_t FormatUtils::glFormatToType(uint32_t gl) { GL_UNSIGNED_BYTE; } -std::string FormatUtils::drmFormatName(DRMFormat drm) { +std::string NFormatUtils::drmFormatName(DRMFormat drm) { auto n = drmGetFormatName(drm); std::string name = n; free(n); return name; } -std::string FormatUtils::drmModifierName(uint64_t mod) { +std::string NFormatUtils::drmModifierName(uint64_t mod) { auto n = drmGetFormatModifierName(mod); std::string name = n; free(n); diff --git a/src/helpers/Format.hpp b/src/helpers/Format.hpp index 8269c5c3..b1353dc7 100644 --- a/src/helpers/Format.hpp +++ b/src/helpers/Format.hpp @@ -22,7 +22,7 @@ struct SPixelFormat { typedef Aquamarine::SDRMFormat SDRMFormat; -namespace FormatUtils { +namespace NFormatUtils { SHMFormat drmToShm(DRMFormat drm); DRMFormat shmToDRM(SHMFormat shm); diff --git a/src/helpers/MiscFunctions.cpp b/src/helpers/MiscFunctions.cpp index 2da90eb7..9b92c63d 100644 --- a/src/helpers/MiscFunctions.cpp +++ b/src/helpers/MiscFunctions.cpp @@ -953,10 +953,7 @@ bool executableExistsInPath(const std::string& exe) { auto perms = stat.permissions(); - if (std::filesystem::perms::none == (perms & std::filesystem::perms::others_exec)) - return false; - - return true; + return std::filesystem::perms::none != (perms & std::filesystem::perms::others_exec); } return false; diff --git a/src/helpers/Monitor.cpp b/src/helpers/Monitor.cpp index cbad959e..4d503fe9 100644 --- a/src/helpers/Monitor.cpp +++ b/src/helpers/Monitor.cpp @@ -1010,8 +1010,8 @@ void CMonitor::onMonitorFrame() { g_pHyprRenderer->renderMonitor(self.lock()); } -CMonitorState::CMonitorState(CMonitor* owner) { - m_pOwner = owner; +CMonitorState::CMonitorState(CMonitor* owner) : m_pOwner(owner) { + ; } CMonitorState::~CMonitorState() { diff --git a/src/helpers/Monitor.hpp b/src/helpers/Monitor.hpp index dce44b4a..c8ef3c7b 100644 --- a/src/helpers/Monitor.hpp +++ b/src/helpers/Monitor.hpp @@ -16,7 +16,7 @@ #include // Enum for the different types of auto directions, e.g. auto-left, auto-up. -enum eAutoDirs { +enum eAutoDirs : uint8_t { DIR_AUTO_NONE = 0, /* None will be treated as right. */ DIR_AUTO_UP, DIR_AUTO_DOWN, diff --git a/src/helpers/SdDaemon.cpp b/src/helpers/SdDaemon.cpp index 80944794..018165c0 100644 --- a/src/helpers/SdDaemon.cpp +++ b/src/helpers/SdDaemon.cpp @@ -4,59 +4,56 @@ #include #include -#include +#include #include #include -#include -#include +#include #include -namespace Systemd { - int SdBooted(void) { - if (!faccessat(AT_FDCWD, "/run/systemd/system/", F_OK, AT_SYMLINK_NOFOLLOW)) - return true; +int NSystemd::sdBooted() { + if (!faccessat(AT_FDCWD, "/run/systemd/system/", F_OK, AT_SYMLINK_NOFOLLOW)) + return true; - if (errno == ENOENT) - return false; + if (errno == ENOENT) + return false; - return -errno; - } + return -errno; +} - int SdNotify(int unsetEnvironment, const char* state) { - int fd = socket(AF_UNIX, SOCK_DGRAM | SOCK_CLOEXEC, 0); - if (fd < 0) - return -errno; +int NSystemd::sdNotify(int unsetEnvironment, const char* state) { + int fd = socket(AF_UNIX, SOCK_DGRAM | SOCK_CLOEXEC, 0); + if (fd < 0) + return -errno; - constexpr char envVar[] = "NOTIFY_SOCKET"; + constexpr char envVar[] = "NOTIFY_SOCKET"; - auto cleanup = [unsetEnvironment, envVar](int* fd) { - if (unsetEnvironment) - unsetenv(envVar); - close(*fd); - }; - std::unique_ptr fdCleaup(&fd, cleanup); + auto cleanup = [unsetEnvironment, envVar](const int* fd) { + if (unsetEnvironment) + unsetenv(envVar); + close(*fd); + }; + std::unique_ptr fdCleaup(&fd, cleanup); - const char* addr = getenv(envVar); - if (!addr) - return 0; + const char* addr = getenv(envVar); + if (!addr) + return 0; - // address length must be at most this; see man 7 unix - size_t addrLen = strnlen(addr, 107); + // address length must be at most this; see man 7 unix + size_t addrLen = strnlen(addr, 107); - struct sockaddr_un unixAddr; - unixAddr.sun_family = AF_UNIX; - strncpy(unixAddr.sun_path, addr, addrLen); - if (unixAddr.sun_path[0] == '@') - unixAddr.sun_path[0] = '\0'; + struct sockaddr_un unixAddr; + unixAddr.sun_family = AF_UNIX; + strncpy(unixAddr.sun_path, addr, addrLen); + if (unixAddr.sun_path[0] == '@') + unixAddr.sun_path[0] = '\0'; - if (connect(fd, (const sockaddr*)&unixAddr, sizeof(struct sockaddr_un)) < 0) - return -errno; + if (connect(fd, (const sockaddr*)&unixAddr, sizeof(struct sockaddr_un)) < 0) + return -errno; - // arbitrary value which seems to be enough for s-d messages - ssize_t stateLen = strnlen(state, 128); - if (write(fd, state, stateLen) == stateLen) - return 1; + // arbitrary value which seems to be enough for s-d messages + ssize_t stateLen = strnlen(state, 128); + if (write(fd, state, stateLen) == stateLen) + return 1; - return -errno; - } + return -errno; } diff --git a/src/helpers/SdDaemon.hpp b/src/helpers/SdDaemon.hpp index 7b2b5de1..d08c6a27 100644 --- a/src/helpers/SdDaemon.hpp +++ b/src/helpers/SdDaemon.hpp @@ -1,6 +1,6 @@ #pragma once -namespace Systemd { - int SdBooted(void); - int SdNotify(int unset_environment, const char* state); +namespace NSystemd { + int sdBooted(void); + int sdNotify(int unset_environment, const char* state); } diff --git a/src/helpers/TagKeeper.hpp b/src/helpers/TagKeeper.hpp index deeabf48..f4732005 100644 --- a/src/helpers/TagKeeper.hpp +++ b/src/helpers/TagKeeper.hpp @@ -5,11 +5,11 @@ class CTagKeeper { public: - bool isTagged(const std::string& tag, bool strict = false); - bool applyTag(const std::string& tag, bool dynamic = false); - bool removeDynamicTags(); + bool isTagged(const std::string& tag, bool strict = false); + bool applyTag(const std::string& tag, bool dynamic = false); + bool removeDynamicTags(); - inline const auto& getTags() { + const auto& getTags() const { return m_tags; }; diff --git a/src/helpers/Watchdog.cpp b/src/helpers/Watchdog.cpp index c7ff648b..b919bbc7 100644 --- a/src/helpers/Watchdog.cpp +++ b/src/helpers/Watchdog.cpp @@ -1,5 +1,5 @@ #include "Watchdog.hpp" -#include +#include #include "config/ConfigManager.hpp" #include "../config/ConfigValue.hpp" @@ -12,8 +12,7 @@ CWatchdog::~CWatchdog() { m_pWatchdog->join(); } -CWatchdog::CWatchdog() { - m_iMainThreadPID = pthread_self(); +CWatchdog::CWatchdog() : m_iMainThreadPID(pthread_self()) { m_pWatchdog = std::make_unique([this] { static auto PTIMEOUT = CConfigValue("debug:watchdog_timeout"); @@ -24,7 +23,7 @@ CWatchdog::CWatchdog() { if (!m_bWillWatch) m_cvWatchdogCondition.wait(lk, [this] { return m_bNotified || m_bExitThread; }); - else if (m_cvWatchdogCondition.wait_for(lk, std::chrono::milliseconds((int)(*PTIMEOUT * 1000.0)), [this] { return m_bNotified || m_bExitThread; }) == false) + else if (!m_cvWatchdogCondition.wait_for(lk, std::chrono::milliseconds((int)(*PTIMEOUT * 1000.0)), [this] { return m_bNotified || m_bExitThread; })) pthread_kill(m_iMainThreadPID, SIGUSR1); if (m_bExitThread) diff --git a/src/helpers/math/Math.hpp b/src/helpers/math/Math.hpp index 9b73a20f..367d8190 100644 --- a/src/helpers/math/Math.hpp +++ b/src/helpers/math/Math.hpp @@ -6,6 +6,7 @@ #include #include +// NOLINTNEXTLINE using namespace Hyprutils::Math; eTransform wlTransformToHyprutils(wl_output_transform t); diff --git a/src/helpers/memory/Memory.hpp b/src/helpers/memory/Memory.hpp index 135a84af..07f41154 100644 --- a/src/helpers/memory/Memory.hpp +++ b/src/helpers/memory/Memory.hpp @@ -2,6 +2,7 @@ #include +//NOLINTNEXTLINE using namespace Hyprutils::Memory; #define SP Hyprutils::Memory::CSharedPointer diff --git a/src/helpers/signal/Signal.hpp b/src/helpers/signal/Signal.hpp index 9eea3671..76117def 100644 --- a/src/helpers/signal/Signal.hpp +++ b/src/helpers/signal/Signal.hpp @@ -2,4 +2,5 @@ #include +//NOLINTNEXTLINE using namespace Hyprutils::Signal; diff --git a/src/helpers/varlist/VarList.hpp b/src/helpers/varlist/VarList.hpp index 34629e4c..4cdc1728 100644 --- a/src/helpers/varlist/VarList.hpp +++ b/src/helpers/varlist/VarList.hpp @@ -2,4 +2,5 @@ #include +//NOLINTNEXTLINE using namespace Hyprutils::String; -- cgit v1.2.3