[*] basic in-house cpp linting

Signed-off-by: lizzie <lizzie@eden-emu.dev>
This commit is contained in:
lizzie 2026-06-01 19:05:44 +00:00 committed by crueter
parent f8f5a9b1a2
commit 10b8a1575d
19 changed files with 60 additions and 64 deletions

View File

@ -1,8 +1,7 @@
// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project
// SPDX-License-Identifier: GPL-3.0-or-later
#ifndef DATA_MANAGER_H
#define DATA_MANAGER_H
#pragma once
#include "common/common_types.h"
#include <string>
@ -21,5 +20,3 @@ std::string ReadableBytesSize(u64 size) noexcept;
u64 DataDirSize(DataDir dir);
}; // namespace FrontendCommon::DataManager
#endif // DATA_MANAGER_H

View File

@ -1,8 +1,7 @@
// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project
// SPDX-License-Identifier: GPL-3.0-or-later
#ifndef FIRMWARE_MANAGER_H
#define FIRMWARE_MANAGER_H
#pragma once
#include "common/common_types.h"
#include "core/core.h"
@ -107,5 +106,3 @@ inline std::pair<Service::Set::FirmwareVersionFormat, Result> GetFirmwareVersion
// TODO(crueter): GET AS STRING
}
#endif

View File

@ -5,6 +5,7 @@
#include <filesystem>
#include <optional>
#include <vector>
#include "common/common_types.h"
namespace FrontendCommon {

View File

@ -1,8 +1,7 @@
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
// SPDX-License-Identifier: GPL-3.0-or-later
#ifndef FRONTEND_H
#define FRONTEND_H
#pragma once
#include <QGuiApplication>
#include "qt_common/qt_common.h"
@ -114,4 +113,3 @@ const QString GetTextInput(const QString& title = QString(), const QString& capt
const QString& defaultText = QString());
} // namespace QtCommon::Frontend
#endif // FRONTEND_H

View File

@ -1,8 +1,7 @@
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
// SPDX-License-Identifier: GPL-3.0-or-later
#ifndef QT_COMMON_H
#define QT_COMMON_H
#pragma once
#include <memory>
#include <QWindow>
@ -62,4 +61,3 @@ const QString tr(const std::string& str);
std::filesystem::path GetEdenCommand();
} // namespace QtCommon
#endif

View File

@ -1,9 +1,7 @@
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
// SPDX-License-Identifier: GPL-3.0-or-later
#ifndef QT_APPLET_UTIL_H
#define QT_APPLET_UTIL_H
#pragma once
// TODO
namespace QtCommon::Applets {}
#endif // QT_APPLET_UTIL_H

View File

@ -1,8 +1,7 @@
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
// SPDX-License-Identifier: GPL-3.0-or-later
#ifndef QT_CONTENT_UTIL_H
#define QT_CONTENT_UTIL_H
#pragma once
#include <QObject>
#include "common/common_types.h"
@ -63,4 +62,3 @@ void configureFilesystemProvider(const std::string& filepath);
// Profiles //
void FixProfiles();
} // namespace QtCommon::Content
#endif // QT_CONTENT_UTIL_H

View File

@ -1,12 +1,12 @@
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
// SPDX-License-Identifier: GPL-3.0-or-later
#pragma once
#include <filesystem>
#include <optional>
#include "common/common_types.h"
#pragma once
namespace QtCommon::FS {
void LinkRyujinx(std::filesystem::path& from, std::filesystem::path& to);

View File

@ -1,8 +1,7 @@
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
// SPDX-License-Identifier: GPL-3.0-or-later
#ifndef QT_GAME_UTIL_H
#define QT_GAME_UTIL_H
#pragma once
#include <QObject>
#include <QStandardPaths>
@ -78,5 +77,3 @@ void CreateHomeMenuShortcut(ShortcutTarget target);
[[nodiscard]] bool SaveIconToFile(const std::filesystem::path& icon_path, const QImage& image);
} // namespace QtCommon::Game
#endif // QT_GAME_UTIL_H

View File

@ -1,8 +1,7 @@
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
// SPDX-License-Identifier: GPL-3.0-or-later
#ifndef QT_META_H
#define QT_META_H
#pragma once
#include <QObject>
@ -12,4 +11,3 @@ namespace QtCommon::Meta {
void RegisterMetaTypes();
} // namespace QtCommon::Meta
#endif // QT_META_H

View File

