Skip to content

Commit 1bd8b1d

Browse files
committed
style: adding clang-format as manual hook
1 parent 7b7ec66 commit 1bd8b1d

File tree

3 files changed

+36
-2
lines changed

3 files changed

+36
-2
lines changed

.clang-format

Lines changed: 21 additions & 0 deletions
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

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,3 +98,14 @@ repos:
9898
types:
9999
- c++
100100
entry: ./tools/check-style.sh
101+
102+
- id: docker-clang-format
103+
stages: [manual]
104+
name: Docker Clang Format
105+
language: docker_image
106+
types:
107+
- c++
108+
entry: unibeautify/clang-format:latest
109+
args:
110+
- -style=file
111+
- -i

include/pybind11/iostream.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,10 @@ PYBIND11_NAMESPACE_END(detail)
104104
.. code-block:: cpp
105105
106106
{
107-
py::scoped_ostream_redirect output{std::cerr, py::module_::import("sys").attr("stderr")};
108-
std::cerr << "Hello, World!";
107+
py::scoped_ostream_redirect output{
108+
std::cerr,
109+
py::module::import("sys").attr("stderr")
110+
};
109111
}
110112
\endrst */
111113
class scoped_ostream_redirect {

0 commit comments

Comments
 (0)