diff --git a/.clang-format b/.clang-format index b375ca28..63de3819 100644 --- a/.clang-format +++ b/.clang-format @@ -3,6 +3,7 @@ BasedOnStyle: Google Standard: Cpp03 AllowShortFunctionsOnASingleLine: Empty +IncludeBlocks: Preserve # Always break after if to get accurate coverage AllowShortIfStatementsOnASingleLine: false diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5b712be9..a917de7a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -3,8 +3,22 @@ name: Continuous Integration on: [push, pull_request] jobs: + clang-format: + name: Clang-Format + runs-on: ubuntu-20.04 + steps: + - name: Install + run: sudo apt-get install -y clang-format + - name: Checkout + uses: actions/checkout@v2 + - name: Format + run: find src/ extras/ -name '*.[ch]pp' | xargs clang-format -i --verbose --style=file + - name: Diff + run: git diff --exit-code + gcc: name: GCC + needs: clang-format runs-on: ubuntu-20.04 strategy: fail-fast: false @@ -51,6 +65,7 @@ jobs: clang: name: Clang + needs: clang-format runs-on: ubuntu-20.04 strategy: fail-fast: false diff --git a/extras/tests/catch/.clang-format b/extras/tests/catch/.clang-format new file mode 100644 index 00000000..9d159247 --- /dev/null +++ b/extras/tests/catch/.clang-format @@ -0,0 +1,2 @@ +DisableFormat: true +SortIncludes: false diff --git a/src/ArduinoJson/Object/ObjectImpl.hpp b/src/ArduinoJson/Object/ObjectImpl.hpp index 0794a674..97c6e8ce 100644 --- a/src/ArduinoJson/Object/ObjectImpl.hpp +++ b/src/ArduinoJson/Object/ObjectImpl.hpp @@ -54,7 +54,7 @@ template template inline typename enable_if::value, MemberProxy >::type - ObjectShortcuts::operator[](TString* key) const { +ObjectShortcuts::operator[](TString* key) const { return MemberProxy(*impl(), key); } @@ -62,7 +62,7 @@ template template inline typename enable_if::value, MemberProxy >::type - ObjectShortcuts::operator[](const TString& key) const { +ObjectShortcuts::operator[](const TString& key) const { return MemberProxy(*impl(), key); }