@ -1,8 +1,7 @@
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
// SPDX-License-Identifier: GPL-3.0-or-later
#ifndef QT_PATH_UTIL_H
#define QT_PATH_UTIL_H
#pragma once
#include <QObject>
#include "common/common_types.h"
@ -10,5 +9,3 @@
namespace QtCommon::Path {
bool OpenShaderCache(u64 program_id, QObject* parent);
}
#endif // QT_PATH_UTIL_H

View File

@ -1,16 +1,11 @@
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
// SPDX-License-Identifier: GPL-3.0-or-later
#ifndef QT_ROM_UTIL_H
#define QT_ROM_UTIL_H
#pragma once
#include <cstddef>
#include "qt_common/qt_common.h"
namespace QtCommon::ROM {
bool RomFSRawCopy(size_t total_size, size_t& read_size, QtProgressCallback callback,
const FileSys::VirtualDir& src, const FileSys::VirtualDir& dest, bool full);
bool RomFSRawCopy(size_t total_size, size_t& read_size, QtProgressCallback callback, const FileSys::VirtualDir& src, const FileSys::VirtualDir& dest, bool full);
}
#endif // QT_ROM_UTIL_H

View File

@ -5,8 +5,7 @@
// SPDX-FileCopyrightText: 2013 Diego Gutierrez (diegog@unizar.es)
// SPDX-License-Identifier: MIT
#ifndef AREATEX_H
#define AREATEX_H
#pragma once
#define AREATEX_WIDTH 160
#define AREATEX_HEIGHT 560
@ -11219,5 +11218,3 @@ static const unsigned char areaTexBytes[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
#endif

View File

@ -5,8 +5,7 @@
// SPDX-FileCopyrightText: 2013 Diego Gutierrez (diegog@unizar.es)
// SPDX-License-Identifier: MIT
#ifndef SEARCHTEX_H
#define SEARCHTEX_H
#pragma once
#define SEARCHTEX_WIDTH 64
#define SEARCHTEX_HEIGHT 16
@ -84,5 +83,3 @@ static const unsigned char searchTexBytes[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
};
#endif

View File

@ -1,8 +1,7 @@
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
// SPDX-License-Identifier: GPL-3.0-or-later
#ifndef DATA_DIALOG_H
#define DATA_DIALOG_H
#pragma once
#include <QDialog>
#include "frontend_common/data_manager.h"
@ -47,5 +46,3 @@ private:
std::optional<std::string> selectProfile();
};
#endif // DATA_DIALOG_H

View File

@ -1,8 +1,7 @@
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
// SPDX-License-Identifier: GPL-3.0-or-later
#ifndef MIGRATION_DIALOG_H
#define MIGRATION_DIALOG_H
#pragma once
#include <QHBoxLayout>
#include <QMessageBox>
@ -29,5 +28,3 @@ private:
QAbstractButton* m_clickedButton;
};
#endif // MIGRATION_DIALOG_H

View File

@ -1,8 +1,7 @@
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
// SPDX-License-Identifier: GPL-3.0-or-later
#ifndef MIGRATION_WORKER_H
#define MIGRATION_WORKER_H
#pragma once
#include <QObject>
#include "common/fs/path_util.h"
@ -73,5 +72,3 @@ private:
MigrationStrategy strategy;
QString success_text = tr("Data was migrated successfully.");
};
#endif // MIGRATION_WORKER_H

View File

@ -1,8 +1,7 @@
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
// SPDX-License-Identifier: GPL-3.0-or-later
#ifndef RYUJINX_DIALOG_H
#define RYUJINX_DIALOG_H
#pragma once
#include <filesystem>
#include <QDialog>
@ -28,5 +27,3 @@ private:
std::filesystem::path m_eden;
std::filesystem::path m_ryu;
};
#endif // RYUJINX_DIALOG_H

40
tools/cpp-lint.sh Executable file
View File

@ -0,0 +1,40 @@
#!/bin/sh -ex
# SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
# SPDX-License-Identifier: GPL-3.0-or-later
# tools/../
ROOTDIR=$(CDPATH='' cd -- "$(dirname -- "$0")/../" && pwd)
die() {
echo "-- $*" >&2
exit 1
}
usage() {
cat <<EOF
Usage: $0 [command]
Dumb script that serves as a ad-hoc cpp-linter
Commands:
once Check for #pragma once prescence in header files
EOF
}
while :; do
case "$1" in
once)
find "$ROOTDIR/src" -type f -name "*.h" -exec grep -L "#pragma once" {} +
break
;;
osdef)
find "$ROOTDIR/src" -type f -name "*.h" -exec grep -nw "ANDROID" {} +
break
;;
*) usage ;;
esac
shift
done