Skip to content

Commit 684cf91

Browse files
committed
attempt1. try applu clang tidy, clang format
1 parent ebe1a3c commit 684cf91

File tree

141 files changed

+1406
-1152
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

141 files changed

+1406
-1152
lines changed

.clang-format

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -49,24 +49,17 @@ AttributeMacros:
4949
BinPackArguments: true
5050
BinPackParameters: true
5151
BraceWrapping:
52-
AfterCaseLabel: false
53-
AfterClass: false
52+
AfterClass: true
5453
AfterControlStatement: Never
55-
AfterEnum: false
56-
AfterFunction: false
54+
AfterEnum: true
55+
AfterFunction: true
5756
AfterNamespace: false
58-
AfterObjCDeclaration: false
59-
AfterStruct: false
60-
AfterUnion: false
61-
AfterExternBlock: false
57+
AfterStruct: true
58+
AfterUnion: true
6259
BeforeCatch: false
6360
BeforeElse: false
64-
BeforeLambdaBody: false
6561
BeforeWhile: false
6662
IndentBraces: false
67-
SplitEmptyFunction: true
68-
SplitEmptyRecord: true
69-
SplitEmptyNamespace: true
7063
BreakBeforeBinaryOperators: None
7164
BreakBeforeConceptDeclarations: Always
7265
BreakBeforeBraces: Attach

.clang-tidy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ Checks: >
9898
# Turn all the warnings from the checks above into errors.
9999
WarningsAsErrors: "*"
100100

101-
#HeaderFilterRegex: "(google/cloud/|generator/).*\\.h$"
101+
HeaderFilterRegex: '^(?!.*(_deps)/).*$'
102102

103103
CheckOptions:
104104
- { key: readability-identifier-naming.NamespaceCase, value: lower_case }

CMakeLists.txt

Lines changed: 35 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,24 @@
11
cmake_minimum_required(VERSION 3.28)
22
set (PROJECT_NAME aos)
33
project(${PROJECT_NAME} C CXX)
4+
set(CMAKE_CXX_STANDARD_REQUIRED True)
45
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
6+
set(CMAKE_CXX_CLANG_TIDY
7+
clang-tidy
8+
-format-style=file
9+
--extra-arg=-Wno-unknown-warning-option
10+
--extra-arg=-Wno-unused-command-line-argument
11+
)
12+
13+
set(CLANG_TIDY_FOR_3RD_PARTY "" CACHE STRING "" FORCE)
14+
function(disable_clang_tidy_for_target target)
15+
set_target_properties(${target} PROPERTIES CXX_CLANG_TIDY "")
16+
endfunction()
17+
18+
# Запрещаем CMake добавлять флаги модулей
19+
set(CMAKE_EXPERIMENTAL_CXX_MODULE_CMAKE_API OFF)
20+
set(CMAKE_EXPERIMENTAL_CXX_MODULE_DYNDEP OFF)
21+
522
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
623

724
include(FetchContent)
@@ -24,14 +41,14 @@ FetchContent_Declare(
2441
)
2542
FetchContent_MakeAvailable(magic_enum)
2643

27-
2844
FetchContent_Declare(
2945
tomlplusplus
3046
GIT_REPOSITORY https://github.com/marzer/tomlplusplus.git
3147
GIT_TAG v3.4.0
3248
)
3349
FetchContent_MakeAvailable(tomlplusplus)
3450

51+
3552
include(${CMAKE_SOURCE_DIR}/cmake/BuildLibsodium.cmake)
3653
FetchContent_Declare(
3754
libsodium
@@ -111,6 +128,13 @@ message(STATUS "Declared simdjson FetchContent.")
111128
FetchContent_MakeAvailable(simdjson)
112129
message(STATUS "simdjson FetchContent is available.")
113130

131+
set_target_properties(fmt PROPERTIES CXX_CLANG_TIDY "${CLANG_TIDY_FOR_3RD_PARTY}")
132+
set_target_properties(fmtlog-static PROPERTIES CXX_CLANG_TIDY "${CLANG_TIDY_FOR_3RD_PARTY}")
133+
set_target_properties(benchmark PROPERTIES CXX_CLANG_TIDY "${CLANG_TIDY_FOR_3RD_PARTY}")
134+
set_target_properties(gtest_main PROPERTIES CXX_CLANG_TIDY "${CLANG_TIDY_FOR_3RD_PARTY}")
135+
set_target_properties(simdjson PROPERTIES CXX_CLANG_TIDY "${CLANG_TIDY_FOR_3RD_PARTY}")
136+
137+
114138

115139
# # Загружаем Dlib
116140
# FetchContent_Declare(
@@ -183,14 +207,21 @@ target_link_libraries(${PROJECT_NAME}
183207
tomlplusplus::tomlplusplus
184208
nlohmann_json::nlohmann_json
185209
sodium
186-
fmt
187210
fmtlog-static
211+
fmt
188212
)
189213

190-
set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 23)
191-
set(CMAKE_CXX_STANDARD_REQUIRED True)
214+
192215
add_subdirectory(examples)
193216

217+
218+
set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 23)
219+
set_target_properties(${PROJECT_NAME} PROPERTIES
220+
CXX_SCAN_FOR_MODULES OFF
221+
CXX_MODULE_STD_ONLY OFF
222+
)
223+
224+
194225
option(BUILD_TESTS_AOS "Build tests" ON)
195226
if(BUILD_TESTS_AOS)
196227
enable_testing()

