mit-dci / opencbdc-tx

A transaction processor for a hypothetical, general-purpose, central bank digital currency
Other
896 stars 198 forks source link

clang format script added to auto-format C++ code; fixes #293 #294

Closed rockett-m closed 1 month ago

rockett-m commented 1 month ago

PR described in #293 [WIP] This will lead to far less clang style errors vs before (so faster CI/CD lint stage) and prettier code.

We could consider splitting the lint github workflow stage into just style checks (newline/whitespace/format) separate from the clang tidy check which is more intensive and about C++ 20 features. Open to discussion.

The script is minimal, and I added it as a bare-bones version, but if we like this, I can optimize it to be more robust.

Edit: clang18 was the linked version in mac/homebrew so I had to override that.

brew uninstall --ignore-dependencies llvm
brew [re]install llvm@14

~/.zshrc
export PATH="/usr/local/opt/llvm@14/bin:$PATH"
LDFLAGS="-L/opt/homebrew/opt/llvm@14/lib/c++ -Wl,-rpath,/opt/homebrew/opt/llvm@14/lib/c++"
export LDFLAGS="-L/opt/homebrew/opt/llvm@14/lib"
export CPPFLAGS="-I/opt/homebrew/opt/llvm@14/include"