diff --git a/include/ArduinoJson/Internals/CompactJsonWriter.hpp b/include/ArduinoJson/Internals/CompactJsonWriter.hpp index c845e585..0279016e 100644 --- a/include/ArduinoJson/Internals/CompactJsonWriter.hpp +++ b/include/ArduinoJson/Internals/CompactJsonWriter.hpp @@ -27,4 +27,4 @@ class CompactJsonWriter : public JsonWriter { virtual void endObject() { _length += _sink->write('}'); } }; } -} \ No newline at end of file +} diff --git a/include/ArduinoJson/Internals/JsonNode.hpp b/include/ArduinoJson/Internals/JsonNode.hpp index 232ca096..951fcf78 100644 --- a/include/ArduinoJson/Internals/JsonNode.hpp +++ b/include/ArduinoJson/Internals/JsonNode.hpp @@ -161,4 +161,4 @@ class JsonNode { } }; } -} \ No newline at end of file +} diff --git a/include/ArduinoJson/Internals/JsonParser.hpp b/include/ArduinoJson/Internals/JsonParser.hpp index 8e1b3567..47c599be 100644 --- a/include/ArduinoJson/Internals/JsonParser.hpp +++ b/include/ArduinoJson/Internals/JsonParser.hpp @@ -38,4 +38,4 @@ class JsonParser { inline JsonNode *parseString(); }; } -} \ No newline at end of file +} diff --git a/include/ArduinoJson/Internals/PrettyJsonWriter.hpp b/include/ArduinoJson/Internals/PrettyJsonWriter.hpp index c27bf512..7975c641 100644 --- a/include/ArduinoJson/Internals/PrettyJsonWriter.hpp +++ b/include/ArduinoJson/Internals/PrettyJsonWriter.hpp @@ -57,4 +57,4 @@ class PrettyJsonWriter : public JsonWriter { } }; } -} \ No newline at end of file +} diff --git a/include/ArduinoJson/Internals/QuotedString.hpp b/include/ArduinoJson/Internals/QuotedString.hpp index 5d341dea..f144c658 100644 --- a/include/ArduinoJson/Internals/QuotedString.hpp +++ b/include/ArduinoJson/Internals/QuotedString.hpp @@ -17,4 +17,4 @@ class QuotedString { static char *extractFrom(char *input, char **end); }; } -} \ No newline at end of file +} diff --git a/include/ArduinoJson/Internals/StringBuilder.hpp b/include/ArduinoJson/Internals/StringBuilder.hpp index 8647fd1b..31a978a2 100644 --- a/include/ArduinoJson/Internals/StringBuilder.hpp +++ b/include/ArduinoJson/Internals/StringBuilder.hpp @@ -25,4 +25,4 @@ class StringBuilder : public Print { int length; }; } -} \ No newline at end of file +} diff --git a/include/ArduinoJson/JsonArrayIterator.hpp b/include/ArduinoJson/JsonArrayIterator.hpp index 885d9d3c..454be95e 100644 --- a/include/ArduinoJson/JsonArrayIterator.hpp +++ b/include/ArduinoJson/JsonArrayIterator.hpp @@ -32,4 +32,4 @@ class JsonArrayIterator { private: Internals::JsonNode *_node; }; -} \ No newline at end of file +} diff --git a/include/ArduinoJson/JsonBuffer.hpp b/include/ArduinoJson/JsonBuffer.hpp index c34c2802..26d3198f 100644 --- a/include/ArduinoJson/JsonBuffer.hpp +++ b/include/ArduinoJson/JsonBuffer.hpp @@ -47,4 +47,4 @@ class JsonBuffer { Internals::JsonNode *value); Internals::JsonNode *createStringNode(const char *value); }; -} \ No newline at end of file +} diff --git a/include/ArduinoJson/JsonContainer.hpp b/include/ArduinoJson/JsonContainer.hpp index 1ed83442..b3181e2f 100644 --- a/include/ArduinoJson/JsonContainer.hpp +++ b/include/ArduinoJson/JsonContainer.hpp @@ -49,4 +49,4 @@ class JsonContainer : public Printable, public Internals::JsonNodeWrapper { void removeChild(Internals::JsonNode *); Internals::JsonNode *createNode(); }; -} \ No newline at end of file +} diff --git a/include/ArduinoJson/JsonObject.hpp b/include/ArduinoJson/JsonObject.hpp index 4200131c..ea43c997 100644 --- a/include/ArduinoJson/JsonObject.hpp +++ b/include/ArduinoJson/JsonObject.hpp @@ -31,4 +31,4 @@ class JsonObject : public JsonContainer { private: Internals::JsonNode *getOrCreateNodeAt(const char *key); }; -} \ No newline at end of file +} diff --git a/include/ArduinoJson/JsonObjectIterator.hpp b/include/ArduinoJson/JsonObjectIterator.hpp index bace32df..10a67e04 100644 --- a/include/ArduinoJson/JsonObjectIterator.hpp +++ b/include/ArduinoJson/JsonObjectIterator.hpp @@ -38,4 +38,4 @@ class JsonObjectIterator { private: JsonObjectKeyValue _objectKeyValue; }; -} \ No newline at end of file +} diff --git a/include/ArduinoJson/JsonObjectKeyValue.hpp b/include/ArduinoJson/JsonObjectKeyValue.hpp index ff248e73..e02cb311 100644 --- a/include/ArduinoJson/JsonObjectKeyValue.hpp +++ b/include/ArduinoJson/JsonObjectKeyValue.hpp @@ -30,4 +30,4 @@ class JsonObjectKeyValue { private: Internals::JsonNode *_node; }; -} \ No newline at end of file +} diff --git a/include/ArduinoJson/JsonValue.hpp b/include/ArduinoJson/JsonValue.hpp index 9804f50a..1e7fd8d4 100644 --- a/include/ArduinoJson/JsonValue.hpp +++ b/include/ArduinoJson/JsonValue.hpp @@ -43,4 +43,4 @@ class JsonValue : public Internals::JsonNodeWrapper { return static_cast(*this); } }; -} \ No newline at end of file +} diff --git a/scripts/format-code.sh b/scripts/format-code.sh index 69bd0fdb..db372944 100644 --- a/scripts/format-code.sh +++ b/scripts/format-code.sh @@ -1,2 +1,7 @@ cd .. -find include src test -regex ".*\.[ch]pp$" -exec clang-format -style=Google -i {} \; +FILES=$(find include src test -regex ".*\.[ch]pp$") + +clang-format -style=Google -i $FILES + +# insert newline at end of file +sed -i -e '$a\' $FILES diff --git a/src/Arduino/Print.cpp b/src/Arduino/Print.cpp index 7d701d07..877447d7 100644 --- a/src/Arduino/Print.cpp +++ b/src/Arduino/Print.cpp @@ -31,4 +31,4 @@ size_t Print::print(long value) { size_t Print::println() { return write('\r') + write('\n'); } -#endif \ No newline at end of file +#endif diff --git a/src/Internals/IndentedPrint.cpp b/src/Internals/IndentedPrint.cpp index 737eb5bb..ef62c4e6 100644 --- a/src/Internals/IndentedPrint.cpp +++ b/src/Internals/IndentedPrint.cpp @@ -38,4 +38,4 @@ inline size_t IndentedPrint::writeTabs() { for (int i = 0; i < level * tabSize; i++) n += sink->write(' '); return n; -} \ No newline at end of file +} diff --git a/src/Internals/JsonWriter.cpp b/src/Internals/JsonWriter.cpp index a3651153..e1ae73d3 100644 --- a/src/Internals/JsonWriter.cpp +++ b/src/Internals/JsonWriter.cpp @@ -21,4 +21,4 @@ void JsonWriter::writeBoolean(bool value) { void JsonWriter::writeDouble(double value, int decimals) { _length += _sink->print(value, decimals); -} \ No newline at end of file +} diff --git a/src/Internals/QuotedString.cpp b/src/Internals/QuotedString.cpp index 41128893..0f9a8352 100644 --- a/src/Internals/QuotedString.cpp +++ b/src/Internals/QuotedString.cpp @@ -96,4 +96,4 @@ char *QuotedString::extractFrom(char *input, char **endPtr) { *endPtr = readPtr; return startPtr; -} \ No newline at end of file +} diff --git a/src/Internals/StringBuilder.cpp b/src/Internals/StringBuilder.cpp index cfdcc9e0..e35e5694 100644 --- a/src/Internals/StringBuilder.cpp +++ b/src/Internals/StringBuilder.cpp @@ -14,4 +14,4 @@ size_t StringBuilder::write(uint8_t c) { buffer[length++] = c; buffer[length] = 0; return 1; -} \ No newline at end of file +} diff --git a/src/JsonArray.cpp b/src/JsonArray.cpp index 1af813f9..e7992aea 100644 --- a/src/JsonArray.cpp +++ b/src/JsonArray.cpp @@ -87,4 +87,4 @@ JsonArrayIterator JsonArray::begin() { if (!_node) return end(); return JsonArrayIterator(_node->getContainerChild()); -} \ No newline at end of file +} diff --git a/src/JsonBuffer.cpp b/src/JsonBuffer.cpp index 2d0882db..82e3b089 100644 --- a/src/JsonBuffer.cpp +++ b/src/JsonBuffer.cpp @@ -94,4 +94,4 @@ JsonNode *JsonBuffer::createStringNode(const char *value) { if (node) node->setAsString(value); return node; -} \ No newline at end of file +} diff --git a/src/JsonObject.cpp b/src/JsonObject.cpp index b50fb360..33c20dfb 100644 --- a/src/JsonObject.cpp +++ b/src/JsonObject.cpp @@ -69,4 +69,4 @@ JsonNode *JsonObject::getOrCreateNodeAt(const char *key) { JsonObjectIterator JsonObject::begin() { return JsonObjectIterator(_node->getContainerChild()); -} \ No newline at end of file +} diff --git a/src/JsonValue.cpp b/src/JsonValue.cpp index 2ab6e7bd..984e4038 100644 --- a/src/JsonValue.cpp +++ b/src/JsonValue.cpp @@ -42,4 +42,4 @@ JsonValue::operator long() const { return _node ? _node->getAsInteger() : 0; } JsonValue::operator JsonArray() const { return JsonArray(_node); } -JsonValue::operator JsonObject() const { return JsonObject(_node); } \ No newline at end of file +JsonValue::operator JsonObject() const { return JsonObject(_node); } diff --git a/test/JsonArray_Container_Tests.cpp b/test/JsonArray_Container_Tests.cpp index 00d0e11c..af856919 100644 --- a/test/JsonArray_Container_Tests.cpp +++ b/test/JsonArray_Container_Tests.cpp @@ -132,4 +132,4 @@ TEST_F(JsonArray_Container_Tests, CanCreateNestedObjects) { firstElementMustBe(innerObject1); secondElementMustBe(innerObject2); nodeCountMustBe(3); -} \ No newline at end of file +} diff --git a/test/JsonArray_Iterator_Tests.cpp b/test/JsonArray_Iterator_Tests.cpp index 6ebfcb0a..4de46e30 100644 --- a/test/JsonArray_Iterator_Tests.cpp +++ b/test/JsonArray_Iterator_Tests.cpp @@ -27,4 +27,4 @@ TEST(JsonArray_Iterator_Test, SimpleTest) { EXPECT_EQ(34, (*it).as()); // TODO: use -> ++it; EXPECT_EQ(array.end(), it); -} \ No newline at end of file +} diff --git a/test/JsonArray_PrettyPrintTo_Tests.cpp b/test/JsonArray_PrettyPrintTo_Tests.cpp index 84c51f31..7f9930be 100644 --- a/test/JsonArray_PrettyPrintTo_Tests.cpp +++ b/test/JsonArray_PrettyPrintTo_Tests.cpp @@ -80,4 +80,4 @@ TEST_F(JsonArray_PrettyPrintTo_Tests, NestedArrays) { " \"key\": 3\r\n" " }\r\n" "]"); -} \ No newline at end of file +} diff --git a/test/JsonArray_PrintTo_Tests.cpp b/test/JsonArray_PrintTo_Tests.cpp index 49466c4f..24ff56c4 100644 --- a/test/JsonArray_PrintTo_Tests.cpp +++ b/test/JsonArray_PrintTo_Tests.cpp @@ -125,4 +125,4 @@ TEST_F(JsonArray_PrintTo_Tests, OneEmptyNestedHash) { array.createNestedObject(); outputMustBe("[{}]"); -} \ No newline at end of file +} diff --git a/test/JsonObject_Container_Tests.cpp b/test/JsonObject_Container_Tests.cpp index 2497c9ae..bd64183b 100644 --- a/test/JsonObject_Container_Tests.cpp +++ b/test/JsonObject_Container_Tests.cpp @@ -111,4 +111,4 @@ TEST_F(JsonObject_Container_Tests, CanStoreInnerObjects) { EXPECT_EQ(innerObject1, (JsonObject)object["hello"]); EXPECT_EQ(innerObject2, (JsonObject)object["world"]); -} \ No newline at end of file +} diff --git a/test/JsonObject_Iterator_Tests.cpp b/test/JsonObject_Iterator_Tests.cpp index ee0e6f15..904b7f19 100644 --- a/test/JsonObject_Iterator_Tests.cpp +++ b/test/JsonObject_Iterator_Tests.cpp @@ -29,4 +29,4 @@ TEST(JsonObject_Iterator_Test, SimpleTest) { EXPECT_EQ(34, it->value().as()); ++it; EXPECT_EQ(object.end(), it); -} \ No newline at end of file +} diff --git a/test/JsonObject_PrettyPrintTo_Tests.cpp b/test/JsonObject_PrettyPrintTo_Tests.cpp index ee9ce732..3e96884d 100644 --- a/test/JsonObject_PrettyPrintTo_Tests.cpp +++ b/test/JsonObject_PrettyPrintTo_Tests.cpp @@ -77,4 +77,4 @@ TEST_F(JsonObject_PrettyPrintTo_Tests, NestedContainers) { " 2\r\n" " ]\r\n" "}"); -} \ No newline at end of file +} diff --git a/test/JsonObject_Serialization_Tests.cpp b/test/JsonObject_Serialization_Tests.cpp index abd72087..1e4dc9c5 100644 --- a/test/JsonObject_Serialization_Tests.cpp +++ b/test/JsonObject_Serialization_Tests.cpp @@ -138,4 +138,4 @@ TEST_F(JsonObject_Serialization_Tests, OneEmptyNestedArray) { object.createNestedArray("key"); outputMustBe("{\"key\":[]}"); -} \ No newline at end of file +} diff --git a/test/JsonParser_Array_Tests.cpp b/test/JsonParser_Array_Tests.cpp index eb7e2cea..6a38d817 100644 --- a/test/JsonParser_Array_Tests.cpp +++ b/test/JsonParser_Array_Tests.cpp @@ -145,4 +145,4 @@ TEST_F(JsonParser_Array_Tests, TwoStrings) { sizeMustBe(2); firstElementMustBe("hello"); secondElementMustBe("world"); -} \ No newline at end of file +} diff --git a/test/JsonParser_Nested_Tests.cpp b/test/JsonParser_Nested_Tests.cpp index 0425ce37..394009bf 100644 --- a/test/JsonParser_Nested_Tests.cpp +++ b/test/JsonParser_Nested_Tests.cpp @@ -53,4 +53,4 @@ TEST(JsonParser_Nested_Tests, ObjectNestedInArray) { EXPECT_EQ(2, object1["b"].as()); EXPECT_EQ(3, object2["c"].as()); EXPECT_EQ(4, object2["d"].as()); -} \ No newline at end of file +} diff --git a/test/JsonParser_Object_Tests.cpp b/test/JsonParser_Object_Tests.cpp index 1f0ee52a..8f60937e 100644 --- a/test/JsonParser_Object_Tests.cpp +++ b/test/JsonParser_Object_Tests.cpp @@ -171,4 +171,4 @@ TEST_F(JsonParser_Object_Test, TwoNulls) { TEST_F(JsonParser_Object_Test, NullForKey) { whenInputIs("null:\"value\"}"); parseMustFail(); -} \ No newline at end of file +} diff --git a/test/JsonValueTests.cpp b/test/JsonValueTests.cpp index 9c71f118..f386cacf 100644 --- a/test/JsonValueTests.cpp +++ b/test/JsonValueTests.cpp @@ -108,4 +108,4 @@ TEST_F(JsonValueTests, ArraysAreCopiedByReference) { array.add("world"); EXPECT_EQ(1, ((JsonObject)jsonValue1).size()); -} \ No newline at end of file +} diff --git a/test/QuotedString_ExtractFrom_Tests.cpp b/test/QuotedString_ExtractFrom_Tests.cpp index 6bb8ef4d..a170bf9c 100644 --- a/test/QuotedString_ExtractFrom_Tests.cpp +++ b/test/QuotedString_ExtractFrom_Tests.cpp @@ -127,4 +127,4 @@ TEST_F(QuotedString_ExtractFrom_Tests, EscapedTab) { TEST_F(QuotedString_ExtractFrom_Tests, AllEscapedCharsTogether) { whenInputIs("\"1\\\"2\\\\3\\/4\\b5\\f6\\n7\\r8\\t9\""); resultMustBe("1\"2\\3/4\b5\f6\n7\r8\t9"); -} \ No newline at end of file +} diff --git a/test/QuotedString_PrintTo_Tests.cpp b/test/QuotedString_PrintTo_Tests.cpp index 36c535ea..8a91e654 100644 --- a/test/QuotedString_PrintTo_Tests.cpp +++ b/test/QuotedString_PrintTo_Tests.cpp @@ -76,4 +76,4 @@ TEST_F(QuotedString_PrintTo_Tests, CarriageReturn) { TEST_F(QuotedString_PrintTo_Tests, HorizontalTab) { whenInputIs("\t"); outputMustBe("\"\\t\""); -} \ No newline at end of file +} diff --git a/test/StaticJsonBufferTests.cpp b/test/StaticJsonBufferTests.cpp index c66328cf..5ade1f64 100644 --- a/test/StaticJsonBufferTests.cpp +++ b/test/StaticJsonBufferTests.cpp @@ -72,4 +72,4 @@ TEST( obj["hello"]; EXPECT_EQ(3, json.size()); -} \ No newline at end of file +} diff --git a/test/StringBuilderTests.cpp b/test/StringBuilderTests.cpp index dcb0c533..2c443523 100644 --- a/test/StringBuilderTests.cpp +++ b/test/StringBuilderTests.cpp @@ -57,4 +57,4 @@ TEST_F(StringBuilderTests, TwoStrings) { resultMustBe(4); outputMustBe("ABCDEFGH"); -} \ No newline at end of file +}