Commit fcf0d09
authored
Add a project
Scripts and workflows that run `clang-format` currently each add the
option `--style=google` to the invocation of `clang-format`. To follow
best practices, this PR adds a `.clang-format` configuration file at the
top level of the project to set the style, and removes the flag from
where it was added on the command line explicitly.
The use of a config file has the following benefits:
- It lets tools like IDEs discover the setting automatically.
- It reduces the chances that developers will forget to add the flag
when they run `clang-format` directly on the command line for quick
checks, or write new scripts that use `clang-format`.
- It communicates intentions more clearly to new contributors.
Removing the flag from the scripts is not strictly necessary (everything
will work the same if there is both a config file and the flag is passed
to `clang-format`). However, if a config file is used, it's better for
maintainability and consistency to also remove the flag from individual
invocations..clang-format config file (#1053)1 parent 8fb9489 commit fcf0d09
3 files changed
Lines changed: 8 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | | - | |
| 22 | + | |
23 | 23 | | |
24 | 24 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
| 7 | + | |
8 | 8 | | |
9 | | - | |
| 9 | + | |
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| |||
100 | 100 | | |
101 | 101 | | |
102 | 102 | | |
103 | | - | |
| 103 | + | |
104 | 104 | | |
105 | 105 | | |
106 | 106 | | |
| |||
0 commit comments