Skip to content

Commit acc07fc

Browse files
authored
Merge pull request #176 from scylladb/dk/makefile-add-clang-format
Makefile: add clang-format
2 parents af43106 + e8e0461 commit acc07fc

File tree

8 files changed

+489
-543
lines changed

8 files changed

+489
-543
lines changed

.clang-format

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
---
2+
BasedOnStyle: LLVM
3+
Language: Cpp
4+
Standard: Cpp03
5+
AccessModifierOffset: -2
6+
IndentWidth: 2
7+
TabWidth: 8
8+
ColumnLimit: 100
9+
UseTab: Never
10+
IndentCaseLabels: true
11+
AlignAfterOpenBracket: true
12+
AlignEscapedNewlines: Left
13+
BreakConstructorInitializers: BeforeComma
14+
AllowShortBlocksOnASingleLine: false
15+
DerivePointerAlignment: false
16+
PointerAlignment: Left
17+
BinPackParameters: true
18+
BinPackArguments: true
19+
AllowShortIfStatementsOnASingleLine: true
20+
CompactNamespaces: true
21+
AlignOperands: true
22+
SpacesInContainerLiterals: true
23+
ConstructorInitializerAllOnOneLineOrOnePerLine: false
24+
Cpp11BracedListStyle: false
25+
AlwaysBreakTemplateDeclarations: true
26+
BreakBeforeInheritanceComma: true
27+
...
28+

Makefile

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,12 @@ install-valgrind-if-missing: update-apt-cache-if-needed
9191
sudo snap install valgrind --classic;\
9292
)
9393

94+
install-clang-format-if-missing: update-apt-cache-if-needed
95+
@clang-format --version >/dev/null 2>&1 || (\
96+
echo "clang-format not found in the system, install it.";\
97+
sudo apt install -y clang-format;\
98+
)
99+
94100
install-ccm-if-missing:
95101
@ccm list >/dev/null 2>&1 || (\
96102
echo "CCM not found in the system, install it.";\
@@ -158,9 +164,17 @@ fix-cargo-fmt: install-cargo-if-missing _update-rust-tooling
158164
@echo "Running \"cargo fmt --verbose --all\" in ./scylla-rust-wrapper"
159165
@cd ${CURRENT_DIR}/scylla-rust-wrapper; cargo fmt --verbose --all
160166

161-
check: check-cargo check-cargo-clippy check-cargo-fmt
167+
check-clang-format: install-clang-format-if-missing
168+
@echo "Running \"clang-format --dry-run\" on all files in ./src"
169+
@find src -regextype posix-egrep -regex '.*\.(cpp|hpp|c|h)' -not -path 'src/third_party/*' | xargs clang-format --dry-run
170+
171+
fix-clang-format: install-clang-format-if-missing
172+
@echo "Running \"clang-format -i\" on all files in ./src"
173+
@find src -regextype posix-egrep -regex '.*\.(cpp|hpp|c|h)' -not -path 'src/third_party/*' | xargs clang-format -i
174+
175+
check: check-clang-format check-cargo check-cargo-clippy check-cargo-fmt
162176

163-
fix: fix-cargo fix-cargo-clippy fix-cargo-fmt
177+
fix: fix-clang-format fix-cargo fix-cargo-clippy fix-cargo-fmt
164178

165179
prepare-integration-test: update-apt-cache-if-needed install-valgrind-if-missing install-cargo-if-missing _update-rust-tooling
166180
@sudo sh -c "echo 2097152 >> /proc/sys/fs/aio-max-nr"

src/driver_info.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,7 @@
2626

2727
namespace datastax { namespace internal {
2828

29-
const char* driver_name() {
30-
return "Scylla Shard-Aware C/C++ Driver";
31-
}
29+
const char* driver_name() { return "Scylla Shard-Aware C/C++ Driver"; }
3230

3331
const char* driver_version() {
3432
if (strlen(CASS_VERSION_SUFFIX) == 0) {

src/macros.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
STATIC_ASSERT_CONCAT(STATIC_ASSERTION_FAILED_AT_LINE_, __LINE__); \
5353
}; \
5454
typedef StaticAssertTest<sizeof(STATIC_ASSERT_CONCAT(__static_assertion_at_line_, __LINE__))> \
55-
STATIC_ASSERT_CONCAT(__static_assertion_test_at_line_, __LINE__)
55+
STATIC_ASSERT_CONCAT(__static_assertion_test_at_line_, __LINE__)
5656

5757
template <bool>
5858
struct StaticAssert;

0 commit comments

Comments
 (0)