Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .clang-tidy
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ Checks: >
modernize-redundant-void-arg,
modernize-use-bool-literals,
modernize-use-nullptr,
readability-braces-around-statements
-clang-analyzer-security.insecureAPI.rand,
readability-braces-around-statements,
-clang-analyzer-security.insecureAPI.rand
WarningsAsErrors: '*'
3 changes: 2 additions & 1 deletion Fw/Types/GTest/Bytes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@ namespace GTest {

void Bytes ::compare(const Bytes& expected, const Bytes& actual) {
ASSERT_EQ(expected.size, actual.size);
for (size_t i = 0; i < expected.size; ++i)
for (size_t i = 0; i < expected.size; ++i) {
ASSERT_EQ(expected.bytes[i], actual.bytes[i]) << "At i=" << i << "\n";
}
}

} // namespace GTest
Expand Down
4 changes: 2 additions & 2 deletions Os/Posix/test/ut/PosixConsoleTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ TEST(Nominal, SwitchStream) {
TEST(OffNominal, SwitchStream) {
Os::Posix::Console::PosixConsole posix_console;
ASSERT_DEATH(
posix_console.setOutputStream(static_cast<Os::Posix::Console::PosixConsole::Stream>(3)),
"Posix/|\\Console.cpp:33"); // NOLINT(clang-analyzer-optin.core.EnumCastOutOfRange) intentional death test
posix_console.setOutputStream(static_cast<Os::Posix::Console::PosixConsole::Stream>(3)), // NOLINT(clang-analyzer-optin.core.EnumCastOutOfRange) intentional death test
"Posix/|\\Console.cpp:33");
}

