Skip to content

Commit

Permalink
all: fix clang 18 lints
Browse files Browse the repository at this point in the history
  • Loading branch information
outfoxxed committed Nov 24, 2024
1 parent e957e88 commit c5319e3
Show file tree
Hide file tree
Showing 25 changed files with 41 additions and 32 deletions.
2 changes: 2 additions & 0 deletions .clang-tidy
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ Checks: >
bugprone-*,
-bugprone-easily-swappable-parameters,
-bugprone-forward-declararion-namespace,
-bugprone-forward-declararion-namespace,
concurrency-*,
cppcoreguidelines-*,
-cppcoreguidelines-owning-memory,
Expand Down Expand Up @@ -42,6 +43,7 @@ Checks: >
-readability-else-after-return,
-readability-container-data-pointer,
-readability-implicit-bool-conversion,
-readability-avoid-nested-conditional-operator,
tidyfox-*,
CheckOptions:
performance-for-range-copy.WarnOnAllAutoCopies: true
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ jobs:
just build
- name: Run lints
run: just lint 2>&1
run: just lint
2 changes: 1 addition & 1 deletion Justfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ fmt:
find src -type f \( -name "*.cpp" -o -name "*.hpp" \) -print0 | xargs -0 clang-format -i

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 --tty --bar clang-tidy --load={{ env_var("TIDYFOX") }}

configure target='debug' *FLAGS='':
cmake -GNinja -B {{builddir}} \
Expand Down
3 changes: 2 additions & 1 deletion src/core/clock.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include <qqmlintegration.h>
#include <qtimer.h>
#include <qtmetamacros.h>
#include <qtypes.h>

#include "util.hpp"

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

