Skip to content

Commit 0ed0781

Browse files
Smit1603vgvassilev
authored andcommitted
Ensure git clang-format runs on PR
1 parent b5507f7 commit 0ed0781

File tree

4 files changed

+48
-2
lines changed

4 files changed

+48
-2
lines changed

.clang-format

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,17 @@
11
BasedOnStyle: LLVM
22

3+
Language: Cpp
4+
Standard: Cpp11
5+
PointerAlignment: Left
6+
7+
IncludeCategories:
8+
- Regex: '^"[^/]+\"'
9+
Priority: 10
10+
- Regex: '^"cling/'
11+
Priority: 20
12+
- Regex: '^"clang/'
13+
Priority: 30
14+
- Regex: '^"llvm/'
15+
Priority: 40
16+
- Regex: '^<'
17+
Priority: 50

.github/workflows/ci.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,37 @@ concurrency:
1414
cancel-in-progress: true
1515

1616
jobs:
17+
precheckin:
18+
runs-on: ubuntu-22.04
19+
steps:
20+
- name: Checkout PR branch
21+
uses: actions/checkout@v3
22+
with:
23+
ref: ${{ github.event.pull_request.head.sha }}
24+
fetch-depth: 0
25+
- name: Setup Python
26+
uses: actions/setup-python@v4
27+
with:
28+
python-version: 3.7
29+
- name: Install clang-format
30+
run: |
31+
curl https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
32+
echo "deb https://apt.llvm.org/jammy/ llvm-toolchain-jammy-15 main" | sudo tee -a /etc/apt/sources.list
33+
sudo apt update
34+
sudo apt install -y clang-format-15
35+
- name: Download git-clang-format
36+
run: |
37+
wget https://raw.githubusercontent.com/llvm/llvm-project/main/clang/tools/clang-format/git-clang-format
38+
chmod +x git-clang-format
39+
- name: Run git-clang-format
40+
run: |
41+
git \
42+
-c color.ui=always \
43+
-c diff.wsErrorHighlight=all \
44+
-c color.diff.whitespace='red reverse' \
45+
clang-format-15 --diff --binary clang-format-15 origin/main -- include/ lib/ || \
46+
(echo "Please run the following git-clang-format locally to fix the formatting: \n
47+
git clang-format origin/main -- include/ lib/" && exit 1)
1748
build:
1849
name: ${{ matrix.name }}
1950
runs-on: ${{ matrix.os }}

lib/Interpreter/CppInterOp.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2833,7 +2833,7 @@ namespace Cpp {
28332833
(*wrapper)(This, /*nary=*/0, withFree);
28342834
return;
28352835
}
2836-
// FIXME: Diagnose.
28372836
}
2837+
// FIXME: Diagnose.
28382838

28392839
} // end namespace Cpp

unittests/CppInterOp/ScopeReflectionTest.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -694,7 +694,7 @@ TEST(ScopeReflectionTest, InstantiateNNTPClassTemplate) {
694694
enum { value = 1 };
695695
};)";
696696

697-
ASTContext &C = Interp->getCI()->getASTContext();
697+
ASTContext& C = Interp->getCI()->getASTContext();
698698
GetAllTopLevelDecls(code, Decls);
699699

700700
Cpp::TCppType_t IntTy = C.IntTy.getAsOpaquePtr();

0 commit comments

Comments
 (0)