Skip to content

Commit d55e0e6

Browse files
committed
Fixed formatting according to pre-commit's suggestions.
1 parent 2fe05f3 commit d55e0e6

26 files changed

+491
-251
lines changed

.github/workflows/ci.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,4 +97,3 @@ jobs:
9797
set -x
9898
[[ ! -z "${{ matrix.config.asan_options }}" ]] && export ASAN_OPTIONS="${{ matrix.config.asan_options }}"
9999
ctest --build-config Asan --output-on-failure --test-dir .build
100-

.github/workflows/pre-commit.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,4 +73,4 @@ jobs:
7373
with:
7474
tool_name: pre-commit
7575
level: warning
76-
reviewdog_flags: "-fail-level=error"
76+
reviewdog_flags: "-fail-level=error"

.gitmodules

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +0,0 @@
1-

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,4 @@ repos:
3737
hooks:
3838
- id: codespell
3939
files: ^.*\.(cmake|cpp|hpp|txt|md|json|in|yaml|yml)$
40-
args: ["--ignore-words", ".codespellignore" ]
40+
args: ["--ignore-words", ".codespellignore" ]

CMakeLists.txt

Lines changed: 53 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,7 @@
55

66
cmake_minimum_required(VERSION 3.27...3.31)
77

8-
project(
9-
beman.iterator_interface
10-
VERSION 0.0.0
11-
LANGUAGES CXX)
8+
project(beman.iterator_interface VERSION 0.0.0 LANGUAGES CXX)
129

1310
# Local helpers: required to include CompilerFeatureTest.
1411
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake")
@@ -24,76 +21,83 @@ beman_iterator_check_deducing_this(COMPILER_SUPPORTS_DEDUCING_THIS)
2421
set(TARGETS_EXPORT_NAME ${CMAKE_PROJECT_NAME}Targets)
2522

2623
option(
27-
BEMAN_ITERATOR_INTERFACE_USE_DEDUCING_THIS
28-
"Make use of C++23 \"deducing this\" feature (P0847R7). Turn this off for non-conforming compilers."
29-
${COMPILER_SUPPORTS_DEDUCING_THIS})
24+
BEMAN_ITERATOR_INTERFACE_USE_DEDUCING_THIS
25+
"Make use of C++23 \"deducing this\" feature (P0847R7). Turn this off for non-conforming compilers."
26+
${COMPILER_SUPPORTS_DEDUCING_THIS}
27+
)
3028

3129
option(
32-
BEMAN_ITERATOR_INTERFACE_BUILD_TESTS
33-
"Enable building tests and test infrastructure. Default: ON. Values: {ON, OFF}."
34-
${PROJECT_IS_TOP_LEVEL})
35-
36-
option(BEMAN_ITERATOR_INTERFACE_BUILD_EXAMPLES
37-
"Enable building examples. Default: ON. Values: {ON, OFF}."
38-
${PROJECT_IS_TOP_LEVEL})
39-
40-
if(BEMAN_ITERATOR_INTERFACE_USE_DEDUCING_THIS
41-
AND NOT COMPILER_SUPPORTS_DEDUCING_THIS)
42-
message(
43-
WARNING
44-
"Building with C++23 \"deducing this\" feature (P0847R7) despite of the compiler's lack of actual support for it."
45-
)
30+
BEMAN_ITERATOR_INTERFACE_BUILD_TESTS
31+
"Enable building tests and test infrastructure. Default: ON. Values: {ON, OFF}."
32+
${PROJECT_IS_TOP_LEVEL}
33+
)
34+
35+
option(
36+
BEMAN_ITERATOR_INTERFACE_BUILD_EXAMPLES
37+
"Enable building examples. Default: ON. Values: {ON, OFF}."
38+
${PROJECT_IS_TOP_LEVEL}
39+
)
40+
41+
if(
42+
BEMAN_ITERATOR_INTERFACE_USE_DEDUCING_THIS
43+
AND NOT COMPILER_SUPPORTS_DEDUCING_THIS
44+
)
45+
message(
46+
WARNING
47+
"Building with C++23 \"deducing this\" feature (P0847R7) despite of the compiler's lack of actual support for it."
48+
)
4649
endif()
4750

