Skip to content

Commit

Permalink
fix(ci): run clang-format on .hpp
Browse files Browse the repository at this point in the history
  • Loading branch information
star0202 committed Jun 9, 2024
1 parent 0817e9c commit 899c81c
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 19 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/cpp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ on:
push:
paths:
- "**/*.cpp"
- "**/*.h"
- "**/*.hpp"
pull_request:
paths:
- "**/*.cpp"
- "**/*.h"
- "**/*.hpp"

jobs:
format:
Expand All @@ -22,4 +22,4 @@ jobs:
with:
clangformat: 18.1.6
- name: Run clang-format
run: clang-format **/*.cpp **/*.h -n --Werror
run: clang-format **/*.cpp **/*.hpp -n --Werror
30 changes: 14 additions & 16 deletions tools/debugger/debug.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ using namespace std;
#define debug(...) \
{ \
_print_header(__FILE__, __LINE__, __FUNCTION__); \
string _s = #__VA_ARGS__; \
replace(_s.begin(), _s.end(), ',', ' '); \
stringstream _ss(_s); \
istream_iterator<string> _it(_ss); \
string _s = #__VA_ARGS__; \
replace(_s.begin(), _s.end(), ',', ' '); \
stringstream _ss(_s); \
istream_iterator<string> _it(_ss); \
_print_value(_it, __VA_ARGS__); \
}

Expand Down Expand Up @@ -84,8 +84,7 @@ template <class T>
struct is_supports_top<priority_queue<T>> : true_type {};

template <class T>
struct is_supports_top<priority_queue<T, vector<T>, greater<T>>>
: true_type {};
struct is_supports_top<priority_queue<T, vector<T>, greater<T>>> : true_type {};

template <class T>
struct is_implemented {
Expand All @@ -108,8 +107,7 @@ string to_string(const char *s) { return to_string((string)s); }
string to_string(bool b) { return (b ? "true" : "false"); }

template <class T>
typename enable_if<filter::is_iterable<T>::value, string>::type
to_string(T v) {
typename enable_if<filter::is_iterable<T>::value, string>::type to_string(T v) {
bool first = true;
string res = CONTAINER + "{ ";
for (auto &x : v) {
Expand All @@ -121,9 +119,7 @@ to_string(T v) {
}

template <class T>
typename enable_if<filter::is_map<T>::value, string>::type to_string(
T m
) {
typename enable_if<filter::is_map<T>::value, string>::type to_string(T m) {
bool first = true;
string res = CONTAINER + "{ ";
for (auto &[k, v] : m) {
Expand All @@ -136,8 +132,9 @@ typename enable_if<filter::is_map<T>::value, string>::type to_string(
}

template <class T>
typename enable_if<filter::is_supports_top<T>::value, string>::type
to_string(T v) {
typename enable_if<filter::is_supports_top<T>::value, string>::type to_string(
T v
) {
T t = v;
bool first = true;
string res = CONTAINER + "{ ";
Expand Down Expand Up @@ -188,8 +185,9 @@ string to_string(tuple<T...> t) {
}

template <class T>
typename enable_if<!filter::is_implemented<T>::value, string>::type
to_string(T x) {
typename enable_if<!filter::is_implemented<T>::value, string>::type to_string(
T x
) {
return ERROR + "Not implemented" + RESET;
}

Expand All @@ -200,7 +198,7 @@ string _to_str(T x) {

void _print_header(string file, int line, string func) {
cerr << HEADER << "[" << file << ":" << line
<< (func == "main" ? "" : " - " + func) << "]" << RESET << "\n";
<< (func == "main" ? "" : " - " + func) << "]" << RESET << "\n";
}

void _print_value(istream_iterator<string> it) {}
Expand Down

0 comments on commit 899c81c

Please sign in to comment.