all: fix clang 18 lints

This commit is contained in:
outfoxxed 2024-11-24 02:27:49 -08:00
parent e957e88ccb
commit 449327b569
Signed by: outfoxxed
GPG key ID: 4C88A185FB89301E
26 changed files with 46 additions and 34 deletions

View file

@ -6,6 +6,7 @@ Checks: >
bugprone-*, bugprone-*,
-bugprone-easily-swappable-parameters, -bugprone-easily-swappable-parameters,
-bugprone-forward-declararion-namespace, -bugprone-forward-declararion-namespace,
-bugprone-forward-declararion-namespace,
concurrency-*, concurrency-*,
cppcoreguidelines-*, cppcoreguidelines-*,
-cppcoreguidelines-owning-memory, -cppcoreguidelines-owning-memory,
@ -42,6 +43,7 @@ Checks: >
-readability-else-after-return, -readability-else-after-return,
-readability-container-data-pointer, -readability-container-data-pointer,
-readability-implicit-bool-conversion, -readability-implicit-bool-conversion,
-readability-avoid-nested-conditional-operator,
tidyfox-*, tidyfox-*,
CheckOptions: CheckOptions:
performance-for-range-copy.WarnOnAllAutoCopies: true performance-for-range-copy.WarnOnAllAutoCopies: true

View file

@ -1,5 +1,5 @@
name: Build name: Build
on: [push, pull_request] on: [push, pull_request, workflow_dispatch]
jobs: jobs:
nix: nix:

View file

@ -1,5 +1,5 @@
name: Lint name: Lint
on: [push, pull_request] on: [push, pull_request, workflow_dispatch]
jobs: jobs:
lint: lint:
@ -22,4 +22,4 @@ jobs:
just build just build
- name: Run lints - name: Run lints
run: just lint 2>&1 run: just lint-ci

View file

@ -4,7 +4,10 @@ fmt:
find src -type f \( -name "*.cpp" -o -name "*.hpp" \) -print0 | xargs -0 clang-format -i find src -type f \( -name "*.cpp" -o -name "*.hpp" \) -print0 | xargs -0 clang-format -i
lint: lint:
find src -type f -name "*.cpp" -print0 | parallel -q0 --bar clang-tidy --use-color --load={{ env_var("TIDYFOX") }} find src -type f -name "*.cpp" -print0 | parallel -q0 --no-notice --will-cite --tty --bar clang-tidy --load={{ env_var("TIDYFOX") }}
lint-ci:
find src -type f -name "*.cpp" -print0 | parallel -q0 --no-notice --will-cite --tty clang-tidy --load={{ env_var("TIDYFOX") }}
configure target='debug' *FLAGS='': configure target='debug' *FLAGS='':
cmake -GNinja -B {{builddir}} \ cmake -GNinja -B {{builddir}} \

View file

