Skip to content

Commit 6e56b07

Browse files
committed
Configure clang-format
1 parent 10ef6c8 commit 6e56b07

File tree

4 files changed

+20
-8
lines changed

4 files changed

+20
-8
lines changed

.clang-format

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
# A clang-format style that approximates Python's PEP 7
22
# Useful for IDE integration
3+
# https://clang.llvm.org/docs/ClangFormatStyleOptions.html#configurable-format-style-options
4+
Language: Cpp
35
BasedOnStyle: Google
4-
AllowShortIfStatementsOnASingleLine: false
6+
57
AlignAfterOpenBracket: Align
8+
AllowShortIfStatementsOnASingleLine: false
9+
AlwaysBreakAfterReturnType: None # Don't break after return type
610
BreakBeforeBraces: Stroustrup
711
ColumnLimit: 120
812
DerivePointerAlignment: false
913
IndentWidth: 4
10-
Language: Cpp
1114
PointerAlignment: Right
1215
ReflowComments: true
16+
SortIncludes: false # Sorting includes breaks build
1317
SpaceBeforeParens: ControlStatements
1418
SpacesInParentheses: false
1519
TabWidth: 4
1620
UseTab: Never
17-
# sorting includes breaks build
18-
SortIncludes: false
19-
# don't break after return type
20-
AlwaysBreakAfterReturnType: None

.github/workflows/main.yml

+5-1
Original file line numberDiff line numberDiff line change
@@ -110,14 +110,18 @@ jobs:
110110
python-version: "3.8"
111111
cache: pip
112112
cache-dependency-path: .github/workflows/main.yml
113-
- run: pip install pycln
113+
- run: pip install clang-format pycln
114114
- run: pycln . --config=pycln.toml --check
115115
- uses: chartboost/ruff-action@v1
116116
with:
117117
version: "0.4.5"
118118
- uses: psf/black@stable
119119
with:
120120
options: "--fast --check --diff --verbose"
121+
- run: | # Too many files to fit in a single command, exclude vendored Scintilla and mapi_headers
122+
clang-format --Werror --dry-run $(git ls-files '*.cpp')
123+
clang-format --Werror --dry-run $(git ls-files '*.h' ':!:Pythonwin/Scintilla/' ':!:com/win32comext/mapi/src/mapi_headers/')
124+
shell: powershell
121125
122126
mypy:
123127
runs-on: windows-2019

.pre-commit-config.yaml

+8
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,14 @@ repos:
3434
hooks:
3535
- id: black
3636
verbose: true
37+
- repo: https://github.com/pre-commit/mirrors-clang-format
38+
rev: v18.1.5
39+
hooks:
40+
- id: clang-format
41+
# Supports a lot more filetypes, but only tagging those we use
42+
# https://github.com/pre-commit/mirrors-clang-format/blob/main/.pre-commit-hooks.yaml#L6
43+
types: [c++]
44+
3745

3846
# Vendored
3947
exclude: ^(com/win32comext/mapi/src/mapi_headers/|Pythonwin/Scintilla/).*$

win32/test/test_win32gui.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ def enum_callback_sle(cls, handle, data):
7272

7373
@classmethod
7474
def enum_callback_exc(cls, handle, data):
75-
raise ValueError()
75+
raise ValueError
7676

7777
@classmethod
7878
def enum_callback(cls, handle, data):

0 commit comments

Comments
 (0)