Skip to content

Commit 2571766

Browse files
committed
all: fix clang 18 lints
1 parent e957e88 commit 2571766

27 files changed

+47
-35
lines changed

Diff for: .clang-tidy

+2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ Checks: >
66
bugprone-*,
77
-bugprone-easily-swappable-parameters,
88
-bugprone-forward-declararion-namespace,
9+
-bugprone-forward-declararion-namespace,
910
concurrency-*,
1011
cppcoreguidelines-*,
1112
-cppcoreguidelines-owning-memory,
@@ -42,6 +43,7 @@ Checks: >
4243
-readability-else-after-return,
4344
-readability-container-data-pointer,
4445
-readability-implicit-bool-conversion,
46+
-readability-avoid-nested-conditional-operator,
4547
tidyfox-*,
4648
CheckOptions:
4749
performance-for-range-copy.WarnOnAllAutoCopies: true

Diff for: .github/workflows/build.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: Build
2-
on: [push, pull_request]
2+
on: [push, pull_request, workflow_dispatch]
33

44
jobs:
55
nix:

Diff for: .github/workflows/lint.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: Lint
2-
on: [push, pull_request]
2+
on: [push, pull_request, workflow_dispatch]
33

44
jobs:
55
lint:
@@ -22,4 +22,4 @@ jobs:
2222
just build
2323
2424
- name: Run lints
25-
run: just lint 2>&1
25+
run: just lint-ci

Diff for: Justfile

+4-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,10 @@ fmt:
44
find src -type f \( -name "*.cpp" -o -name "*.hpp" \) -print0 | xargs -0 clang-format -i
55

66
lint:
7-
find src -type f -name "*.cpp" -print0 | parallel -q0 --bar clang-tidy --use-color --load={{ env_var("TIDYFOX") }}
7+
find src -type f -name "*.cpp" -print0 | parallel -q0 --no-notice --will-cite --tty --bar clang-tidy --load={{ env_var("TIDYFOX") }}
8+
9+
lint-ci:
10+
find src -type f -name "*.cpp" -print0 | parallel -q0 --no-notice --will-cite --tty clang-tidy --load={{ env_var("TIDYFOX") }}
811

912
configure target='debug' *FLAGS='':
1013
cmake -GNinja -B {{builddir}} \

Diff for: src/core/clock.hpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
#include <qqmlintegration.h>
66
#include <qtimer.h>
77
#include <qtmetamacros.h>
8+
#include <qtypes.h>
89

910
#include "util.hpp"
1011

