Fix sonar errors - #632
Conversation
|
|
||
| State(State&&) = default; | ||
| State& operator=(State&&) = default; | ||
| State(State&&) noexcept = default; |
There was a problem hiding this comment.
Remove . at the end of commit message
| } | ||
|
|
||
| digest = it->mIndexDigest; | ||
| digest = it->mIndexDigest; // NOSONAR cpp:S5912 - Assign stays within StaticString capacity |
There was a problem hiding this comment.
Need to find another solution.
There was a problem hiding this comment.
replaced with Assign in some cases
| pin.Clear(); | ||
|
|
||
| srand(::time(nullptr)); // use current time as seed for random generator | ||
| srand(::time(nullptr)); // NOSONAR cpp:S5020 - C++ <random> not available in this codebase |
There was a problem hiding this comment.
Can randomItf be used instead?
There was a problem hiding this comment.
yes, fixed
| } | ||
|
|
||
| path = fs::JoinPath(mConfig.mImagePath, cLayersFolder, alg, hash); | ||
| path = fs::JoinPath( |
There was a problem hiding this comment.
new Sonar issue?
Use pointer or reference to avoid slicing from "StaticString<512>" to "String".
883ccea to
555fe27
Compare
Make sure that moving an objectis "noexcept" Move and swap operations should be "noexcept" Signed-off-by: Mykola Kobets <mykola_kobets@epam.com>
Use pointer or reference to avoid slicing Suppress false-positive slicing for String/Array views over Static* Signed-off-by: Mykola Kobets <mykola_kobets@epam.com>
Replace "module" with another name Signed-off-by: Mykola Kobets <mykola_kobets@epam.com>
Replace "srand"/"rand" with the facilities in <random> Suppress: C++ <random> not available in this codebase Signed-off-by: Mykola Kobets <mykola_kobets@epam.com>
Suppress false-positive lock already acquired / lock order reversal Signed-off-by: Mykola Kobets <mykola_kobets@epam.com>
Use the value returned from the function Signed-off-by: Mykola Kobets <mykola_kobets@epam.com>
Signed-off-by: Mykola Kobets <mykola_kobets@epam.com>
Replace this builtin type with an alias that makes the type size explicit Signed-off-by: Mykola Kobets <mykola_kobets@epam.com>
Make an overloaded operator a hidden friend Signed-off-by: Mykola Kobets <mykola_kobets@epam.com>
825cbf9 to
8b8ce92
Compare
|
| version = it->mVersion; | ||
|
|
||
| return ErrorEnum::eNone; | ||
| return AOS_ERROR_WRAP(version.Assign(it->mVersion)); |
There was a problem hiding this comment.
I don't like to put operators into macro. Should be:
if (auto err = version.Assign(it->mVersion); !err.IsNone()) {
return AOS_ERROR_WRAP(err);
}
reuturn ErrorEnum::eNone;In all the cases.
| } | ||
|
|
||
| return ErrorEnum::eNone; | ||
| return AOS_ERROR_WRAP(pin.ByteArrayToHex(buffer)); |
| const auto count = Min<size_t>(cAlertItemsCount, mAlerts.Size()); | ||
|
|
||
| package->mItems.Assign(Array<AlertVariant>(mAlerts.begin(), count)); | ||
| (void)package->mItems.Assign(Array<AlertVariant>(mAlerts.begin(), count)); |
| void Alerts::ShrinkCache(size_t count) | ||
| { | ||
| mAlerts.Erase(mAlerts.begin(), mAlerts.begin() + Min<size_t>(count, mAlerts.Size())); | ||
| (void)mAlerts.Erase(mAlerts.begin(), mAlerts.begin() + Min<size_t>(count, mAlerts.Size())); |
| } | ||
|
|
||
| receiver->OnAlertReceived(alert); | ||
| (void)receiver->OnAlertReceived(alert); |
|
|
||
| mCancel = true; | ||
| mCondVar.NotifyAll(); | ||
| (void)mCondVar.NotifyAll(); |
| UniqueLock<Mutex> lock(mMutex); // NOSONAR cpp:S5486 - false positive; lock released before next WaitForStop() | ||
|
|
||
| mCondVar.Wait(lock, cRetryTimeout, [this]() { return mCancel; }); | ||
| (void)mCondVar.Wait(lock, cRetryTimeout, [this]() { return mCancel; }); |
There was a problem hiding this comment.
ditto in all the cases:
either return or log error




No description provided.