Skip to content

Commit 18b5d52

Browse files
committed
Add rules to order headers
1 parent 00b7c16 commit 18b5d52

68 files changed

Lines changed: 215 additions & 167 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: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ DerivePointerAlignment: false
7575
PointerAlignment: Left
7676
ReferenceAlignment: Left
7777
ReflowComments: true
78-
SortIncludes: false
78+
SortIncludes: CaseSensitive
7979
SortUsingDeclarations: false
8080
MaxEmptyLinesToKeep: 1
8181

@@ -93,7 +93,24 @@ IndentRequiresClause: true
9393
SpaceAroundPointerQualifiers: Default
9494

9595
# Include formatting
96-
IncludeBlocks: Preserve
96+
IncludeBlocks: Regroup
97+
IncludeCategories:
98+
# 1. Main header (e.g., foo.cpp includes foo.hpp first)
99+
- Regex: '^".*\.hpp"$'
100+
Priority: 1
101+
SortPriority: 1
102+
# 2. C++ standard library
103+
- Regex: '^<[^/]+>$'
104+
Priority: 2
105+
SortPriority: 2
106+
# 3. Third-party libraries (uni-algo, catch2, nlohmann)
107+
- Regex: '^<(uni|catch2|nlohmann)/'
108+
Priority: 3
109+
SortPriority: 3
110+
# 4. Project headers (skyr/...)
111+
- Regex: '^<skyr/'
112+
Priority: 4
113+
SortPriority: 4
97114

98115
# Namespace formatting
99116
CompactNamespaces: false

include/skyr/concepts/url_concepts.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
#ifndef SKYR_CONCEPTS_URL_CONCEPTS_HPP
77
#define SKYR_CONCEPTS_URL_CONCEPTS_HPP
88

9-
#include <type_traits>
109
#include <string>
1110
#include <string_view>
11+
#include <type_traits>
1212

1313
namespace skyr {
1414
template <class T, class charT>

include/skyr/containers/static_vector.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@
66
#ifndef SKYR_CONTAINERS_STATIC_VECTOR_HPP
77
#define SKYR_CONTAINERS_STATIC_VECTOR_HPP
88

9-
#include <cstdlib>
109
#include <array>
11-
#include <type_traits>
12-
#include <optional>
1310
#include <cassert>
11+
#include <cstdlib>
1412
#include <new>
13+
#include <optional>
14+
#include <type_traits>
1515

1616
namespace skyr {
1717
///

include/skyr/core/check_input.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@
66
#ifndef SKYR_CORE_CHECK_INPUT_HPP
77
#define SKYR_CORE_CHECK_INPUT_HPP
88

9-
#include <locale>
10-
#include <string>
119
#include <algorithm>
1210
#include <iterator>
11+
#include <locale>
12+
#include <string>
1313

1414
namespace skyr {
1515
constexpr static auto is_c0_control_or_space = [](auto byte) {

include/skyr/core/host.hpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,19 @@
66
#ifndef SKYR_CORE_HOST_HPP
77
#define SKYR_CORE_HOST_HPP
88

9-
#include <variant>
10-
#include <string>
11-
#include <cassert>
129
#include <algorithm>
10+
#include <cassert>
1311
#include <expected>
14-
#include <algorithm>
1512
#include <ranges>
13+
#include <string>
14+
#include <variant>
15+
1616
#include <skyr/core/errors.hpp>
17+
#include <skyr/domain/domain.hpp>
1718
#include <skyr/network/ipv4_address.hpp>
1819
#include <skyr/network/ipv6_address.hpp>
19-
#include <skyr/percent_encoding/percent_encoded_char.hpp>
2020
#include <skyr/percent_encoding/percent_decode.hpp>
21-
#include <skyr/domain/domain.hpp>
21+
#include <skyr/percent_encoding/percent_encoded_char.hpp>
2222

2323
namespace skyr {
2424
/// Represents a domain name in a [URL host](https://url.spec.whatwg.org/#host-representation)

include/skyr/core/parse.hpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,14 @@
66
#ifndef SKYR_CORE_PARSE_HPP
77
#define SKYR_CORE_PARSE_HPP
88

9-
#include <system_error>
10-
#include <optional>
119
#include <expected>
12-
#include <skyr/core/url_record.hpp>
13-
#include <skyr/core/errors.hpp>
10+
#include <optional>
11+
#include <system_error>
12+
1413
#include <skyr/core/check_input.hpp>
14+
#include <skyr/core/errors.hpp>
1515
#include <skyr/core/url_parser_context.hpp>
16+
#include <skyr/core/url_record.hpp>
1617

1718
namespace skyr {
1819
namespace details {

include/skyr/core/parse_path.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
#include <string>
1010
#include <vector>
11+
1112
#include <skyr/core/parse.hpp>
1213

1314
namespace skyr {

include/skyr/core/parse_query.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,10 @@
66
#ifndef SKYR_CORE_PARSE_QUERY_HPP
77
#define SKYR_CORE_PARSE_QUERY_HPP
88

9+
#include <ranges>
910
#include <string>
1011
#include <vector>
11-
#include <ranges>
12+
1213
#include <skyr/core/parse.hpp>
1314

1415
namespace skyr {

include/skyr/core/schemes.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
#ifndef SKYR_CORE_URL_SCHEMES_HPP
77
#define SKYR_CORE_URL_SCHEMES_HPP
88

9-
#include <string_view>
109
#include <cstdint>
1110
#include <optional>
11+
#include <string_view>
1212

1313
namespace skyr {
1414
/// \param scheme

include/skyr/core/serialize.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
#include <format>
1010
#include <ranges>
11+
1112
#include <skyr/core/url_record.hpp>
1213

1314
namespace skyr {

0 commit comments

Comments
 (0)