4851
configure_file(
49-
"${PROJECT_SOURCE_DIR}/include/beman/iterator_interface/config.hpp.in"
50-
"${PROJECT_BINARY_DIR}/include/beman/iterator_interface/config.hpp" @ONLY)
52+
"${PROJECT_SOURCE_DIR}/include/beman/iterator_interface/config.hpp.in"
53+
"${PROJECT_BINARY_DIR}/include/beman/iterator_interface/config.hpp"
54+
@ONLY
55+
)
5156

5257
if(BEMAN_ITERATOR_INTERFACE_BUILD_TESTS)
53-
# Fetch GoogleTest
54-
FetchContent_Declare(
55-
googletest
56-
EXCLUDE_FROM_ALL
57-
GIT_REPOSITORY https://github.com/google/googletest.git
58-
GIT_TAG e39786088138f2749d64e9e90e0f9902daa77c40 # release-1.15.0
59-
)
60-
FetchContent_MakeAvailable(googletest)
58+
# Fetch GoogleTest
59+
FetchContent_Declare(
60+
googletest
61+
EXCLUDE_FROM_ALL
62+
GIT_REPOSITORY https://github.com/google/googletest.git
63+
GIT_TAG
64+
e39786088138f2749d64e9e90e0f9902daa77c40 # release-1.15.0
65+
)
66+
FetchContent_MakeAvailable(googletest)
6167
endif()
6268

6369
# Create the library target and named header set for beman.iterator_interface
6470
add_library(beman.iterator_interface STATIC)
6571
add_library(beman::iterator_interface ALIAS beman.iterator_interface)
6672

6773
target_sources(
68-
beman.iterator_interface
69-
PUBLIC FILE_SET
70-
beman_iterator_interface_headers
71-
TYPE
72-
HEADERS
73-
BASE_DIRS
74-
${PROJECT_BINARY_DIR}/include
75-
${PROJECT_SOURCE_DIR}/include
76-
FILES
77-
${PROJECT_BINARY_DIR}/include/beman/iterator_interface/config.hpp)
74+
beman.iterator_interface
75+
PUBLIC
76+
FILE_SET beman_iterator_interface_headers
77+
TYPE HEADERS
78+
BASE_DIRS ${PROJECT_BINARY_DIR}/include ${PROJECT_SOURCE_DIR}/include
79+
FILES ${PROJECT_BINARY_DIR}/include/beman/iterator_interface/config.hpp
80+
)
7881

7982
add_subdirectory(src/beman/iterator_interface)
8083
add_subdirectory(include/beman/iterator_interface)
8184

8285
if(BEMAN_ITERATOR_INTERFACE_BUILD_TESTS)
83-
enable_testing()
84-
add_subdirectory(tests/beman/iterator_interface)
86+
enable_testing()
87+
add_subdirectory(tests/beman/iterator_interface)
8588
endif()
8689

8790
if(BEMAN_ITERATOR_INTERFACE_BUILD_EXAMPLES)
88-
add_subdirectory(examples)
91+
add_subdirectory(examples)
8992
endif()
9093

9194
# Coverage
9295
configure_file("cmake/gcovr.cfg.in" gcovr.cfg @ONLY)
9396

9497
add_custom_target(
95-
process_coverage
96-
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
97-
COMMENT "Running gcovr to process coverage results"
98-
COMMAND mkdir -p coverage
99-
COMMAND gcovr --config gcovr.cfg .)
98+
process_coverage
99+
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
100+
COMMENT "Running gcovr to process coverage results"
101+
COMMAND mkdir -p coverage
102+
COMMAND gcovr --config gcovr.cfg .
103+
)

README.md

Lines changed: 43 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -18,24 +18,32 @@ Source is licensed with the Apache 2.0 license with LLVM exceptions
1818

1919
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
2020

21-
Documentation and associated papers are licensed with the Creative Commons Attribution 4.0 International license.
21+
Documentation and associated papers are licensed with the Creative Commons
22+
Attribution 4.0 International license.
2223

2324
// SPDX-License-Identifier: CC-BY-4.0
2425

25-
The intent is that the source and documentation are available for use by people implementing their iterator types.
26+
The intent is that the source and documentation are available for use by people
27+
implementing their iterator types.
2628

