Skip to content

Commit 38e376c

Browse files
authored
Check and format json and c++ files (#103)
* Check and format json and c++ files * Enable more checks * Add pre-commint actions to CI
1 parent 713bfd4 commit 38e376c

Some content is hidden

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

52 files changed

+120
-130
lines changed

.devcontainer/devcontainer.json

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,15 @@
1-
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
2-
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
3-
// README at: https://github.com/devcontainers/templates/tree/main/src/cpp
4-
5-
{
6-
"name": "Beman Project Generic Devcontainer",
7-
"build": {
8-
"dockerfile": "Dockerfile"
9-
},
10-
"postCreateCommand": "bash .devcontainer/postcreate.sh",
11-
"customizations": {
12-
"vscode": {
13-
"extensions": [
14-
"ms-vscode.cpptools",
15-
"ms-vscode.cmake-tools"
16-
]
17-
}
18-
}
1+
{
2+
"name": "Beman Project Generic Devcontainer",
3+
"build": {
4+
"dockerfile": "Dockerfile"
5+
},
6+
"postCreateCommand": "bash .devcontainer/postcreate.sh",
7+
"customizations": {
8+
"vscode": {
9+
"extensions": [
10+
"ms-vscode.cpptools",
11+
"ms-vscode.cmake-tools"
12+
]
1913
}
14+
}
15+
}

.pre-commit-config.yaml

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,21 @@ repos:
44
- repo: https://github.com/pre-commit/pre-commit-hooks
55
rev: v5.0.0
66
hooks:
7-
# TODO: - id: trailing-whitespace
8-
# TODO: - id: end-of-file-fixer
9-
# FIXME: - id: check-yaml
7+
- id: trailing-whitespace
8+
- id: end-of-file-fixer
9+
- id: check-json
10+
- id: check-yaml
11+
exclude: ^\.clang-(format|tidy)$
1012
- id: check-added-large-files
1113

12-
# TODO: Clang-format for C++
1314
# This brings in a portable version of clang-format.
1415
# See also: https://github.com/ssciwr/clang-format-wheel
15-
# - repo: https://github.com/pre-commit/mirrors-clang-format
16-
# rev: v19.1.4
17-
# hooks:
18-
# - id: clang-format
19-
# types_or: [c++, c, json]
16+
- repo: https://github.com/pre-commit/mirrors-clang-format
17+
rev: v19.1.4
18+
hooks:
19+
- id: clang-format
20+
types_or: [c++, c, json]
21+
exclude: docs/TODO.json
2022

2123
# TODO: CMake linting and formatting
2224
# - repo: https://github.com/BlankSpruce/gersemi

docs/TODO.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# ToDo
1+
# ToDo
22

33
| Section | Code | Test | Doc | Comment |
44
| ------- |:----:|:----:|:---:| ------- |

docs/dependency.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -515,4 +515,4 @@ when_all_with_variant into_variant
515515
when_all_with_variant when_all
516516
with_awaitable_senders as_awaitable
517517
write_env make_sender
518-
write_env queryable
518+
write_env queryable

docs/overview.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ When an asynchronous operation completes it _signals_ its completion by calling
2020
<details>
2121
<summary>environment</summary>
2222
The term _enviroment_ refers to the bag of properties associated with an <code>_object_</code> by the call <code><a href=‘#get-env’>std::execution::get_env</a>(_object_)</code>. By default the environment for objects is empty (<code><a href=‘#empty-env’>std::execution::empty_env</a></code>). In particular, environments associated with <code><a href=‘#receiver’>receiver</a></code>s are used to provide access to properties like the <a href=‘#get-stop-token’>stop token</a>, <a href=‘#get-scheduler’>scheduler</a>, or <a href=‘#get-allocator’>allocator</a> associated with the <code><a href=‘#receiver’>receiver</a></code>. The various properties associated with an object are accessed via <a href=‘#queries’>queries</a>.
23-
</details>
23+
</details>
2424

2525
## Concepts
2626
This section lists the concepts from `std::execution`.
@@ -46,15 +46,15 @@ struct example_state
4646
{
4747
using operation_state_concept = std::execution::operation_state_t;
4848
std::remove_cvref_t<Receiver> receiver;
49-
49+
5050
auto start() & noexcept {
5151
std::execution::set_value(std::move(this->receiver));
5252
}
5353
};
5454

5555
static_assert(std::execution::operation_state<example_state<SomeReceiver>>);
5656
```
57-
</details>
57+
</details>
5858
</details>
5959
<details>
6060
<summary><code>receiver&lt;<i>Receiver</i>&gt;</code></summary>
@@ -90,7 +90,7 @@ struct example_receiver
9090
{
9191
using receiver_concept = std::execution::receiver_t;
9292
std::remove_cvref_t<NestedReceiver> nested;
93-
93+
9494
auto get_env() const noexcept {
9595
return std::execution::get_env(this->nested);
9696
}
@@ -112,7 +112,7 @@ struct example_receiver
112112
113113
static_assert(std::execution::receiver<example_receiver<SomeReceiver>>);
114114
```
115-
</details>
115+
</details>
116116
</details>
117117
<details>
118118
<summary><code>receiver_of&lt;<i>Receiver, Completions</i>&gt;</code></summary>
@@ -129,7 +129,7 @@ The example defines a simple <code><a href=‘#receiver’>receiver</a></code> a
129129
struct example_receiver
130130
{
131131
using receiver_concept = std::execution::receiver_t;
132-
132+
133133
auto set_value(int) && noexcept ->void {}
134134
auto set_stopped() && noexcept ->void {}
135135
};
@@ -141,7 +141,7 @@ static_assert(std::execution::receiver_of<example_receiver,
141141
std::execution::set_value_t(int),
142142
std::execution::set_stopped_t()
143143
>);
144-
// providing a superset of signal models models receiver_of:
144+
// providing a superset of signal models models receiver_of:
145145
static_assert(std::execution::receiver_of<example_receiver,
146146
std::execution::completion_signals<
147147
std::execution::set_value_t(int)
@@ -211,7 +211,7 @@ struct example_sender
211211
using completion_signatures = std::execution::completion_signatures<
212212
std::execution::set_value_t(int)
213213
>;
214-
214+
215215
int value{};
216216
template <std::execution::receiver Receiver>
217217
auto connect(Receiver&& receiver) const -> state<Receiver> {
@@ -238,7 +238,7 @@ To determine if <code>_Receiver_</code> can receive all <a href=‘#completion-s
238238
<details>
239239
<summary><code>sends_stopped&lt;<i>Sender, Env</i> = std::execution::empty_env&gt;</code></summary>
240240

241-
The concept <code>sends_stopped&lt;<i>Sender, Env</i>&gt;</code> determines if <code>_Sender_</code> may send a <code><a href=‘#set_stopped’>stopped</a></code> <a href=‘#completion-signals’>completion signal</a>. To do so, the concepts determines if <code><a href=‘#get_completion_signals’>std::execution::get_completion_signals</a>(_sender_, _env_)</code> contains the signatures <code><a href=‘#set_stopped’>std::execution::set_stopped_t</a>()</code>.
241+
The concept <code>sends_stopped&lt;<i>Sender, Env</i>&gt;</code> determines if <code>_Sender_</code> may send a <code><a href=‘#set_stopped’>stopped</a></code> <a href=‘#completion-signals’>completion signal</a>. To do so, the concepts determines if <code><a href=‘#get_completion_signals’>std::execution::get_completion_signals</a>(_sender_, _env_)</code> contains the signatures <code><a href=‘#set_stopped’>std::execution::set_stopped_t</a>()</code>.
242242
</details>
243243
<details>
244244
<summary><code>stoppable_token&lt;_Token_&gt;</code></summary>
@@ -284,7 +284,7 @@ void compute(std::stoppable_token auto token)
284284
<summary>Example: inactive</summary>
285285
<blockquote>
286286
This example shows how an <code><a href=‘#operation-state’>operation_state</a></code> can use the <code>callback_type</code> together with a <code>_token_</code> to get notified when cancellation is requested.
287-
287+
288288
```c++
289289
template <std::execution::receiver Receiver>
290290
struct example_state
@@ -328,7 +328,7 @@ struct example_state
328328
std::execution::set_value(std::move(this->receiver));
329329
}
330330
}
331-
};
331+
};
332332
```
333333
</blockquote>
334334
</details>

docs/questions.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,4 +49,4 @@ likely observable.
4949
- [exec.when.all] uses on-stop-request without saying what it actually does.
5050
most likely on-stop-request is supposed to call stop_src.request_stop
5151
- [exec.when.all] p11.1 uses a non-existing conversion for tuple to implement its "tie"
52-
actually, that one may be new in C++23!
52+
actually, that one may be new in C++23!

examples/doc-just.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@ int main() {
1111
auto result = ex::sync_wait(ex::just(17, "hello"s, true));
1212
assert(result);
1313
assert(*result == std::tuple(17, "hello"s, true));
14-
}
14+
}

examples/doc-just_error.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@ int main() {
1414
had_error = true;
1515
}));
1616
assert(had_error);
17-
}
17+
}

examples/doc-just_stopped.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@ int main() {
1212

1313
auto result = ex::sync_wait(ex::just_stopped() | ex::upon_stopped([&] { stopped = true; }));
1414
assert(stopped);
15-
}
15+
}

0 commit comments

Comments
 (0)