@@ -27,7 +28,7 @@ class SystemClock: public QObject {
2728

2829
public:
2930
// must be named enum until docgen is ready to handle member enums better
30-
enum Enum {
31+
enum Enum : quint8 {
3132
Hours = 1,
3233
Minutes = 2,
3334
Seconds = 3,

Diff for: src/core/logging_qtprivate.hpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#include <qlogging.h>
1111
#include <qloggingcategory.h>
1212
#include <qstringview.h>
13+
#include <qtypes.h>
1314

1415
namespace qs::log {
1516
Q_DECLARE_LOGGING_CATEGORY(logLogging);
@@ -22,7 +23,7 @@ class QLoggingRule {
2223
QLoggingRule(QStringView pattern, bool enabled);
2324
[[nodiscard]] int pass(QLatin1StringView categoryName, QtMsgType type) const;
2425

25-
enum PatternFlag {
26+
enum PatternFlag : quint8 {
2627
FullText = 0x1,
2728
LeftFilter = 0x2,
2829
RightFilter = 0x4,

Diff for: src/core/paths.hpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#pragma once
22
#include <qdatetime.h>
33
#include <qdir.h>
4+
#include <qtypes.h>
45

56
#include "instanceinfo.hpp"
67

@@ -31,7 +32,7 @@ class QsPaths {
3132
void createLock();
3233

3334
private:
34-
enum class DirState {
35+
enum class DirState : quint8 {
3536
Unknown = 0,
3637
Ready = 1,
3738
Failed = 2,

Diff for: src/core/popupanchor.hpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#include <qsize.h>
1111
#include <qtclasshelpermacros.h>
1212
#include <qtmetamacros.h>
13+
#include <qtypes.h>
1314
#include <qwindow.h>
1415

1516
#include "../window/proxywindow.hpp"
@@ -26,7 +27,7 @@ namespace PopupAdjustment { // NOLINT
2627
Q_NAMESPACE;
2728
QML_ELEMENT;
2829

29-
enum Enum {
30+
enum Enum : quint8 {
3031
None = 0,
3132
/// If the X axis is constrained, the popup will slide along the X axis until it fits onscreen.
3233
SlideX = 1,

Diff for: src/core/qsmenu.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class QsMenuButtonType: public QObject {
2020
QML_SINGLETON;
2121

2222
public:
23-
enum Enum {
23+
enum Enum : quint8 {
2424
/// This menu item does not have a checkbox or a radiobutton associated with it.
2525
None = 0,
2626
/// This menu item should draw a checkbox.

Diff for: src/core/region.hpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ namespace RegionShape { // NOLINT
1515
Q_NAMESPACE;
1616
QML_ELEMENT;
1717

18-
enum Enum {
18+
enum Enum : quint8 {
1919
Rect = 0,
2020
Ellipse = 1,
2121
};
@@ -29,7 +29,7 @@ namespace Intersection { // NOLINT
2929
Q_NAMESPACE;
3030
QML_ELEMENT;
3131

32-
enum Enum {
32+
enum Enum : quint8 {
3333
/// Combine this region, leaving a union of this and the other region. (opposite of `Subtract`)
3434
Combine = 0,
3535
/// Subtract this region, cutting this region out of the other. (opposite of `Combine`)

Diff for: src/core/types.hpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
#include <qqmlintegration.h>
77
#include <qrect.h>
88
#include <qtmetamacros.h>
9+
#include <qtypes.h>
910

1011
class Box {
1112
Q_GADGET;
@@ -53,7 +54,7 @@ namespace Edges { // NOLINT
5354
Q_NAMESPACE;
5455
QML_NAMED_ELEMENT(Edges);
5556

56-
enum Enum {
57+
enum Enum : quint8 {
5758
None = 0,
5859
Top = Qt::TopEdge,
5960
Left = Qt::LeftEdge,

Diff for: src/services/greetd/connection.hpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
#include <qobject.h>
77
#include <qqmlintegration.h>
88
#include <qtmetamacros.h>
9+
#include <qtypes.h>
910

1011
///! State of the Greetd connection.
1112
/// See @@Greetd.state.
@@ -15,7 +16,7 @@ class GreetdState: public QObject {
1516
QML_SINGLETON;
1617

1718
public:
18-
enum Enum {
19+
enum Enum : quint8 {
1920
Inactive = 0,
2021
Authenticating = 1,
2122
ReadyToLaunch = 2,

Diff for: src/services/mpris/player.hpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class MprisPlaybackState: public QObject {
2323
QML_SINGLETON;
2424

2525
public:
26-
enum Enum {
26+
enum Enum : quint8 {
2727
Stopped = 0,
2828
Playing = 1,
2929
Paused = 2,
@@ -41,7 +41,7 @@ class MprisLoopState: public QObject {
4141
QML_SINGLETON;
4242

4343
public:
44-
enum Enum {
44+
enum Enum : quint8 {
4545
None = 0,
4646
Track = 1,
4747
Playlist = 2,

Diff for: src/services/notifications/notification.hpp

+3-2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
#include <qobject.h>
99
#include <qqmlintegration.h>
1010
#include <qtmetamacros.h>
11+
#include <qtypes.h>
1112

1213
#include "../../core/retainable.hpp"
1314
#include "../../core/util.hpp"
@@ -24,7 +25,7 @@ class NotificationUrgency: public QObject {
2425
QML_SINGLETON;
2526

2627
public:
27-
enum Enum {
28+
enum Enum : quint8 {
2829
Low = 0,
2930
Normal = 1,
3031
Critical = 2,
@@ -42,7 +43,7 @@ class NotificationCloseReason: public QObject {
4243
QML_SINGLETON;
4344

4445
public:
45-
enum Enum {
46+
enum Enum : quint8 {
4647
/// The notification expired due to a timeout.
4748
Expired = 1,
4849
/// The notification was explicitly dismissed by the user.

Diff for: src/services/notifications/server.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ void NotificationServer::tryRegister() {
124124
}
125125
void NotificationServer::onServiceUnregistered(const QString& /*unused*/) {
126126
qCDebug(logNotifications) << "Active notification server unregistered, attempting registration";
127-
this->tryRegister();
127+
NotificationServer::tryRegister();
128128
}
129129

130130
void NotificationServer::CloseNotification(uint id) {

Diff for: src/services/notifications/server.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ class NotificationServer: public QObject {
6363
// NOLINTEND
6464

6565
private slots:
66-
void onServiceUnregistered(const QString& service);
66+
static void onServiceUnregistered(const QString& service);
6767

6868
private:
6969
explicit NotificationServer();

Diff for: src/services/pam/conversation.hpp

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
#pragma once
22

3-
#include <utility>
4-
53
#include <qloggingcategory.h>
64
#include <qobject.h>
75
#include <qqmlintegration.h>
86
#include <qsocketnotifier.h>
97
#include <qtclasshelpermacros.h>
108
#include <qtmetamacros.h>
9+
#include <qtypes.h>
1110

1211
#include "ipc.hpp"
1312

@@ -21,7 +20,7 @@ class PamResult: public QObject {
2120
QML_SINGLETON;
2221

2322
public:
24-
enum Enum {
23+
enum Enum : quint8 {
2524
/// Authentication was successful.
2625
Success = 0,
2726
/// Authentication failed.
@@ -44,7 +43,7 @@ class PamError: public QObject {
4443
QML_SINGLETON;
4544

4645
public:
47-
enum Enum {
46+
enum Enum : quint8 {
4847
/// Failed to start the pam session.
4948
StartFailed = 1,
5049
/// Failed to try to authenticate the user.

Diff for: src/services/pam/subprocess.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#pragma once
22

3-
#include <iostream>
3+
#include <iostream> // NOLINT std::cout
44

55
#include <security/pam_appl.h>
66

Diff for: src/services/pipewire/link.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class PwLinkState: public QObject {
2121
QML_SINGLETON;
2222

2323
public:
24-
enum Enum {
24+
enum Enum : qint8 {
2525
Error = PW_LINK_STATE_ERROR,
2626
Unlinked = PW_LINK_STATE_UNLINKED,
2727
Init = PW_LINK_STATE_INIT,

Diff for: src/services/pipewire/node.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ class PwAudioChannel: public QObject {
8787
Q_INVOKABLE static QString toString(qs::service::pipewire::PwAudioChannel::Enum value);
8888
};
8989

90-
enum class PwNodeType {
90+
enum class PwNodeType : quint8 {
9191
Untracked,
9292
Audio,
9393
};

Diff for: src/services/status_notifier/dbus_item_types.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#include <qlogging.h>
88
#include <qmetatype.h>
99
#include <qsysinfo.h>
10+
#include <qtversionchecks.h>
1011
#include <qtypes.h>
1112

1213
bool DBusSniIconPixmap::operator==(const DBusSniIconPixmap& other) const {

Diff for: src/services/status_notifier/item.hpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ namespace Status { // NOLINT
2626
Q_NAMESPACE;
2727
QML_ELEMENT;
2828

29-
enum Enum {
29+
enum Enum : quint8 {
3030
/// A passive item does not convey important information and can be considered idle. You may want to hide these.
3131
Passive = 0,
3232
/// 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
4343
Q_NAMESPACE;
4444
QML_ELEMENT;
4545

46-
enum Enum {
46+
enum Enum : quint8 {
4747
/// The fallback category for general applications or anything that does
4848
/// not fit into a different category.
4949
ApplicationStatus = 0,

Diff for: src/services/upower/device.hpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class UPowerDeviceState: public QObject {
2020
QML_SINGLETON;
2121

2222
public:
23-
enum Enum {
23+
enum Enum : quint8 {
2424
Unknown = 0,
2525
Charging = 1,
2626
Discharging = 2,
@@ -44,7 +44,7 @@ class UPowerDeviceType: public QObject {
4444
QML_SINGLETON;
4545

4646
public:
47-
enum Enum {
47+
enum Enum : quint8 {
4848
Unknown = 0,
4949
LinePower = 1,
5050
Battery = 2,

Diff for: src/wayland/hyprland/global_shortcuts/qml.cpp

-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
#include <qtmetamacros.h>
77

88
#include "manager.hpp"
9-
#include "shortcut.hpp"
109

1110
namespace qs::hyprland::global_shortcuts {
1211
using impl::GlobalShortcutManager;

Diff for: src/wayland/wlr_layershell/window.hpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ namespace WlrLayer { // NOLINT
1515
Q_NAMESPACE;
1616
QML_ELEMENT;
1717

18-
enum Enum {
18+
enum Enum : quint8 {
1919
/// Below bottom
2020
Background = 0,
2121
/// Above background, usually below windows
@@ -36,7 +36,7 @@ namespace WlrKeyboardFocus { // NOLINT
3636
Q_NAMESPACE;
3737
QML_ELEMENT;
3838

39-
enum Enum {
39+
enum Enum : quint8 {
4040
/// No keyboard input will be accepted.
4141
None = 0,
4242
/// Exclusive access to the keyboard, locking out all other windows.

Diff for: src/widgets/wrapper.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ void WrapperManager::componentComplete() {
3333
if (childItems.length() == 1) {
3434
this->mDefaultChild = childItems.first();
3535
if (!child) child = this->mDefaultChild;
36-
} else if (childItems.length() != 0) {
36+
} else if (!childItems.empty()) {
3737
this->flags.setFlag(WrapperManager::HasMultipleChildren);
3838

3939
if (!child && !this->flags.testFlags(WrapperManager::NullChild)) {

Diff for: src/window/panelinterface.hpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
#include <qqmlintegration.h>
44
#include <qtmetamacros.h>
5+
#include <qtypes.h>
56

67
#include "../core/doc.hpp"
78
#include "windowinterface.hpp"
@@ -63,7 +64,7 @@ namespace ExclusionMode { // NOLINT
6364
Q_NAMESPACE;
6465
QML_ELEMENT;
6566

66-
enum Enum {
67+
enum Enum : quint8 {
6768
/// Respect the exclusion zone of other shell layers and optionally set one
6869
Normal = 0,
6970
/// Ignore exclusion zones of other shell layers. You cannot set an exclusion zone in this mode.

0 commit comments

Comments
 (0)