Skip to content

Commit

Permalink
add format.sh add CPPLINT.cfg
Browse files Browse the repository at this point in the history
  • Loading branch information
jakoch committed Jun 20, 2024
1 parent eae9a82 commit edc2491
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 0 deletions.
26 changes: 26 additions & 0 deletions CPPLINT.cfg
Original file line number Diff line number Diff line change
@@ -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
14 changes: 14 additions & 0 deletions format.sh
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit edc2491

Please sign in to comment.