ci: use clang-format action for format checks

This commit is contained in:
KorewaWatchful
2026-05-20 21:13:20 -04:00
committed by Gamid
parent 53cbaa4c8b
commit 9def9989b7
17 changed files with 64 additions and 66 deletions
-14
View File
@@ -1,14 +0,0 @@
#!/bin/bash
set -ex
if [ "$GITHUB_EVENT_NAME" == "pull_request" ]; then
git fetch origin $GITHUB_BASE_REF:refs/remotes/origin/$GITHUB_BASE_REF
for f in $(git diff --diff-filter=AM --name-only origin/$GITHUB_BASE_REF 'vita3k/**.cpp' 'vita3k/**.h' 'tools/**.cpp' 'tools/**.h'); do
if [ "$(diff -u <(cat $f) <(clang-format $f))" != "" ]
then
echo "run format"
exit 1
fi
done
fi
+11 -1
View File
@@ -15,13 +15,23 @@ env:
jobs:
format-check:
name: Format Check (${{ matrix.path }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
path:
- vita3k
- tools
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Format check
run: .github/format-check.sh
uses: jidicula/clang-format-action@v4.18.0
with:
clang-format-version: '22'
check-path: ${{ matrix.path }}
build:
name: Build (${{ matrix.os }})
+3 -2
View File
@@ -1,6 +1,7 @@
@echo off
if "%CLANG_FORMAT_BIN%"=="" set "CLANG_FORMAT_BIN=clang-format"
cd vita3k
for /f %%f in ('dir *.cpp *.h /b/s') do clang-format -i %%f
for /f %%f in ('dir *.cpp *.h /b/s') do "%CLANG_FORMAT_BIN%" -i "%%f"
cd ..\tools
for /f %%f in ('dir *.cpp *.h /b/s') do clang-format -i %%f
for /f %%f in ('dir *.cpp *.h /b/s') do "%CLANG_FORMAT_BIN%" -i "%%f"
cd ..
+4 -2
View File
@@ -1,4 +1,6 @@
#!/usr/bin/env bash
set -ex
set -euo pipefail
find vita3k tools/gen-modules tools/native-tool \( -name *.cpp -o -name *.h \) | xargs clang-format -i
CLANG_FORMAT_BIN="${CLANG_FORMAT_BIN:-clang-format}"
find vita3k tools/gen-modules tools/native-tool \( -name '*.cpp' -o -name '*.h' \) -print0 | xargs -0 "$CLANG_FORMAT_BIN" -i
+1 -1
View File
@@ -35,7 +35,7 @@
CtrlKeyboardFilter::CtrlKeyboardFilter(EmuEnvState &emuenv, QObject *parent)
: QObject(parent)
, m_emuenv(emuenv){};
, m_emuenv(emuenv) {};
bool CtrlKeyboardFilter::eventFilter(QObject *watched, QEvent *event) {
switch (event->type()) {
+1 -1
View File
@@ -9,7 +9,7 @@ class ByteRingBuffer {
public:
ByteRingBuffer(std::size_t size)
: buffer(new char[size])
, capacity(size){
, capacity(size) {
};
+1 -1
View File
@@ -179,7 +179,7 @@ constexpr auto make_obfuscator(const char (&data)[N]) {
// functions for decrypting the string and is also implicitly convertable to a
// char*
#define AY_OBFUSCATE_KEY(data, key) \
[]() -> ay::obfuscated_data<sizeof(data) / sizeof(data[0]), key> & { \
[]()->ay::obfuscated_data<sizeof(data) / sizeof(data[0]), key> & { \
static_assert(sizeof(decltype(key)) == sizeof(ay::key_type), "key must be a 64 bit unsigned integer"); \
static_assert((key) >= (1ull << 56), "key must span all 8 bytes"); \
constexpr auto n = sizeof(data) / sizeof(data[0]); \
+3 -3
View File
@@ -20,16 +20,16 @@ public:
return { -xyz, w };
}
[[nodiscard]] Quaternion<decltype(T{} + T{})> operator+(const Quaternion &other) const {
[[nodiscard]] Quaternion<decltype(T{} + T{})> operator+(const Quaternion & other) const {
return { xyz + other.xyz, w + other.w };
}
[[nodiscard]] Quaternion<decltype(T{} - T{})> operator-(const Quaternion &other) const {
[[nodiscard]] Quaternion<decltype(T{} - T{})> operator-(const Quaternion & other) const {
return { xyz - other.xyz, w - other.w };
}
[[nodiscard]] Quaternion<decltype(T{} * T{} - T{} * T{})> operator*(
const Quaternion &other) const {
const Quaternion & other) const {
return { xyz * other.w + other.xyz * w + Cross(xyz, other.xyz),
w * other.w - Dot(xyz, other.xyz) };
}
+6 -6
View File
@@ -61,7 +61,7 @@ public:
return Vec3(f, f, f);
}
[[nodiscard]] constexpr Vec3<decltype(T{} + T{})> operator+(const Vec3 &other) const {
[[nodiscard]] constexpr Vec3<decltype(T{} + T{})> operator+(const Vec3 & other) const {
return { x + other.x, y + other.y, z + other.z };
}
@@ -72,7 +72,7 @@ public:
return *this;
}
[[nodiscard]] constexpr Vec3<decltype(T{} - T{})> operator-(const Vec3 &other) const {
[[nodiscard]] constexpr Vec3<decltype(T{} - T{})> operator-(const Vec3 & other) const {
return { x - other.x, y - other.y, z - other.z };
}
@@ -88,12 +88,12 @@ public:
return { -x, -y, -z };
}
[[nodiscard]] constexpr Vec3<decltype(T{} * T{})> operator*(const Vec3 &other) const {
[[nodiscard]] constexpr Vec3<decltype(T{} * T{})> operator*(const Vec3 & other) const {
return { x * other.x, y * other.y, z * other.z };
}
template <typename V>
[[nodiscard]] constexpr Vec3<decltype(T{} * V{})> operator*(const V &f) const {
[[nodiscard]] constexpr Vec3<decltype(T{} * V{})> operator*(const V & f) const {
using TV = decltype(T{} * V{});
using C = std::common_type_t<T, V>;
@@ -110,7 +110,7 @@ public:
return *this;
}
template <typename V>
[[nodiscard]] constexpr Vec3<decltype(T{} / V{})> operator/(const V &f) const {
[[nodiscard]] constexpr Vec3<decltype(T{} / V{})> operator/(const V & f) const {
using TV = decltype(T{} / V{});
using C = std::common_type_t<T, V>;
@@ -254,7 +254,7 @@ template <typename T>
// linear interpolation via SceFloat: 0.0=begin, 1.0=end
template <typename X>
[[nodiscard]] constexpr decltype(X{} * SceFloat{} + X{} * SceFloat{})
Lerp(const X &begin, const X &end, const SceFloat t) {
Lerp(const X &begin, const X &end, const SceFloat t) {
return begin * (1.f - t) + end * t;
}
+1 -2
View File
@@ -25,8 +25,7 @@
#elif defined(_MSC_VER)
#define DISABLE_WARNING_PUSH __pragma(warning(push))
#define DISABLE_WARNING_POP __pragma(warning(pop))
#define DISABLE_WARNING_NO_PUSH(warningNumber, warningName) __pragma(warning(disable \
: warningNumber))
#define DISABLE_WARNING_NO_PUSH(warningNumber, warningName) __pragma(warning(disable : warningNumber))
#else
#define DISABLE_WARNING_PUSH
#define DISABLE_WARNING_POP