int main(int argc, char** argv) {
Expand Down
2 changes: 1 addition & 1 deletion Os/test/ut/directory/DirectoryRules.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ void Os::Test::Directory::Tester::ReadAllFiles::action(Os::Test::Directory::Test
// Number of files read should be the number of files in the directory minus the original seek position
ASSERT_EQ(outFileCount, state.m_filenames.size());
for (FwSizeType i = 0; i < outFileCount; i++) {
ASSERT_TRUE(state.is_valid_filename(std::string(outArray[i].toChar())));
ASSERT_TRUE(state.is_valid_filename(std::string(outArray[i].toChar()))); // NOLINT(clang-analyzer-security.ArrayBound)
}
// readDirectory resets the seek position to the end
state.m_seek_position = 0;
Expand Down
6 changes: 4 additions & 2 deletions Svc/ActivePhaser/test/ut/ActivePhaserTester.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,9 @@ FauxPhaser::State FauxPhaser::run(U32 tick_of_cycle, U32 cycle_length) {
(state == FauxPhaser::RUNNING || state == FauxPhaser::STARTING)) {
bool finished_on_time = (current->length == current->actual_length);
current++;
if (current < children.end())
if (current < children.end()) {
current->runtime = 0;
}
// A child has run long, the machine is forced to idle before starting the next child to avoid a short cycle
state = finished_on_time ? FauxPhaser::STARTING : FauxPhaser::IDLE;
}
Expand All @@ -53,8 +54,9 @@ FauxPhaser::State FauxPhaser::run(U32 tick_of_cycle, U32 cycle_length) {
} else {
EXPECT_FALSE(1);
}
if (current < children.end())
if (current < children.end()) {
current->runtime++;
}
return state;
}

Expand Down
3 changes: 2 additions & 1 deletion Svc/BufferLogger/test/ut/BufferLoggerTester.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,9 @@ void BufferLoggerTester ::dispatchOne() {
}

void BufferLoggerTester ::dispatchAll() {
while (this->component.m_queue.getMessagesAvailable() > 0)
while (this->component.m_queue.getMessagesAvailable() > 0) {
this->dispatchOne();
}
}

Fw::Time BufferLoggerTester ::generateTestTime(const U32 seconds) {
Expand Down
8 changes: 4 additions & 4 deletions Svc/CmdSequencer/test/ut/SequenceFiles/BadDescriptorFile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ void BadDescriptorFile ::serializeFPrime(Fw::SerializeBufferBase& buffer) {
for (U32 record = 0; record < this->n; record++) {
Fw::Time t(TimeBase::TB_WORKSTATION_TIME, 0, 0);
// Force an invalid record descriptor
FPrime::Records::Descriptor descriptor = static_cast<FPrime::Records::Descriptor>(
10); // NOLINT(clang-analyzer-optin.core.EnumCastOutOfRange) intentional test
FPrime::Records::Descriptor descriptor = static_cast<FPrime::Records::Descriptor>( // NOLINT(clang-analyzer-optin.core.EnumCastOutOfRange) intentional test
10);
FPrime::Records::serialize(descriptor, t, record, record + 1, buffer);
}
// CRC
Expand All @@ -51,8 +51,8 @@ void BadDescriptorFile ::serializeAMPCS(Fw::SerializeBufferBase& buffer) {
// Records
for (U32 i = 0; i < this->n; ++i) {
// Force an invalid time flag
const AMPCSSequence::Record::TimeFlag::t timeFlag = static_cast<AMPCSSequence::Record::TimeFlag::t>(
10); // NOLINT(clang-analyzer-optin.core.EnumCastOutOfRange) intentional test
const AMPCSSequence::Record::TimeFlag::t timeFlag = static_cast<AMPCSSequence::Record::TimeFlag::t>( // NOLINT(clang-analyzer-optin.core.EnumCastOutOfRange) intentional test
10);
const AMPCSSequence::Record::Time::t time = 0;
const AMPCSSequence::Record::Opcode::t opcode = i;
const U32 argument = i + 1;
Expand Down
3 changes: 2 additions & 1 deletion Svc/ComLogger/test/ut/ComLoggerTester.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,9 @@ void ComLoggerTester ::dispatchOne() {
}

void ComLoggerTester ::dispatchAll() {
while (this->comLogger.m_queue.getMessagesAvailable() > 0)
while (this->comLogger.m_queue.getMessagesAvailable() > 0) {
this->dispatchOne();
}
}

// ----------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion Svc/ComStub/test/ut/ComStubTester.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ void ComStubTester ::test_retry_async() {
}
// Retrying for as many times as the RETRY_LIMIT should be ok
for (FwIndexType i = 0; i < this->component.RETRY_LIMIT; i++) {
invoke_to_drvAsyncSendReturnIn(0, buffers[i], Drv::ByteStreamStatus::SEND_RETRY);
invoke_to_drvAsyncSendReturnIn(0, buffers[i], Drv::ByteStreamStatus::SEND_RETRY); // NOLINT(clang-analyzer-security.ArrayBound)
// Test we have indeed retried (data sent on drvAsyncSendOut)
ASSERT_from_drvAsyncSendOut_SIZE(static_cast<U32>(i + 1));
ASSERT_from_drvAsyncSendOut(static_cast<U32>(i), buffers[i]);
Expand Down
2 changes: 1 addition & 1 deletion Svc/FileDownlink/test/ut/FileDownlinkTester.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ void FileDownlinkTester ::from_bufferSendOut_handler(const FwIndexType portNum,
ASSERT_LT(buffers_index, FW_NUM_ARRAY_ELEMENTS(this->buffers));
// Copy buffer before recycling
U8* data = new U8[buffer.getSize()];
this->buffers[buffers_index] = data;
this->buffers[buffers_index] = data; // NOLINT(clang-analyzer-security.ArrayBound)
buffers_index++;
::memcpy(data, buffer.getData(), buffer.getSize());
Fw::Buffer buffer_new = buffer;
Expand Down
3 changes: 2 additions & 1 deletion Svc/PrmDb/PrmDbImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -507,8 +507,9 @@ void PrmDbImpl::clearDb(PrmDbType prmDbType) {

bool PrmDbImpl::dbEqual() {
for (FwSizeType i = 0; i < PRMDB_NUM_DB_ENTRIES; i++) {
if (!(this->m_dbStore1[i] == this->m_dbStore2[i]))
if (!(this->m_dbStore1[i] == this->m_dbStore2[i])) {
return false;
}
}
return true;
}
Expand Down
3 changes: 1 addition & 2 deletions Utils/test/ut/TokenBucketTester.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,7 @@ void TokenBucketTester ::testReconfiguring() {
ASSERT_EQ(bucket.getTokens(), newMaxTokens - 1);

// set new rate, replenish quickly
while (bucket.trigger(Fw::Time(0, 0)))
;
while (bucket.trigger(Fw::Time(0, 0))) {}
bucket.setReplenishInterval(1000000);
U32 newRate = 2;
bucket.setReplenishRate(newRate);
Expand Down
Loading