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-easily-swappable-parameters,
-bugprone-forward-declararion-namespace,
-bugprone-forward-declararion-namespace,
concurrency-*,
cppcoreguidelines-*,
-cppcoreguidelines-owning-memory,
@ -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

View file

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

View file

@ -1,5 +1,5 @@
name: Lint
on: [push, pull_request]
on: [push, pull_request, workflow_dispatch]
jobs:
lint:
@ -22,4 +22,4 @@ jobs:
just build
- 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
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='':
cmake -GNinja -B {{builddir}} \

View file

@ -5,6 +5,7 @@
#include <qqmlintegration.h>
#include <qtimer.h>
#include <qtmetamacros.h>
#include <qtypes.h>
#include "util.hpp"
@ -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,

View file

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

View file

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

View file

@ -10,6 +10,7 @@
#include <qsize.h>
#include <qtclasshelpermacros.h>
#include <qtmetamacros.h>
#include <qtypes.h>
#include <qwindow.h>
#include "../window/proxywindow.hpp"
@ -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,

View file

@ -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.

View file

@ -15,7 +15,7 @@ namespace RegionShape { // NOLINT
Q_NAMESPACE;
QML_ELEMENT;
enum Enum {
enum Enum : quint8 {
Rect = 0,
Ellipse = 1,
};
@ -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`)

View file

@ -6,6 +6,7 @@
#include <qqmlintegration.h>
#include <qrect.h>
#include <qtmetamacros.h>
#include <qtypes.h>
class Box {
Q_GADGET;
@ -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,

View file

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

View file

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

View file

@ -8,6 +8,7 @@
#include <qobject.h>
#include <qqmlintegration.h>
#include <qtmetamacros.h>
#include <qtypes.h>
#include "../../core/retainable.hpp"
#include "../../core/util.hpp"
@ -24,7 +25,7 @@ class NotificationUrgency: public QObject {
QML_SINGLETON;
public:
enum Enum {
enum Enum : quint8 {
Low = 0,
Normal = 1,
Critical = 2,
@ -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.

View file

@ -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) {

View file

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

View file

@ -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"
@ -21,7 +20,7 @@ class PamResult: public QObject {
QML_SINGLETON;
public:
enum Enum {
enum Enum : quint8 {
/// Authentication was successful.
Success = 0,
/// Authentication failed.
@ -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.

View file

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

View file

@ -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,

View file

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

View file

@ -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 {

View file

@ -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.
@ -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,

View file

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

View file

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

View file

@ -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
@ -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.

View file

@ -2,6 +2,7 @@
#include <qqmlintegration.h>
#include <qtmetamacros.h>
#include <qtypes.h>
#include "../core/doc.hpp"
#include "windowinterface.hpp"
@ -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.