From 7e1aed6ad9bdd9a2b02c1e17a135472dcc9fa11d Mon Sep 17 00:00:00 2001
From: Robin Mueller <muellerr@irs.uni-stuttgart.de>
Date: Fri, 22 Apr 2022 14:04:30 +0200
Subject: [PATCH] apply afmt

---
 .../devicehandlers/MgmLIS3MDLHandler.cpp      |  4 +-
 hal/src/fsfw_hal/linux/uart/UartCookie.cpp    |  4 +-
 .../datapoollocal/LocalDataPoolManager.cpp    | 10 ++--
 src/fsfw/devicehandlers/DeviceHandlerBase.cpp | 13 +++--
 src/fsfw/osal/rtems/PeriodicTask.h            |  5 +-
 src/fsfw/version.cpp                          |  3 +-
 src/fsfw/version.h                            |  2 +-
 tests/src/fsfw_tests/unit/version.cpp         | 50 +++++++++----------
 8 files changed, 44 insertions(+), 47 deletions(-)

diff --git a/hal/src/fsfw_hal/devicehandlers/MgmLIS3MDLHandler.cpp b/hal/src/fsfw_hal/devicehandlers/MgmLIS3MDLHandler.cpp
index 52b6dc07..644b488d 100644
--- a/hal/src/fsfw_hal/devicehandlers/MgmLIS3MDLHandler.cpp
+++ b/hal/src/fsfw_hal/devicehandlers/MgmLIS3MDLHandler.cpp
@@ -1,9 +1,9 @@
 #include "MgmLIS3MDLHandler.h"
 
-#include "fsfw/datapool/PoolReadGuard.h"
-
 #include <cmath>
 
+#include "fsfw/datapool/PoolReadGuard.h"
+
 MgmLIS3MDLHandler::MgmLIS3MDLHandler(object_id_t objectId, object_id_t deviceCommunication,
                                      CookieIF *comCookie, uint32_t transitionDelay)
     : DeviceHandlerBase(objectId, deviceCommunication, comCookie),
diff --git a/hal/src/fsfw_hal/linux/uart/UartCookie.cpp b/hal/src/fsfw_hal/linux/uart/UartCookie.cpp
index aa2dd214..3fedc9d4 100644
--- a/hal/src/fsfw_hal/linux/uart/UartCookie.cpp
+++ b/hal/src/fsfw_hal/linux/uart/UartCookie.cpp
@@ -24,9 +24,7 @@ void UartCookie::setParityEven() { parity = Parity::EVEN; }
 
 Parity UartCookie::getParity() const { return parity; }
 
-void UartCookie::setBitsPerWord(BitsPerWord bitsPerWord_) {
-  bitsPerWord = bitsPerWord_;
-}
+void UartCookie::setBitsPerWord(BitsPerWord bitsPerWord_) { bitsPerWord = bitsPerWord_; }
 
 BitsPerWord UartCookie::getBitsPerWord() const { return bitsPerWord; }
 
