clang-tidy: Add bugprone-unchecked-optional-access
Enabled the clang-tidy check `bugprone-unchecked-optional-access` to
improve code safety when working with std::optional.
Fixed the following instances where optional values were accessed
without prior validation.
'''
../libipmid/utils.cpp:173:12: error: unchecked access to optional value [bugprone-unchecked-optional-access,-warnings-as-errors]
173 | return cachedService.value();
./chassishandler.cpp:1124:21: error: unchecked access to optional value [bugprone-unchecked-optional-access,-warnings-as-errors]
1124 | sdbusplus::message::convert_from_string<Intrusion::Status>(
'''
Change-Id: I910a6007453be4b01adc9bda36d2d37358de1ace
Signed-off-by: Jayanth Othayoth <ojayanth@gmail.com>
diff --git a/.clang-tidy b/.clang-tidy
index 7d68b81..7c0c50d 100644
--- a/.clang-tidy
+++ b/.clang-tidy
@@ -1,4 +1,5 @@
Checks: '-*,
+ bugprone-unchecked-optional-access,
modernize-use-nullptr
'