From edc24919e2210659b4e4e8077055d8be50a118fd Mon Sep 17 00:00:00 2001 From: "Jens A. Koch" Date: Thu, 20 Jun 2024 21:45:39 +0200 Subject: [PATCH] add format.sh add CPPLINT.cfg --- CPPLINT.cfg | 26 ++++++++++++++++++++++++++ format.sh | 14 ++++++++++++++ 2 files changed, 40 insertions(+) create mode 100644 CPPLINT.cfg create mode 100644 format.sh diff --git a/CPPLINT.cfg b/CPPLINT.cfg new file mode 100644 index 0000000..8806751 --- /dev/null +++ b/CPPLINT.cfg @@ -0,0 +1,26 @@ +# Do not search for other config files. +set noparent + +# You have 30 inch TFTs at the Google HQ. Stop using 80. +linelength=120 +includeorder=standardcfirst + +# +# You can list all filters with: +# cpplint --filter=. +# ------------------------------------------------------- + +# Disable is an unapproved C++11 header warnings +filter=-build/c++11 + +filter=+build/include_what_you_use +filter=+build/include_alpha +filter=-build/include_order +filter=-build/include_subdir + +filter=-runtime/references + +filter=-whitespace + +exclude_files=src/steamapi/steamapi.cpp +exclude_files=src/steamapi/steamapi.h diff --git a/format.sh b/format.sh new file mode 100644 index 0000000..7cd0a53 --- /dev/null +++ b/format.sh @@ -0,0 +1,14 @@ +#!/usr/bin/env bash + +# allow ENV.CLANG_FORMAT to define the path to the binary or default to clang-format +CLANG_FORMAT=${CLANG_FORMAT:-clang-format} + +# require clang-format 17 to have consistent formatting features +$CLANG_FORMAT --version +if [[ ! $($CLANG_FORMAT --version) =~ "version 17" ]]; then + echo "Error: clang-format version must be 17" + exit 1 +fi + +find src -name *.h -o -name *.cpp -exec dos2unix {} \; +find src -name *.h -o -name *.cpp|xargs $CLANG_FORMAT -i -style=file