Skip to content

Commit fa9d67a

Browse files
committed
style: adding clang-format as manual hook
1 parent aab7013 commit fa9d67a

File tree

3 files changed

+39
-1
lines changed

3 files changed

+39
-1
lines changed

.clang-format

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
---
2+
# See all possible options and defaults with:
3+
# clang-format --style=llvm --dump-config
4+
BasedOnStyle: LLVM
5+
AccessModifierOffset: -4
6+
AlignConsecutiveAssignments: true
7+
AlwaysBreakTemplateDeclarations: Yes
8+
BinPackArguments: false
9+
BinPackParameters: false
10+
BreakBeforeBinaryOperators: All
11+
BreakConstructorInitializers: BeforeColon
12+
ColumnLimit: 99
13+
IndentCaseLabels: true
14+
IndentPPDirectives: AfterHash
15+
IndentWidth: 4
16+
Language: Cpp
17+
SpaceAfterCStyleCast: true
18+
# SpaceInEmptyBlock: true # too new
19+
Standard: Cpp11
20+
TabWidth: 4
21+
...

.pre-commit-config.yaml

+14
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,17 @@ repos:
3434
types:
3535
- c++
3636
entry: ./tools/check-style.sh
37+
38+
- id: docker-clang-format
39+
stages: [manual]
40+
name: Docker Clang Format
41+
language: docker_image
42+
types:
43+
- c++
44+
entry: unibeautify/clang-format:latest
45+
args:
46+
- -style=file
47+
- -i
48+
49+
50+

include/pybind11/iostream.h

+4-1
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,10 @@ PYBIND11_NAMESPACE_END(detail)
9595
.. code-block:: cpp
9696
9797
{
98-
py::scoped_ostream_redirect output{std::cerr, py::module::import("sys").attr("stderr")};
98+
py::scoped_ostream_redirect output{
99+
std::cerr,
100+
py::module::import("sys").attr("stderr")
101+
};
99102
std::cerr << "Hello, World!";
100103
}
101104
\endrst */

0 commit comments

Comments
 (0)