diff --git a/src/fsfw/datapoollocal/LocalDataPoolManager.cpp b/src/fsfw/datapoollocal/LocalDataPoolManager.cpp
index 6053bd43..781d8f71 100644
--- a/src/fsfw/datapoollocal/LocalDataPoolManager.cpp
+++ b/src/fsfw/datapoollocal/LocalDataPoolManager.cpp
@@ -787,9 +787,9 @@ ReturnValue_t LocalDataPoolManager::generateSetStructurePacket(sid_t sid, bool i
   // Serialize set packet into store.
   size_t size = 0;
   result = setPacket.serialize(&storePtr, &size, expectedSize, SerializeIF::Endianness::BIG);
-  if(result != HasReturnvaluesIF::RETURN_OK) {
-      ipcStore->deleteData(storeId);
-      return result;
+  if (result != HasReturnvaluesIF::RETURN_OK) {
+    ipcStore->deleteData(storeId);
+    return result;
   }
   if (expectedSize != size) {
     printWarningOrError(sif::OutputTypes::OUT_WARNING, "generateSetStructurePacket",
@@ -806,8 +806,8 @@ ReturnValue_t LocalDataPoolManager::generateSetStructurePacket(sid_t sid, bool i
   }
 
   result = hkQueue->reply(&reply);
-  if(result != HasReturnvaluesIF::RETURN_OK) {
-      ipcStore->deleteData(storeId);
+  if (result != HasReturnvaluesIF::RETURN_OK) {
+    ipcStore->deleteData(storeId);
   }
   return result;
 }
diff --git a/src/fsfw/devicehandlers/DeviceHandlerBase.cpp b/src/fsfw/devicehandlers/DeviceHandlerBase.cpp
index 0e2802ac..dd9bd5d7 100644
--- a/src/fsfw/devicehandlers/DeviceHandlerBase.cpp
+++ b/src/fsfw/devicehandlers/DeviceHandlerBase.cpp
@@ -458,16 +458,15 @@ size_t DeviceHandlerBase::getNextReplyLength(DeviceCommandId_t commandId) {
   DeviceCommandId_t replyId = NO_COMMAND_ID;
   DeviceCommandMap::iterator command = cookieInfo.pendingCommand;
   if (command->second.useAlternativeReplyId) {
-	replyId = command->second.alternativeReplyId;
-  }
-  else {
-	replyId = commandId;
+    replyId = command->second.alternativeReplyId;
+  } else {
+    replyId = commandId;
   }
   DeviceReplyIter iter = deviceReplyMap.find(replyId);
   if (iter != deviceReplyMap.end()) {
-	if (iter->second.delayCycles != 0) {
-		return iter->second.replyLen;
-	}
+    if (iter->second.delayCycles != 0) {
+      return iter->second.replyLen;
+    }
   }
   return 0;
 }
diff --git a/src/fsfw/osal/rtems/PeriodicTask.h b/src/fsfw/osal/rtems/PeriodicTask.h
index 24ce4af1..9f47dfc6 100644
--- a/src/fsfw/osal/rtems/PeriodicTask.h
+++ b/src/fsfw/osal/rtems/PeriodicTask.h
@@ -59,14 +59,13 @@ class PeriodicTask : public RTEMSTaskBase, public PeriodicTaskIF {
    */
   ReturnValue_t addComponent(object_id_t object) override;
 
-/**
+  /**
    * Adds an object to the list of objects to be executed.
    * The objects are executed in the order added.
    * @param object pointer to the object to add.
    * @return RETURN_OK on success, RETURN_FAILED if the object could not be added.
    */
-  ReturnValue_t addComponent(ExecutableObjectIF* object) override;
-
+  ReturnValue_t addComponent(ExecutableObjectIF *object) override;
 
   uint32_t getPeriodMs() const override;
 
diff --git a/src/fsfw/version.cpp b/src/fsfw/version.cpp
index 4717b188..7355fc1d 100644
--- a/src/fsfw/version.cpp
+++ b/src/fsfw/version.cpp
@@ -1,8 +1,9 @@
 #include "version.h"
-#include "fsfw/FSFWVersion.h"
 
 #include <cstdio>
 
+#include "fsfw/FSFWVersion.h"
+
 #ifdef major
 #undef major
 #endif
diff --git a/src/fsfw/version.h b/src/fsfw/version.h
index d97306ec..f7d56d91 100644
--- a/src/fsfw/version.h
+++ b/src/fsfw/version.h
@@ -30,7 +30,7 @@ class Version {
   }
 
   friend bool operator>(const Version& v1, const Version& v2) {
-    return not (v1 < v2) and not (v1 == v2);
+    return not(v1 < v2) and not(v1 == v2);
   }
 
   friend bool operator<=(const Version& v1, const Version& v2) { return ((v1 == v2) or (v1 < v2)); }
diff --git a/tests/src/fsfw_tests/unit/version.cpp b/tests/src/fsfw_tests/unit/version.cpp
index 92a930dc..2967dfa5 100644
--- a/tests/src/fsfw_tests/unit/version.cpp
+++ b/tests/src/fsfw_tests/unit/version.cpp
@@ -17,15 +17,15 @@ TEST_CASE("Version API Tests", "[TestVersionAPI]") {
   fsfw::Version v1 = fsfw::Version(1, 1, 1);
   fsfw::Version v2 = fsfw::Version(1, 1, 1);
   REQUIRE(v1 == v2);
-  REQUIRE(not (v1 < v2));
-  REQUIRE(not (v1 > v2));
+  REQUIRE(not(v1 < v2));
+  REQUIRE(not(v1 > v2));
   REQUIRE(v1 <= v2);
   REQUIRE(v1 >= v2);
   v1.revision -= 1;
   REQUIRE(v1 != v2);
-  REQUIRE(not (v1 == v2));
-  REQUIRE(not (v1 > v2));
-  REQUIRE(not (v1 >= v2));
+  REQUIRE(not(v1 == v2));
+  REQUIRE(not(v1 > v2));
+  REQUIRE(not(v1 >= v2));
   REQUIRE(v1 < v2);
   REQUIRE(v1 <= v2);
   v1.revision += 1;
@@ -33,60 +33,60 @@ TEST_CASE("Version API Tests", "[TestVersionAPI]") {
   REQUIRE(v1 != v2);
   REQUIRE(v1 < v2);
   REQUIRE(v1 <= v2);
-  REQUIRE(not (v1 == v2));
-  REQUIRE(not (v1 > v2));
-  REQUIRE(not (v1 >= v2));
+  REQUIRE(not(v1 == v2));
+  REQUIRE(not(v1 > v2));
+  REQUIRE(not(v1 >= v2));
   v1.minor += 1;
   v1.major -= 1;
   REQUIRE(v1 != v2);
   REQUIRE(v1 < v2);
   REQUIRE(v1 <= v2);
-  REQUIRE(not (v1 == v2));
-  REQUIRE(not (v1 > v2));
-  REQUIRE(not (v1 >= v2));
+  REQUIRE(not(v1 == v2));
+  REQUIRE(not(v1 > v2));
+  REQUIRE(not(v1 >= v2));
   v1.major += 1;
   REQUIRE(v1 == v2);
   REQUIRE(v1 <= v2);
   REQUIRE(v1 >= v2);
-  REQUIRE(not (v1 != v2));
-  REQUIRE(not (v1 > v2));
-  REQUIRE(not (v1 < v2));
+  REQUIRE(not(v1 != v2));
+  REQUIRE(not(v1 > v2));
+  REQUIRE(not(v1 < v2));
   v1.major += 1;
   v1.minor -= 1;
   REQUIRE(v1 != v2);
   REQUIRE(v1 > v2);
   REQUIRE(v1 >= v2);
-  REQUIRE(not (v1 == v2));
-  REQUIRE(not (v1 < v2));
-  REQUIRE(not (v1 <= v2));
+  REQUIRE(not(v1 == v2));
+  REQUIRE(not(v1 < v2));
+  REQUIRE(not(v1 <= v2));
   v1.major -= 1;
   v1.minor += 2;
   v1.revision -= 1;
   REQUIRE(v1 != v2);
   REQUIRE(v1 > v2);
   REQUIRE(v1 >= v2);
-  REQUIRE(not (v1 == v2));
-  REQUIRE(not (v1 < v2));
-  REQUIRE(not (v1 <= v2));
+  REQUIRE(not(v1 == v2));
+  REQUIRE(not(v1 < v2));
+  REQUIRE(not(v1 <= v2));
   v1.minor -= 1;
   v1.revision += 2;
   REQUIRE(v1 != v2);
   REQUIRE(v1 > v2);
   REQUIRE(v1 >= v2);
-  REQUIRE(not (v1 == v2));
-  REQUIRE(not (v1 < v2));
-  REQUIRE(not (v1 <= v2));
+  REQUIRE(not(v1 == v2));
+  REQUIRE(not(v1 < v2));
+  REQUIRE(not(v1 <= v2));
   v1.revision -= 1;
   REQUIRE(v1 == v2);
   REQUIRE(v1 <= v2);
   REQUIRE(v1 >= v2);
-  REQUIRE(not (v1 != v2));
+  REQUIRE(not(v1 != v2));
 #if FSFW_CPP_OSTREAM_ENABLED == 1
   sif::info << "v" << fsfw::FSFW_VERSION << std::endl;
 #endif
   char verString[10] = {};
   fsfw::FSFW_VERSION.getVersion(verString, sizeof(verString));
 #if FSFW_DISABLE_PRINTOUT == 0
-  printf("v%s\n",verString);
+  printf("v%s\n", verString);
 #endif
 }