@ -5,6 +5,7 @@
#include <qqmlintegration.h> #include <qqmlintegration.h>
#include <qtimer.h> #include <qtimer.h>
#include <qtmetamacros.h> #include <qtmetamacros.h>
#include <qtypes.h>
#include "util.hpp" #include "util.hpp"
@ -27,7 +28,7 @@ class SystemClock: public QObject {
public: public:
// must be named enum until docgen is ready to handle member enums better // must be named enum until docgen is ready to handle member enums better
enum Enum { enum Enum : quint8 {
Hours = 1, Hours = 1,
Minutes = 2, Minutes = 2,
Seconds = 3, Seconds = 3,

View file

@ -10,6 +10,7 @@
#include <qlogging.h> #include <qlogging.h>
#include <qloggingcategory.h> #include <qloggingcategory.h>
#include <qstringview.h> #include <qstringview.h>
#include <qtypes.h>
namespace qs::log { namespace qs::log {
Q_DECLARE_LOGGING_CATEGORY(logLogging); Q_DECLARE_LOGGING_CATEGORY(logLogging);
@ -22,7 +23,7 @@ public:
QLoggingRule(QStringView pattern, bool enabled); QLoggingRule(QStringView pattern, bool enabled);
[[nodiscard]] int pass(QLatin1StringView categoryName, QtMsgType type) const; [[nodiscard]] int pass(QLatin1StringView categoryName, QtMsgType type) const;
enum PatternFlag { enum PatternFlag : quint8 {
FullText = 0x1, FullText = 0x1,
LeftFilter = 0x2, LeftFilter = 0x2,
RightFilter = 0x4, RightFilter = 0x4,

View file

@ -1,6 +1,7 @@
#pragma once #pragma once
#include <qdatetime.h> #include <qdatetime.h>
#include <qdir.h> #include <qdir.h>
#include <qtypes.h>
#include "instanceinfo.hpp" #include "instanceinfo.hpp"
@ -31,7 +32,7 @@ public:
void createLock(); void createLock();
private: private:
enum class DirState { enum class DirState : quint8 {
Unknown = 0, Unknown = 0,
Ready = 1, Ready = 1,
Failed = 2, Failed = 2,

View file

@ -10,6 +10,7 @@
#include <qsize.h> #include <qsize.h>
#include <qtclasshelpermacros.h> #include <qtclasshelpermacros.h>
#include <qtmetamacros.h> #include <qtmetamacros.h>
#include <qtypes.h>
#include <qwindow.h> #include <qwindow.h>
#include "../window/proxywindow.hpp" #include "../window/proxywindow.hpp"
@ -26,7 +27,7 @@ namespace PopupAdjustment { // NOLINT
Q_NAMESPACE; Q_NAMESPACE;
QML_ELEMENT; QML_ELEMENT;
enum Enum { enum Enum : quint8 {
None = 0, None = 0,
/// If the X axis is constrained, the popup will slide along the X axis until it fits onscreen. /// If the X axis is constrained, the popup will slide along the X axis until it fits onscreen.
SlideX = 1, SlideX = 1,

View file

@ -20,7 +20,7 @@ class QsMenuButtonType: public QObject {
QML_SINGLETON; QML_SINGLETON;
public: public:
enum Enum { enum Enum : quint8 {
/// This menu item does not have a checkbox or a radiobutton associated with it. /// This menu item does not have a checkbox or a radiobutton associated with it.
None = 0, None = 0,
/// This menu item should draw a checkbox. /// This menu item should draw a checkbox.

View file

@ -15,7 +15,7 @@ namespace RegionShape { // NOLINT
Q_NAMESPACE; Q_NAMESPACE;
QML_ELEMENT; QML_ELEMENT;
enum Enum { enum Enum : quint8 {
Rect = 0, Rect = 0,
Ellipse = 1, Ellipse = 1,
}; };
@ -29,7 +29,7 @@ namespace Intersection { // NOLINT
Q_NAMESPACE; Q_NAMESPACE;
QML_ELEMENT; QML_ELEMENT;
enum Enum { enum Enum : quint8 {
/// Combine this region, leaving a union of this and the other region. (opposite of `Subtract`) /// Combine this region, leaving a union of this and the other region. (opposite of `Subtract`)
Combine = 0, Combine = 0,
/// Subtract this region, cutting this region out of the other. (opposite of `Combine`) /// Subtract this region, cutting this region out of the other. (opposite of `Combine`)

View file

@ -6,6 +6,7 @@
#include <qqmlintegration.h> #include <qqmlintegration.h>
#include <qrect.h> #include <qrect.h>
#include <qtmetamacros.h> #include <qtmetamacros.h>
#include <qtypes.h>
class Box { class Box {
Q_GADGET; Q_GADGET;
@ -53,7 +54,7 @@ namespace Edges { // NOLINT
Q_NAMESPACE; Q_NAMESPACE;
QML_NAMED_ELEMENT(Edges); QML_NAMED_ELEMENT(Edges);
enum Enum { enum Enum : quint8 {
None = 0, None = 0,
Top = Qt::TopEdge, Top = Qt::TopEdge,
Left = Qt::LeftEdge, Left = Qt::LeftEdge,

View file

@ -6,6 +6,7 @@
#include <qobject.h> #include <qobject.h>
#include <qqmlintegration.h> #include <qqmlintegration.h>
#include <qtmetamacros.h> #include <qtmetamacros.h>
#include <qtypes.h>
///! State of the Greetd connection. ///! State of the Greetd connection.
/// See @@Greetd.state. /// See @@Greetd.state.
@ -15,7 +16,7 @@ class GreetdState: public QObject {
QML_SINGLETON; QML_SINGLETON;
public: public:
enum Enum { enum Enum : quint8 {
Inactive = 0, Inactive = 0,
Authenticating = 1, Authenticating = 1,
ReadyToLaunch = 2, ReadyToLaunch = 2,

View file

@ -23,7 +23,7 @@ class MprisPlaybackState: public QObject {
QML_SINGLETON; QML_SINGLETON;
public: public:
enum Enum { enum Enum : quint8 {
Stopped = 0, Stopped = 0,
Playing = 1, Playing = 1,
Paused = 2, Paused = 2,
@ -41,7 +41,7 @@ class MprisLoopState: public QObject {
QML_SINGLETON; QML_SINGLETON;
public: public:
enum Enum { enum Enum : quint8 {
None = 0, None = 0,
Track = 1, Track = 1,
Playlist = 2, Playlist = 2,

View file

@ -8,6 +8,7 @@
#include <qobject.h> #include <qobject.h>
#include <qqmlintegration.h> #include <qqmlintegration.h>
#include <qtmetamacros.h> #include <qtmetamacros.h>
#include <qtypes.h>
#include "../../core/retainable.hpp" #include "../../core/retainable.hpp"
#include "../../core/util.hpp" #include "../../core/util.hpp"
@ -24,7 +25,7 @@ class NotificationUrgency: public QObject {
QML_SINGLETON; QML_SINGLETON;
public: public:
enum Enum { enum Enum : quint8 {
Low = 0, Low = 0,
Normal = 1, Normal = 1,
Critical = 2, Critical = 2,
@ -42,7 +43,7 @@ class NotificationCloseReason: public QObject {
QML_SINGLETON; QML_SINGLETON;
public: public:
enum Enum { enum Enum : quint8 {
/// The notification expired due to a timeout. /// The notification expired due to a timeout.
Expired = 1, Expired = 1,
/// The notification was explicitly dismissed by the user. /// The notification was explicitly dismissed by the user.

View file

@ -124,7 +124,7 @@ void NotificationServer::tryRegister() {
} }
void NotificationServer::onServiceUnregistered(const QString& /*unused*/) { void NotificationServer::onServiceUnregistered(const QString& /*unused*/) {
qCDebug(logNotifications) << "Active notification server unregistered, attempting registration"; qCDebug(logNotifications) << "Active notification server unregistered, attempting registration";
this->tryRegister(); NotificationServer::tryRegister();
} }
void NotificationServer::CloseNotification(uint id) { void NotificationServer::CloseNotification(uint id) {

View file

@ -63,7 +63,7 @@ signals:
// NOLINTEND // NOLINTEND
private slots: private slots:
void onServiceUnregistered(const QString& service); static void onServiceUnregistered(const QString& service);
private: private:
explicit NotificationServer(); explicit NotificationServer();

View file

@ -1,13 +1,12 @@
#pragma once #pragma once
#include <utility>
#include <qloggingcategory.h> #include <qloggingcategory.h>
#include <qobject.h> #include <qobject.h>
#include <qqmlintegration.h> #include <qqmlintegration.h>
#include <qsocketnotifier.h> #include <qsocketnotifier.h>
#include <qtclasshelpermacros.h> #include <qtclasshelpermacros.h>
#include <qtmetamacros.h> #include <qtmetamacros.h>
#include <qtypes.h>
#include "ipc.hpp" #include "ipc.hpp"
@ -21,7 +20,7 @@ class PamResult: public QObject {
QML_SINGLETON; QML_SINGLETON;
public: public:
enum Enum { enum Enum : quint8 {
/// Authentication was successful. /// Authentication was successful.
Success = 0, Success = 0,
/// Authentication failed. /// Authentication failed.
@ -44,7 +43,7 @@ class PamError: public QObject {
QML_SINGLETON; QML_SINGLETON;
public: public:
enum Enum { enum Enum : quint8 {
/// Failed to start the pam session. /// Failed to start the pam session.
StartFailed = 1, StartFailed = 1,
/// Failed to try to authenticate the user. /// Failed to try to authenticate the user.

View file

@ -1,6 +1,6 @@
#pragma once #pragma once
#include <iostream> #include <iostream> // NOLINT std::cout
#include <security/pam_appl.h> #include <security/pam_appl.h>

View file

@ -21,7 +21,7 @@ class PwLinkState: public QObject {
QML_SINGLETON; QML_SINGLETON;
public: public:
enum Enum { enum Enum : qint8 {
Error = PW_LINK_STATE_ERROR, Error = PW_LINK_STATE_ERROR,
Unlinked = PW_LINK_STATE_UNLINKED, Unlinked = PW_LINK_STATE_UNLINKED,
Init = PW_LINK_STATE_INIT, Init = PW_LINK_STATE_INIT,

View file

@ -87,7 +87,7 @@ public:
Q_INVOKABLE static QString toString(qs::service::pipewire::PwAudioChannel::Enum value); Q_INVOKABLE static QString toString(qs::service::pipewire::PwAudioChannel::Enum value);
}; };
enum class PwNodeType { enum class PwNodeType : quint8 {
Untracked, Untracked,
Audio, Audio,
}; };

View file

@ -7,6 +7,7 @@
#include <qlogging.h> #include <qlogging.h>
#include <qmetatype.h> #include <qmetatype.h>
#include <qsysinfo.h> #include <qsysinfo.h>
#include <qtversionchecks.h>
#include <qtypes.h> #include <qtypes.h>
bool DBusSniIconPixmap::operator==(const DBusSniIconPixmap& other) const { bool DBusSniIconPixmap::operator==(const DBusSniIconPixmap& other) const {

View file

@ -26,7 +26,7 @@ namespace Status { // NOLINT
Q_NAMESPACE; Q_NAMESPACE;
QML_ELEMENT; QML_ELEMENT;
enum Enum { enum Enum : quint8 {
/// A passive item does not convey important information and can be considered idle. You may want to hide these. /// A passive item does not convey important information and can be considered idle. You may want to hide these.
Passive = 0, Passive = 0,
/// An active item may have information more important than a passive one and you probably do not want to hide it. /// An active item may have information more important than a passive one and you probably do not want to hide it.
@ -43,7 +43,7 @@ namespace Category { // NOLINT
Q_NAMESPACE; Q_NAMESPACE;
QML_ELEMENT; QML_ELEMENT;
enum Enum { enum Enum : quint8 {
/// The fallback category for general applications or anything that does /// The fallback category for general applications or anything that does
/// not fit into a different category. /// not fit into a different category.
ApplicationStatus = 0, ApplicationStatus = 0,

View file

@ -20,7 +20,7 @@ class UPowerDeviceState: public QObject {
QML_SINGLETON; QML_SINGLETON;
public: public:
enum Enum { enum Enum : quint8 {
Unknown = 0, Unknown = 0,
Charging = 1, Charging = 1,
Discharging = 2, Discharging = 2,
@ -44,7 +44,7 @@ class UPowerDeviceType: public QObject {
QML_SINGLETON; QML_SINGLETON;
public: public:
enum Enum { enum Enum : quint8 {
Unknown = 0, Unknown = 0,
LinePower = 1, LinePower = 1,
Battery = 2, Battery = 2,

View file

@ -6,7 +6,6 @@
#include <qtmetamacros.h> #include <qtmetamacros.h>
#include "manager.hpp" #include "manager.hpp"
#include "shortcut.hpp"
namespace qs::hyprland::global_shortcuts { namespace qs::hyprland::global_shortcuts {
using impl::GlobalShortcutManager; using impl::GlobalShortcutManager;

View file

@ -15,7 +15,7 @@ namespace WlrLayer { // NOLINT
Q_NAMESPACE; Q_NAMESPACE;
QML_ELEMENT; QML_ELEMENT;
enum Enum { enum Enum : quint8 {
/// Below bottom /// Below bottom
Background = 0, Background = 0,
/// Above background, usually below windows /// Above background, usually below windows
@ -36,7 +36,7 @@ namespace WlrKeyboardFocus { // NOLINT
Q_NAMESPACE; Q_NAMESPACE;
QML_ELEMENT; QML_ELEMENT;
enum Enum { enum Enum : quint8 {
/// No keyboard input will be accepted. /// No keyboard input will be accepted.
None = 0, None = 0,
/// Exclusive access to the keyboard, locking out all other windows. /// Exclusive access to the keyboard, locking out all other windows.

View file

@ -2,6 +2,7 @@
#include <qqmlintegration.h> #include <qqmlintegration.h>
#include <qtmetamacros.h> #include <qtmetamacros.h>
#include <qtypes.h>
#include "../core/doc.hpp" #include "../core/doc.hpp"
#include "windowinterface.hpp" #include "windowinterface.hpp"
@ -63,7 +64,7 @@ namespace ExclusionMode { // NOLINT
Q_NAMESPACE; Q_NAMESPACE;
QML_ELEMENT; QML_ELEMENT;
enum Enum { enum Enum : quint8 {
/// Respect the exclusion zone of other shell layers and optionally set one /// Respect the exclusion zone of other shell layers and optionally set one
Normal = 0, Normal = 0,
/// Ignore exclusion zones of other shell layers. You cannot set an exclusion zone in this mode. /// Ignore exclusion zones of other shell layers. You cannot set an exclusion zone in this mode.