Skip to content

Commit

Permalink
[Code cleaning] - Fix clang-tidy warnings by adding some missing headers
Browse files Browse the repository at this point in the history
  • Loading branch information
sjanel committed Mar 31, 2024
1 parent cd49152 commit e4d24b2
Show file tree
Hide file tree
Showing 18 changed files with 40 additions and 6 deletions.
5 changes: 5 additions & 0 deletions src/api/interface/src/exchange.cpp
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
#include "exchange.hpp"

#include <cstddef>
#include <memory>
#include <utility>

#include "cct_log.hpp"
#include "currencycode.hpp"
#include "currencyexchangeflatset.hpp"
#include "exchangeconfig.hpp"
#include "exchangename.hpp"
#include "exchangeprivateapi.hpp"
#include "exchangepublicapi.hpp"
#include "marketorderbook.hpp"
#include "public-trade-vector.hpp"

namespace cct {

Expand Down
3 changes: 3 additions & 0 deletions src/api/interface/test/exchangeretriever_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@
#include <memory>
#include <span>
#include <string_view>
#include <utility>

#include "apikey.hpp"
#include "cct_const.hpp"
#include "cct_exception.hpp"
#include "cct_string.hpp"
Expand All @@ -23,6 +25,7 @@
#include "fiatconverter.hpp"
#include "loadconfiguration.hpp"
#include "reader.hpp"
#include "runmodes.hpp"
#include "timedef.hpp"

namespace cct {
Expand Down
2 changes: 2 additions & 0 deletions src/engine/src/coincenter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include <utility>

#include "balanceoptions.hpp"
#include "cct_const.hpp"
#include "cct_exception.hpp"
#include "cct_invalid_argument_exception.hpp"
#include "cct_log.hpp"
Expand All @@ -29,6 +30,7 @@
#include "ordersconstraints.hpp"
#include "queryresultprinter.hpp"
#include "queryresulttypes.hpp"
#include "timedef.hpp"
#include "transferablecommandresult.hpp"
#include "withdrawsconstraints.hpp"

Expand Down
1 change: 1 addition & 0 deletions src/engine/src/coincentercommand.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include "coincentercommand.hpp"

#include <cstdint>
#include <utility>

#include "cct_exception.hpp"
Expand Down
2 changes: 0 additions & 2 deletions src/engine/src/metricsexporter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
#include <array>

#include "abstractmetricgateway.hpp"
#include "balanceportfolio.hpp"
#include "cct_string.hpp"
#include "curlmetrics.hpp"
#include "currencycode.hpp"
#include "exchange.hpp"
Expand Down
2 changes: 2 additions & 0 deletions src/engine/src/queryresultprinter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,14 @@
#include <cstdint>
#include <optional>
#include <ostream>
#include <span>
#include <sstream>
#include <string_view>
#include <utility>

#include "apioutputtype.hpp"
#include "balanceperexchangeportfolio.hpp"
#include "cct_const.hpp"
#include "cct_json.hpp"
#include "cct_log.hpp"
#include "cct_string.hpp"
Expand Down
1 change: 1 addition & 0 deletions src/engine/test/queryresultprinter_public_test.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include <gtest/gtest.h>

#include <array>
#include <string_view>

#include "apioutputtype.hpp"
Expand Down
2 changes: 2 additions & 0 deletions src/objects/include/accountowner.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include <string_view>

#include "cct_string.hpp"
#include "cct_type_traits.hpp"

namespace cct {

Expand Down Expand Up @@ -30,4 +31,5 @@ class AccountOwner {
string _enName;
string _koName;
};

} // namespace cct
2 changes: 2 additions & 0 deletions src/objects/include/apioutputtype.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include <string_view>

namespace cct {

enum class ApiOutputType : int8_t {
kNoPrint,
kFormattedTable,
Expand All @@ -15,4 +16,5 @@ static constexpr std::string_view kApiOutputTypeTableStr = "table";
static constexpr std::string_view kApiOutputTypeJsonStr = "json";

ApiOutputType ApiOutputTypeFromString(std::string_view str);

} // namespace cct
1 change: 1 addition & 0 deletions src/objects/include/apiquerytypeenum.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include <cstdint>

namespace cct::api {

enum QueryType : int8_t {};

static constexpr QueryType kCurrencies{0};
Expand Down
2 changes: 2 additions & 0 deletions src/objects/src/exchange-names.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#include "exchange-names.hpp"

#include "cct_string.hpp"

namespace cct {

string ConstructAccumulatedExchangeNames(ExchangeNameSpan exchangeNames) {
Expand Down
2 changes: 2 additions & 0 deletions src/objects/src/publictrade.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
#include "publictrade.hpp"

#include "cct_string.hpp"
#include "timedef.hpp"
#include "timestring.hpp"
#include "tradeside.hpp"

namespace cct {

Expand Down
3 changes: 2 additions & 1 deletion src/objects/test/monetaryamount_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,8 @@ TEST(MonetaryAmountTest, Divide) {
EXPECT_EQ(MonetaryAmount("-870.5647", CurrencyCode("ETH")) / MonetaryAmount("4709.3467736", CurrencyCode("ETH")),
MonetaryAmount("-0.18485890758358997"));
EXPECT_EQ(MonetaryAmount("487.76 EUR") / MonetaryAmount("1300.5 EUR"), MonetaryAmount("0.3750557477893118"));
EXPECT_THROW(MonetaryAmount(100) / MonetaryAmount("0.00000000000000001"), exception);
EXPECT_THROW([[maybe_unused]] MonetaryAmount res = MonetaryAmount(100) / MonetaryAmount("0.00000000000000001"),
exception);
EXPECT_EQ(MonetaryAmount(10) / MonetaryAmount("0.0000000000000001"), MonetaryAmount("100000000000000000"));
EXPECT_EQ(MonetaryAmount("1000000000 KRW") / MonetaryAmount("922337203685477580 KRW"),
MonetaryAmount("0.00000000108420217"));
Expand Down
8 changes: 8 additions & 0 deletions src/objects/test/publictrade_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@

#include <gtest/gtest.h>

#include <cstdint>
#include <limits>

#include "market.hpp"
#include "monetaryamount.hpp"
#include "timedef.hpp"
#include "tradeside.hpp"

namespace cct {
class PublicTradeTest : public ::testing::Test {
protected:
Expand Down
1 change: 1 addition & 0 deletions src/objects/test/reader_mock.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

#include <gmock/gmock.h>

#include "cct_string.hpp"
#include "reader.hpp"

namespace cct {
Expand Down
1 change: 1 addition & 0 deletions src/tech/src/durationstring.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include "durationstring.hpp"

#include <algorithm>
#include <chrono>
#include <cstddef>
#include <cstdint>
Expand Down
6 changes: 3 additions & 3 deletions src/tech/test/flatkeyvaluestring_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
#include <gtest/gtest.h>

#include <cstdint>
#include <ranges>
#include <string_view>

#include "cct_exception.hpp"
#include "cct_json.hpp"
#include "cct_string.hpp"

namespace cct {
namespace {
Expand Down Expand Up @@ -109,8 +109,8 @@ TEST(FlatKeyValueStringTest, WithNullTerminatingCharAsSeparator) {
EXPECT_EQ(kvPairs.str(), std::string_view("tata:abc\0huhu:haha\0&newField:&&newValue&&"sv));

int kvPairPos = 0;
for (const auto &v : kvPairs) {
const auto key = v.key();
for (const auto &kv : kvPairs) {
const auto key = kv.key();
const char *kvPairPtr = key.data();
switch (kvPairPos++) {
case 0:
Expand Down
2 changes: 2 additions & 0 deletions src/tech/test/overflow-check_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

#include <gtest/gtest.h>

#include <cstdint>

namespace cct {
TEST(WillSumOverflowTest, Int8) {
EXPECT_FALSE(WillSumOverflow(int8_t{}, int8_t{}));
Expand Down

0 comments on commit e4d24b2

Please sign in to comment.