README.md

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,26 @@
11
# cryptobot_algo
2-
![repo stats](https://github-readme-stats.vercel.app/api/pin/?username=linoxoidunix&repo=cryptobot_algo&theme=dark)
3-
![Metrics](./metrics.plugin.activity.svg)
2+
![C++ Standard](https://img.shields.io/badge/C%2B%2B-23-blue)
3+
![CMake](https://img.shields.io/badge/CMake-3.28-informational)
4+
![GCC](https://img.shields.io/badge/GCC-13.2.0-blue)
5+
![G++](https://img.shields.io/badge/G++-14.2.0-blue)
6+
![Build System](https://img.shields.io/badge/build%20system-ninja-blue?logo=ninja)
7+
![License](https://img.shields.io/github/license/linoxoidunix/cryptobot_algo)
8+
![Last Commit](https://img.shields.io/github/last-commit/linoxoidunix/cryptobot_algo)
9+
10+
## 🧩 3rd Party Libraries
11+
12+
| Library | Purpose | Link |
13+
|---------------------|-------------------------------------|----------------------------------------|
14+
| Boost | General-purpose C++ libraries | [Boost](https://www.boost.org/) |
15+
| OpenSSL | Cryptography, SSL/TLS | [OpenSSL](https://www.openssl.org/) |
16+
| magic_enum | Reflection utilities for enums | [magic_enum](https://github.com/Neargye/magic_enum) |
17+
| tomlplusplus | TOML parser for C++ | [tomlplusplus](https://github.com/marzer/tomlplusplus) |
18+
| libsodium | Cryptographic library | [libsodium](https://github.com/jedisct1/libsodium) |
19+
| concurrentqueue | Lock-free concurrent queue | [concurrentqueue](https://github.com/cameron314/concurrentqueue) |
20+
| nlohmann_json | JSON parser for modern C++ | [nlohmann_json](https://github.com/nlohmann/json) |
21+
| simdjson | High-performance JSON parser | [simdjson](https://github.com/simdjson/simdjson) |
22+
| fmt | Modern string formatting | [fmt](https://github.com/fmtlib/fmt) |
23+
| fmtlog | Fast logging based on fmt | [fmtlog](https://github.com/MengRao/fmtlog) |
24+
| benchmark | Microbenchmarking library by Google | [benchmark](https://github.com/google/benchmark) |
25+
| googletest | Testing framework (gtest/gmock) | [googletest](https://github.com/google/googletest) |
26+

aoe/binance/auth/web_socket/auth.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#include "aoe/auth/web_socket/i_auth.h"
33
#include "aoe/session/web_socket/i_web_socket.h"
44
#include "aoe/signer/ed25519/i_signer.h"
5-
#include "fmtlog.h"
5+
#include "aos/logger/mylog.h"
66
namespace aoe {
77
namespace binance {
88
namespace impl {

aoe/binance/order_book_sync/order_book_sync.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
#include "aoe/binance/session/rest/session.h"
1010
#include "aos/order_book/i_order_book.h"
1111
// #include "aos/order_book/order_book.h"
12+
#include "aos/logger/mylog.h"
1213
#include "boost/asio.hpp"
13-
#include "fmtlog.h"
1414

1515
namespace aoe {
1616
namespace binance {

aoe/binance/order_watcher/order_watcher.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
#include "aoe/binance/order_manager/i_order_manager.h"
44
#include "aoe/binance/order_watcher/i_order_watcher.h"
5-
#include "fmtlog.h"
5+
#include "aos/logger/mylog.h"
66

77
namespace aoe {
88
namespace binance {
@@ -13,7 +13,7 @@ class OrderWatcher : public OrderWatcherInterface<MemoryPool> {
1313

1414
public:
1515
OrderWatcher(OrderManagerInterface<MemoryPool>& order_manager)
16-
: order_manager_(order_manager) {};
16+
: order_manager_(order_manager){};
1717
void OnEvent(boost::intrusive_ptr<OrderEventInterface<MemoryPool>> event) {
1818
order_manager_.OnResponse(event);
1919
};

aoe/binance/parser/json/rest/snapshot_response/i_parser.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#pragma once
22
#include "aoe/binance/order_book_event/i_order_book_event.h"
33
#include "boost/intrusive_ptr.hpp"
4-
#include "simdjson.h"
4+
#include "simdjson.h" // NOLINT
55

66
namespace aoe {
77
namespace binance {

aoe/binance/parser/json/ws/diff_response/i_parser.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#pragma once
22
#include "aoe/binance/order_book_event/i_order_book_event.h"
33
#include "boost/intrusive_ptr.hpp"
4-
#include "simdjson.h"
4+
#include "simdjson.h" // NOLINT
55

66
namespace aoe {
77
namespace binance {

aoe/binance/parser/json/ws/execution_response/execution_event_parser.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
#include "aos/converters/big_string_view_to_trading_pair/big_string_view_to_trading_pair.h"
99
#include "aos/trading_pair_factory/i_trading_pair_factory.h"
1010
#include "boost/intrusive_ptr.hpp"
11-
#include "simdjson.h"
11+
#include "simdjson.h" // NOLINT
1212
namespace aoe {
1313
namespace binance {
1414
namespace spot {

0 commit comments

Comments
 (0)