Skip to content

Commit 911cd25

Browse files
committed
Add clang-format to pre-commit
Add type_safe to clang-format include category Add function2 to clang-format include category
1 parent 396cd06 commit 911cd25

48 files changed

Lines changed: 326 additions & 302 deletions

Some content is hidden

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

.clang-format

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,11 @@ IncludeCategories:
9090
Priority: 8
9191
- Regex: ^<spdlog/
9292
Priority: 9
93-
- Regex: ^"openvic-simulation/
93+
- Regex: ^<function2/
9494
Priority: 10
95-
- Regex: .*
95+
- Regex: ^<type_safe/
9696
Priority: 11
97+
- Regex: ^"openvic-simulation/
98+
Priority: 12
99+
- Regex: .*
100+
Priority: 13

.pre-commit-config.yaml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@ default_language_version:
33

44
repos:
55
# Waiting on Hop311 to approve clang-format
6-
# - repo: https://github.com/pre-commit/mirrors-clang-format
7-
# rev: v19.1.3
8-
# hooks:
9-
# - id: clang-format
10-
# files: \.(c|h|cpp|hpp|inc)$
11-
# types_or: [text]
12-
# # exclude: |
13-
# # (?x)^(
14-
# # )
6+
- repo: https://github.com/pre-commit/mirrors-clang-format
7+
rev: v22.1.1
8+
hooks:
9+
- id: clang-format
10+
files: \.(c|h|cpp|hpp|inc)$
11+
types_or: [text]
12+
# exclude: |
13+
# (?x)^(
14+
# )
1515

1616
- repo: https://github.com/pocc/pre-commit-hooks
1717
rev: v1.3.5
@@ -49,4 +49,4 @@ repos:
4949
# exclude: |
5050
# (?x)^(
5151
# )
52-
additional_dependencies: [tomli]
52+
additional_dependencies: [tomli]

src/headless/main.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -264,9 +264,9 @@ static bool run_headless(fs::path const& root, memory::vector<memory::string>& m
264264
"\n\t{} - Total #{} ({}), Prestige #{} ({}), Industry #{} ({}), Military #{} ({})", //
265265
country, //
266266
country.get_total_rank(), country.total_score.get_untracked().to_string(1), //
267-
country.get_prestige_rank(), country.get_prestige_untracked().to_string(1), country.get_industrial_rank(),
268-
country.get_industrial_power_untracked().to_string(1), country.get_military_rank(),
269-
country.military_power.get_untracked().to_string(1)
267+
country.get_prestige_rank(), country.get_prestige_untracked().to_string(1), //
268+
country.get_industrial_rank(), country.get_industrial_power_untracked().to_string(1),
269+
country.get_military_rank(), country.military_power.get_untracked().to_string(1)
270270
);
271271
}
272272
SPDLOG_INFO("{}:{}", title, countries_str);

src/openvic-simulation/GameManager.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
#include <optional>
44
#include <string_view>
55

6+
#include <function2/function2.hpp>
7+
68
#include "openvic-simulation/DefinitionManager.hpp"
79
#include "openvic-simulation/InstanceManager.hpp"
810
#include "openvic-simulation/dataloader/Dataloader.hpp"
@@ -11,8 +13,6 @@
1113
#include "openvic-simulation/misc/GameRulesManager.hpp"
1214
#include "openvic-simulation/utility/Containers.hpp"
1315

14-
#include <function2/function2.hpp>
15-
1616
namespace OpenVic {
1717
struct GameManager {
1818
using elapsed_time_getter_func_t = fu2::function_base<true, true, fu2::capacity_none, false, false, uint64_t() const>;

src/openvic-simulation/InstanceManager.hpp

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

33
#include <utility>
44

5+
#include <function2/function2.hpp>
6+
57
#include "openvic-simulation/console/ConsoleInstance.hpp"
68
#include "openvic-simulation/country/CountryInstanceDeps.hpp"
79
#include "openvic-simulation/country/CountryInstanceManager.hpp"
@@ -23,8 +25,6 @@
2325
#include "openvic-simulation/utility/Containers.hpp"
2426
#include "openvic-simulation/utility/ThreadPool.hpp"
2527

26-
#include <function2/function2.hpp>
27-
2828
namespace OpenVic {
2929

3030
struct DefinitionManager;

src/openvic-simulation/console/ConsoleInstance.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,8 +188,10 @@ std::optional<bool> ConsoleInstance::validate_boolean(std::string_view value_str
188188
if (value_string == TRUE_VALUE || value_string == YES_VALUE || //
189189
value_string == ONE_VALUE || value_string == ON_VALUE) {
190190
return true;
191-
} else if (value_string == FALSE_VALUE || value_string == NO_VALUE || //
192-
value_string == ZERO_VALUE || value_string == OFF_VALUE) {
191+
} else if (
192+
value_string == FALSE_VALUE || value_string == NO_VALUE || //
193+
value_string == ZERO_VALUE || value_string == OFF_VALUE
194+
) {
193195
return false;
194196
}
195197

src/openvic-simulation/console/ConsoleInstance.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@
77
#include <fmt/color.h>
88
#include <fmt/core.h>
99

10+
#include <function2/function2.hpp>
11+
1012
#include "openvic-simulation/types/Colour.hpp"
1113
#include "openvic-simulation/types/Date.hpp"
1214
#include "openvic-simulation/types/OrderedContainers.hpp"
1315
#include "openvic-simulation/utility/Containers.hpp"
1416
#include "openvic-simulation/utility/Getters.hpp"
1517

16-
#include <function2/function2.hpp>
17-
1818
namespace OpenVic {
1919
struct ProvinceInstance;
2020
struct CountryInstance;

src/openvic-simulation/core/Hash.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ namespace OpenVic {
5353
}
5454
s |= std::hash<Args> {}(args);
5555
}(),
56-
...
56+
... //
5757
);
5858
}
5959
}

src/openvic-simulation/country/CountryInstance.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
#include <functional>
77
#include <limits>
88

9+
#include <type_safe/strong_typedef.hpp>
10+
911
#include "openvic-simulation/core/Typedefs.hpp"
1012
#include "openvic-simulation/core/error/ErrorMacros.hpp"
1113
#include "openvic-simulation/country/CountryDefinition.hpp"
@@ -51,7 +53,6 @@
5153

5254
#include "CountryInstanceDeps.hpp"
5355
#include "CountryInstanceManager.hpp"
54-
#include <type_safe/strong_typedef.hpp>
5556

5657
using namespace OpenVic;
5758

src/openvic-simulation/dataloader/Dataloader.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@
66
#include <openvic-dataloader/csv/Parser.hpp>
77
#include <openvic-dataloader/v2script/Parser.hpp>
88

9+
#include <function2/function2.hpp>
10+
911
#include "openvic-simulation/core/template/Concepts.hpp"
1012
#include "openvic-simulation/dataloader/ModManager.hpp"
1113
#include "openvic-simulation/dataloader/NodeTools.hpp"
1214
#include "openvic-simulation/utility/Containers.hpp"
1315

14-
#include <function2/function2.hpp>
15-
1616
namespace OpenVic {
1717
namespace fs = std::filesystem;
1818

0 commit comments

Comments
 (0)