Skip to content

Commit

Permalink
Static analysis checks
Browse files Browse the repository at this point in the history
  • Loading branch information
LeStarch committed Jan 25, 2024
1 parent b14032f commit dcecdb2
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 15 deletions.
2 changes: 1 addition & 1 deletion Os/File.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ File::Status File::write(const void* buffer, FwSignedSizeType &size, bool wait)
return this->writeInternal(buffer, size, wait);
}

File::CrcWorkingSet::CrcWorkingSet() : m_crc(INITIAL_CRC), m_eof(false) {}
File::CrcWorkingSet::CrcWorkingSet() : m_offset(0), m_crc(INITIAL_CRC), m_buffer(), m_eof(false) {}

Check notice

Code scanning / CodeQL

More than one statement per line Note

This line contains 2 statements; only one is allowed.

File::Status File::updateCRC(Os::File::CrcWorkingSet& data, bool nice) {

Check notice

Code scanning / CodeQL

Long function without assertion Note

All functions of more than 10 lines should have at least one assertion.

Check notice

Code scanning / CodeQL

Use of basic integral type Note

nice uses the basic integral type bool rather than a typedef with size and signedness.
FwSignedSizeType size = sizeof data.m_buffer;

Check notice

Code scanning / CodeQL

Use of basic integral type Note

size uses the basic integral type signed long rather than a typedef with size and signedness.

Check warning

Code scanning / CodeQL

Unchecked function argument Warning

This use of parameter data has not been checked.
Expand Down
2 changes: 1 addition & 1 deletion Os/Posix/errno.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ File::Status errno_to_file_status(PlatformIntType errno_input);

}
}
#endif
#endif
6 changes: 5 additions & 1 deletion Os/test/ut/file/CommonTests.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
// ======================================================================
// \title Os/test/ut/file/CommonFileTests.cpp
// \brief common test implementations
// ======================================================================
#include "Os/test/ut/file/CommonTests.hpp"
#include <gtest/gtest.h>
#include "Os/File.hpp"

const static U32 RANDOM_BOUND = 1000;
static const U32 RANDOM_BOUND = 1000;

Functionality::Functionality() : tester(Os::Test::File::get_tester_implementation()) {}

Expand Down
8 changes: 4 additions & 4 deletions Os/test/ut/file/CommonTests.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// ======================================================================
// \title Os/test/ut/CommonFileTests.hpp
// \title Os/test/ut/file/CommonFileTests.hpp
// \brief definitions used in common file testing
// ======================================================================
#include <Os/File.hpp>
Expand Down Expand Up @@ -29,10 +29,10 @@ class Functionality : public ::testing::Test {
Functionality();

//! Setup function delegating to UT setUp function
virtual void SetUp() override;
void SetUp() override;

//! Setup function delegating to UT tearDown function
virtual void TearDown() override;
void TearDown() override;

//! Tester/state implementation
std::unique_ptr<Os::Test::File::Tester> tester;
Expand All @@ -48,7 +48,7 @@ class InvalidArguments : public Functionality {};
class FunctionalIO : public Functionality {

//! Specialized setup method used to pass requirement for functional i/o
virtual void SetUp() override;
void SetUp() override;
};

#endif // OS_TEST_UT_COMMON_FILE_TESTS_HPP
5 changes: 4 additions & 1 deletion Os/test/ut/file/MyRules.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@

// ======================================================================
// \title Os/test/ut/file/MyRules.cpp
// \brief rule implementations for common testing
// ======================================================================

#include "RulesHeaders.hpp"
#include "STest/Pick/Pick.hpp"
Expand Down
15 changes: 9 additions & 6 deletions Os/test/ut/file/MyRules.hpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@

// ======================================================================
// \title Os/test/ut/file/MyRules.hpp
// \brief rule definitions for common testing
// ======================================================================
// Stripped when compiled, here for IDEs
#include "RulesHeaders.hpp"

Expand Down Expand Up @@ -38,7 +41,7 @@ struct OpenFileCreate : public OpenBaseRule {
// ----------------------------------------------------------------------

//! Constructor
OpenFileCreate(const bool randomize_filename = false);
explicit OpenFileCreate(const bool randomize_filename = false);
};

// ------------------------------------------------------------------------------------------------------
Expand All @@ -51,7 +54,7 @@ struct OpenFileCreateOverwrite : public OpenBaseRule {
// ----------------------------------------------------------------------

//! Constructor
OpenFileCreateOverwrite(const bool randomize_filename = false);
explicit OpenFileCreateOverwrite(const bool randomize_filename = false);
};


Expand All @@ -65,7 +68,7 @@ struct OpenForWrite : public OpenBaseRule {
// ----------------------------------------------------------------------

//! Constructor
OpenForWrite(const bool randomize_filename = false);
explicit OpenForWrite(const bool randomize_filename = false);
};

// ------------------------------------------------------------------------------------------------------
Expand All @@ -78,7 +81,7 @@ struct OpenForRead : public OpenBaseRule {
// ----------------------------------------------------------------------

//! Constructor
OpenForRead(const bool randomize_filename = false);
explicit OpenForRead(const bool randomize_filename = false);
};

// ------------------------------------------------------------------------------------------------------
Expand Down Expand Up @@ -441,7 +444,7 @@ struct AssertRule : public STest::Rule<Os::Test::File::Tester> {
// ----------------------------------------------------------------------

//! Constructor
AssertRule(const char *name);
explicit AssertRule(const char *name);

// ----------------------------------------------------------------------
// Public member functions
Expand Down
5 changes: 4 additions & 1 deletion Os/test/ut/file/RulesHeaders.hpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@

// ======================================================================
// \title Os/test/ut/file/RulesHeaders.hpp
// \brief rule definitions for common testing
// ======================================================================

#ifndef __RULES_HEADERS__
#define __RULES_HEADERS__
Expand Down

0 comments on commit dcecdb2

Please sign in to comment.