public:
// must be named enum until docgen is ready to handle member enums better
enum Enum {
enum Enum : quint8 {
Hours = 1,
Minutes = 2,
Seconds = 3,
Expand Down
3 changes: 2 additions & 1 deletion src/core/logging_qtprivate.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include <qlogging.h>
#include <qloggingcategory.h>
#include <qstringview.h>
#include <qtypes.h>

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

enum PatternFlag {
enum PatternFlag : quint8 {
FullText = 0x1,
LeftFilter = 0x2,
RightFilter = 0x4,
Expand Down
3 changes: 2 additions & 1 deletion src/core/paths.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#pragma once
#include <qdatetime.h>
#include <qdir.h>
#include <qtypes.h>

#include "instanceinfo.hpp"

Expand Down Expand Up @@ -31,7 +32,7 @@ class QsPaths {
void createLock();

private:
enum class DirState {
enum class DirState : quint8 {
Unknown = 0,
Ready = 1,
Failed = 2,
Expand Down
3 changes: 2 additions & 1 deletion src/core/popupanchor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include <qsize.h>
#include <qtclasshelpermacros.h>
#include <qtmetamacros.h>
#include <qtypes.h>
#include <qwindow.h>

#include "../window/proxywindow.hpp"
Expand All @@ -26,7 +27,7 @@ namespace PopupAdjustment { // NOLINT
Q_NAMESPACE;
QML_ELEMENT;

enum Enum {
enum Enum : quint8 {
None = 0,
/// If the X axis is constrained, the popup will slide along the X axis until it fits onscreen.
SlideX = 1,
Expand Down
2 changes: 1 addition & 1 deletion src/core/qsmenu.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class QsMenuButtonType: public QObject {
QML_SINGLETON;

public:
enum Enum {
enum Enum : quint8 {
/// This menu item does not have a checkbox or a radiobutton associated with it.
None = 0,
/// This menu item should draw a checkbox.
Expand Down
4 changes: 2 additions & 2 deletions src/core/region.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ namespace RegionShape { // NOLINT
Q_NAMESPACE;
QML_ELEMENT;

enum Enum {
enum Enum : quint8 {
Rect = 0,
Ellipse = 1,
};
Expand All @@ -29,7 +29,7 @@ namespace Intersection { // NOLINT
Q_NAMESPACE;
QML_ELEMENT;

enum Enum {
enum Enum : quint8 {
/// Combine this region, leaving a union of this and the other region. (opposite of `Subtract`)
Combine = 0,
/// Subtract this region, cutting this region out of the other. (opposite of `Combine`)
Expand Down
3 changes: 2 additions & 1 deletion src/core/types.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include <qqmlintegration.h>
#include <qrect.h>
#include <qtmetamacros.h>
#include <qtypes.h>

class Box {
Q_GADGET;
Expand Down Expand Up @@ -53,7 +54,7 @@ namespace Edges { // NOLINT
Q_NAMESPACE;
QML_NAMED_ELEMENT(Edges);

enum Enum {
enum Enum : quint8 {
None = 0,
Top = Qt::TopEdge,
Left = Qt::LeftEdge,
Expand Down
3 changes: 2 additions & 1 deletion src/services/greetd/connection.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include <qobject.h>
#include <qqmlintegration.h>
#include <qtmetamacros.h>
#include <qtypes.h>

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

public:
enum Enum {
enum Enum : quint8 {
Inactive = 0,
Authenticating = 1,
ReadyToLaunch = 2,
Expand Down
4 changes: 2 additions & 2 deletions src/services/mpris/player.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class MprisPlaybackState: public QObject {
QML_SINGLETON;

public:
enum Enum {
enum Enum : quint8 {
Stopped = 0,
Playing = 1,
Paused = 2,
Expand All @@ -41,7 +41,7 @@ class MprisLoopState: public QObject {
QML_SINGLETON;

public:
enum Enum {
enum Enum : quint8 {
None = 0,
Track = 1,
Playlist = 2,
Expand Down
5 changes: 3 additions & 2 deletions src/services/notifications/notification.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include <qobject.h>
#include <qqmlintegration.h>
#include <qtmetamacros.h>
#include <qtypes.h>

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

public:
enum Enum {
enum Enum : quint8 {
Low = 0,
Normal = 1,
Critical = 2,
Expand All @@ -42,7 +43,7 @@ class NotificationCloseReason: public QObject {
QML_SINGLETON;

public:
enum Enum {
enum Enum : quint8 {
/// The notification expired due to a timeout.
Expired = 1,
/// The notification was explicitly dismissed by the user.
Expand Down
2 changes: 1 addition & 1 deletion src/services/notifications/server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ void NotificationServer::tryRegister() {
}
void NotificationServer::onServiceUnregistered(const QString& /*unused*/) {
qCDebug(logNotifications) << "Active notification server unregistered, attempting registration";
this->tryRegister();
NotificationServer::tryRegister();
}

void NotificationServer::CloseNotification(uint id) {
Expand Down
2 changes: 1 addition & 1 deletion src/services/notifications/server.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ class NotificationServer: public QObject {
// NOLINTEND

private slots:
void onServiceUnregistered(const QString& service);
static void onServiceUnregistered(const QString& service);

private:
explicit NotificationServer();
Expand Down
7 changes: 3 additions & 4 deletions src/services/pam/conversation.hpp
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
#pragma once

#include <utility>

#include <qloggingcategory.h>
#include <qobject.h>
#include <qqmlintegration.h>
#include <qsocketnotifier.h>
#include <qtclasshelpermacros.h>
#include <qtmetamacros.h>
#include <qtypes.h>

#include "ipc.hpp"

Expand All @@ -21,7 +20,7 @@ class PamResult: public QObject {
QML_SINGLETON;

public:
enum Enum {
enum Enum : quint8 {
/// Authentication was successful.
Success = 0,
/// Authentication failed.
Expand All @@ -44,7 +43,7 @@ class PamError: public QObject {
QML_SINGLETON;

public:
enum Enum {
enum Enum : quint8 {
/// Failed to start the pam session.
StartFailed = 1,
/// Failed to try to authenticate the user.
Expand Down
2 changes: 1 addition & 1 deletion src/services/pam/subprocess.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#pragma once

#include <iostream>
#include <iostream> // NOLINT std::cout

#include <security/pam_appl.h>

Expand Down
2 changes: 1 addition & 1 deletion src/services/pipewire/link.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class PwLinkState: public QObject {
QML_SINGLETON;

public:
enum Enum {
enum Enum : qint8 {
Error = PW_LINK_STATE_ERROR,
Unlinked = PW_LINK_STATE_UNLINKED,
Init = PW_LINK_STATE_INIT,
Expand Down
2 changes: 1 addition & 1 deletion src/services/pipewire/node.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ class PwAudioChannel: public QObject {
Q_INVOKABLE static QString toString(qs::service::pipewire::PwAudioChannel::Enum value);
};

enum class PwNodeType {
enum class PwNodeType : quint8 {
Untracked,
Audio,
};
Expand Down
1 change: 1 addition & 0 deletions src/services/status_notifier/dbus_item_types.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include <qlogging.h>
#include <qmetatype.h>
#include <qsysinfo.h>
#include <qtversionchecks.h>
#include <qtypes.h>

bool DBusSniIconPixmap::operator==(const DBusSniIconPixmap& other) const {
Expand Down
4 changes: 2 additions & 2 deletions src/services/status_notifier/item.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ namespace Status { // NOLINT
Q_NAMESPACE;
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.
Passive = 0,
/// An active item may have information more important than a passive one and you probably do not want to hide it.
Expand All @@ -43,7 +43,7 @@ namespace Category { // NOLINT
Q_NAMESPACE;
QML_ELEMENT;

enum Enum {
enum Enum : quint8 {
/// The fallback category for general applications or anything that does
/// not fit into a different category.
ApplicationStatus = 0,
Expand Down
4 changes: 2 additions & 2 deletions src/services/upower/device.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class UPowerDeviceState: public QObject {
QML_SINGLETON;

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

public:
enum Enum {
enum Enum : quint8 {
Unknown = 0,
LinePower = 1,
Battery = 2,
Expand Down
1 change: 0 additions & 1 deletion src/wayland/hyprland/global_shortcuts/qml.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
#include <qtmetamacros.h>

#include "manager.hpp"
#include "shortcut.hpp"

namespace qs::hyprland::global_shortcuts {
using impl::GlobalShortcutManager;
Expand Down
4 changes: 2 additions & 2 deletions src/wayland/wlr_layershell/window.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ namespace WlrLayer { // NOLINT
Q_NAMESPACE;
QML_ELEMENT;

enum Enum {
enum Enum : quint8 {
/// Below bottom
Background = 0,
/// Above background, usually below windows
Expand All @@ -36,7 +36,7 @@ namespace WlrKeyboardFocus { // NOLINT
Q_NAMESPACE;
QML_ELEMENT;

enum Enum {
enum Enum : quint8 {
/// No keyboard input will be accepted.
None = 0,
/// Exclusive access to the keyboard, locking out all other windows.
Expand Down
3 changes: 2 additions & 1 deletion src/window/panelinterface.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

#include <qqmlintegration.h>
#include <qtmetamacros.h>
#include <qtypes.h>

#include "../core/doc.hpp"
#include "windowinterface.hpp"
Expand Down Expand Up @@ -63,7 +64,7 @@ namespace ExclusionMode { // NOLINT
Q_NAMESPACE;
QML_ELEMENT;

enum Enum {
enum Enum : quint8 {
/// Respect the exclusion zone of other shell layers and optionally set one
Normal = 0,
/// Ignore exclusion zones of other shell layers. You cannot set an exclusion zone in this mode.
Expand Down

0 comments on commit c5319e3

Please sign in to comment.