27-
The README itself is licensed with CC0 1.0 Universal. Copy the contents and incorporate in your own work as you see fit.
29+
The README itself is licensed with CC0 1.0 Universal. Copy the contents and
30+
incorporate in your own work as you see fit.
2831

2932
// SPDX-License-Identifier: CC0-1.0
3033

3134
## Examples
3235

33-
Full runnable examples can be found in `examples/` - please check [examples/README.md](./examples/README.md) for building the code on local setup or on Compiler Explorer.
36+
Full runnable examples can be found in `examples/` - please check
37+
[examples/README.md](./examples/README.md) for building the code on local setup
38+
or on Compiler Explorer.
3439

3540
### Repeated Chars Iterator
3641

37-
The next code snippet shows iterator interface support added in [`std::iterator_interface` (P2727R)](https://wg21.link/P2727R4): define a random access iterator that iterates over a sequence of characters repeated indefinitely.
42+
The next code snippet shows iterator interface support added in
43+
[`std::iterator_interface` (P2727R)](https://wg21.link/P2727R4): define a random
44+
access iterator that iterates over a sequence of characters repeated indefinitely.
3845

46+
<!-- markdownlint-disable -->
3947
```cpp
4048
#include <beman/iterator_interface/iterator_interface.hpp>
4149

@@ -87,11 +95,16 @@ std::copy(it_first, it_last, std::back_inserter(extracted_result));
8795
assert(extracted_result.size() == len);
8896
std::cout << extracted_result << "\n"; // Expected output at STDOUT: "foofoof"
8997
```
98+
<!-- markdownlint-enable -->
9099
91100
### Filter Integer Iterator
92101
93-
The next code snippet shows iterator interface support added in [`std::iterator_interface` (P2727R4)](https://wg21.link/P2727R4): define a forward iterator that iterates over a sequence of integers, skipping those that do not satisfy a predicate.
102+
The next code snippet shows iterator interface support added in
103+
[`std::iterator_interface` (P2727R4)](https://wg21.link/P2727R4): define a
104+
forward iterator that iterates over a sequence of integers, skipping those that
105+
do not satisfy a predicate.
94106
107+
<!-- markdownlint-disable -->
95108
```cpp
96109
#include <beman/iterator_interface/iterator_interface.hpp>
97110
@@ -116,19 +129,21 @@ while (*it) {
116129
}
117130
std::cout << "\n";
118131
```
132+
<!-- markdownlint-enable -->
119133

120134
## How to Build
121135

122136
### Compiler Support
123137

124-
This is a modern C++ project which can be compiled with the latest C++ standards (**C++20 or later**).
138+
This is a modern C++ project which can be compiled with the latest C++ standards
139+
(**C++20 or later**).
125140

126141
Default build: `C++23`. Please check `etc/${compiler}-flags.cmake`.
127142

128143
### Dependencies
129144

130-
This project is mainly tested on `Ubuntu 22.04` and `Ubuntu 24.04`, but it should be as portable as CMake is. This
131-
project has no C or C++ dependencies.
145+
This project is mainly tested on `Ubuntu 22.04` and `Ubuntu 24.04`, but it
146+
should be as portable as CMake is. This project has no C or C++ dependencies.
132147

133148
Build-time dependencies:
134149

@@ -152,9 +167,11 @@ apt-get install \
152167

153168
#### Preset CMake Workflows
154169

155-
This project strives to be as normal and simple a CMake project as possible. This build workflow in particular will
156-
work, producing a static `beman.iterator_interface` library, ready to package:
170+
This project strives to be as normal and simple a CMake project as possible. This
171+
build workflow in particular will work, producing a static
172+
`beman.iterator_interface` library, ready to package:
157173

174+
<!-- markdownlint-disable -->
158175
```shell
159176
$ cmake --workflow --preset gcc-debug
160177
$ cmake --workflow --preset gcc-release
@@ -183,10 +200,12 @@ $ tree /opt/beman.iterator_interface
183200

184201
<details>
185202
<summary> Build beman.iterator_interface (verbose logs - gcc-debug) </summary>
203+
<!-- markdownlint-enable -->
186204

205+
This should build and run the tests with system GCC with the address and
206+
undefined behavior sanitizers enabled.
187207

188-
This should build and run the tests with system GCC with the address and undefined behavior sanitizers enabled.
189-
208+
<!-- markdownlint-disable -->
190209
```shell
191210
$ cmake --workflow --preset gcc-debug
192211
Executing workflow step 1 of 3: configure preset "gcc-debug"
@@ -239,10 +258,11 @@ Test project /path/to/repo/.build/gcc-debug
239258

240259
Total Test time (real) = 0.04 sec
241260
```
261+
<!-- markdownlint-enable -->
242262

243263
</details>
244264

245-
265+
<!-- markdownlint-disable -->
246266
<details>
247267
<summary> Install beman.iterator_interface (verbose logs - gcc-release) </summary>
248268

@@ -332,8 +352,8 @@ $ tree /opt/beman.iterator_interface
332352
└── libbeman.iterator_interface.a
333353

334354
8 directories, 9 files
335-
336355
```
356+
<!-- markdownlint-enable -->
337357

338358
</details>
339359

@@ -342,6 +362,7 @@ $ tree /opt/beman.iterator_interface
342362
##### Default Build
343363

344364
CI current build and test flows:
365+
345366
```shell
346367
# Configure.
347368
$ cmake -G "Ninja Multi-Config" \
@@ -391,8 +412,10 @@ $ tree /opt/beman.iterator_interface
391412
8 directories, 9 files
392413
```
393414

415+
<!-- markdownlint-disable -->
394416
<details>
395417
<summary> Build beman.iterator_interface and tests (verbose logs) </summary>
418+
<!-- markdownlint-enable -->
396419

397420
```shell
398421
# Configure build: default build production code + tests (BEMAN_ITERATOR_INTERFACE_BUILD_TESTING=ON).
@@ -418,11 +441,13 @@ Test project /path/to/repo/.build
418441

419442
Total Test time (real) = 0.67 sec
420443
```
444+
421445
</details>
422446

423447
##### Skip Tests
424448

425-
By default, we build and run tests. You can provide `-DBEMAN_ITERATOR_INTERFACE_BUILD_TESTING=OFF` and completely disable building tests:
449+
By default, we build and run tests. You can provide
450+
`-DBEMAN_ITERATOR_INTERFACE_BUILD_TESTING=OFF` and completely disable building tests:
426451

427452
```shell
428453
# Configure.
@@ -435,7 +460,8 @@ $ cmake -G "Ninja Multi-Config" \
435460

436461
##### Skip Examples
437462

438-
By default, we build and run tests. You can provide `-DBEMAN_ITERATOR_INTERFACE_BUILD_EXAMPLES=OFF` and completely disable building tests:
463+
By default, we build and run tests. You can provide
464+
`-DBEMAN_ITERATOR_INTERFACE_BUILD_EXAMPLES=OFF` and completely disable building tests:
439465

440466
```shell
441467
# Configure.
@@ -445,4 +471,3 @@ $ cmake -G "Ninja Multi-Config" \
445471
-DBEMAN_ITERATOR_INTERFACE_BUILD_EXAMPLES=OFF \
446472
-B .build -S .
447473
```
448-

cmake/CompilerFeatureTest.cmake

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ include(CheckCXXSourceCompiles)
1010
# Determines if the selected C++ compiler has deducing this support. Sets
1111
# 'result_var' to whether support is detected.
1212
function(beman_iterator_check_deducing_this result_var)
13-
check_cxx_source_compiles( "
13+
check_cxx_source_compiles(
14+
"
1415
// clang-specific check due to http://github.com/llvm/llvm-project/issues/113174
1516
// MSVC-specific check due to https://developercommunity.visualstudio.com/t/10107077
1617
#if defined(__cpp_explicit_this_parameter)
@@ -26,6 +27,8 @@ function(beman_iterator_check_deducing_this result_var)
2627
#endif
2728
#endif
2829
int main(){}
29-
" HAVE_DEDUCING_THIS )
30-
set(${result_var} ${HAVE_DEDUCING_THIS} PARENT_SCOPE)
30+
"
31+
HAVE_DEDUCING_THIS
32+
)
33+
set(${result_var} ${HAVE_DEDUCING_THIS} PARENT_SCOPE)
3134
endfunction()

0 commit comments

Comments
 (0)