Skip to content

Commit

Permalink
Preserve C++ include order (#43)
Browse files Browse the repository at this point in the history
  • Loading branch information
artnc authored Dec 12, 2024
1 parent 609a290 commit 11b3af2
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 1 deletion.
4 changes: 4 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
BasedOnStyle: Google

# Sorting includes is dangerous and can break compilation
SortIncludes: Never
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
*
!.clang-format
!.editorconfig
!entry.ts
!ruff.toml
Expand Down
2 changes: 1 addition & 1 deletion entry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ const HOOKS: Record<HookName, LockableHook> = {
run(
"/clang-format",
"-i", // Edit files in-place
"--style=Google",
"--style=file:/.clang-format",
...sources,
),
include: /\.(cpp|proto$)/,
Expand Down
1 change: 1 addition & 0 deletions test/after/hello.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include <iostream>
#include <cmath>

int main() {
std::cout << "Hello world";
Expand Down
1 change: 1 addition & 0 deletions test/before/hello.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#include <iostream>
#include <cmath>

int main ( ){std::cout<<"Hello world";return 0 ;}

0 comments on commit 11b3af2

Please sign in to comment.