Skip to content

Conversation

@thomas-bc
Copy link
Collaborator

Related Issue(s)
Has Unit Tests (y/n)
Documentation Included (y/n)

Change Description

Adds code formatting check to CI
This only checks a few directories for now. The plan will be to walk through the repo a few directories at a time in multiple PRs, to make reviewing easier.

Fix #3474

Step towards #1984

FW_ASSERT(FW_SERIALIZE_OK == stat,static_cast<FwAssertArgType>(stat));
}
CmdArgBuffer::CmdArgBuffer(const U8* args, FwSizeType size) {
SerializeStatus stat = this->setBuff(args, size);

Check warning

Code scanning / CodeQL

Unchecked function argument Warning

This use of parameter args has not been checked.
FW_ASSERT(FW_SERIALIZE_OK == stat,static_cast<FwAssertArgType>(stat));
}
CmdArgBuffer::CmdArgBuffer(const U8* args, FwSizeType size) {
SerializeStatus stat = this->setBuff(args, size);

Check warning

Code scanning / CodeQL

Unchecked function argument Warning

This use of parameter size has not been checked.
return *this;
}
CmdArgBuffer::CmdArgBuffer(const CmdArgBuffer& other) : Fw::SerializeBufferBase() {
SerializeStatus stat = this->setBuff(other.m_bufferData, other.getBuffLength());

Check warning

Code scanning / CodeQL

Unchecked function argument Warning

This use of parameter other has not been checked.
}

SerializeStatus CmdPacket::deserialize(SerializeBufferBase& buffer) {
SerializeStatus stat = ComPacket::deserializeBase(buffer);

Check warning

Code scanning / CodeQL

Unchecked function argument Warning

This use of parameter buffer has not been checked.
FW_ASSERT(FW_SERIALIZE_OK == stat,static_cast<FwAssertArgType>(stat));
}
ComBuffer::ComBuffer(const U8* args, FwSizeType size) {
SerializeStatus stat = SerializeBufferBase::setBuff(args, size);

Check warning

Code scanning / CodeQL

Unchecked function argument Warning

This use of parameter args has not been checked.
FW_ASSERT(FW_SERIALIZE_OK == stat,static_cast<FwAssertArgType>(stat));
}
ComBuffer::ComBuffer(const U8* args, FwSizeType size) {
SerializeStatus stat = SerializeBufferBase::setBuff(args, size);

Check warning

Code scanning / CodeQL

Unchecked function argument Warning

This use of parameter size has not been checked.
return *this;
}
ComBuffer::ComBuffer(const ComBuffer& other) : Fw::SerializeBufferBase() {
SerializeStatus stat = SerializeBufferBase::setBuff(other.m_bufferData, other.getBuffLength());

Check warning

Code scanning / CodeQL

Unchecked function argument Warning

This use of parameter other has not been checked.
return buffer.serialize(static_cast<FwPacketDescriptorType>(this->m_type));
}
SerializeStatus ComPacket::serializeBase(SerializeBufferBase& buffer) const {
return buffer.serialize(static_cast<FwPacketDescriptorType>(this->m_type));

Check warning

Code scanning / CodeQL

Unchecked function argument Warning

This use of parameter buffer has not been checked.
return stat;
SerializeStatus ComPacket::deserializeBase(SerializeBufferBase& buffer) {
FwPacketDescriptorType serVal;
SerializeStatus stat = buffer.deserialize(serVal);

Check warning

Code scanning / CodeQL

Unchecked function argument Warning

This use of parameter buffer has not been checked.
m_context(src.m_context)
{
if(src.m_bufferData != nullptr){
Buffer::Buffer() : Serializable(), m_serialize_repr(), m_bufferData(nullptr), m_size(0), m_context(0xFFFFFFFF) {}

Check notice

Code scanning / CodeQL

More than one statement per line Note

This line contains 2 statements; only one is allowed.

CmdArgBuffer::CmdArgBuffer() {
}
CmdArgBuffer::CmdArgBuffer() {}

Check notice

Code scanning / CodeQL

More than one statement per line Note

This line contains 2 statements; only one is allowed.

CmdArgBuffer::~CmdArgBuffer() {
}
CmdArgBuffer::~CmdArgBuffer() {}

Check notice

Code scanning / CodeQL

More than one statement per line Note

This line contains 2 statements; only one is allowed.
}

SerializeStatus CmdPacket::serialize(SerializeBufferBase& buffer) const {
CmdPacket::~CmdPacket() {}

Check notice

Code scanning / CodeQL

More than one statement per line Note

This line contains 2 statements; only one is allowed.
return FW_SERIALIZE_OK; // for compiler
}

SerializeStatus CmdPacket::deserialize(SerializeBufferBase& buffer) {

Check notice

Code scanning / CodeQL

Long function without assertion Note

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

ComBuffer::ComBuffer() {
}
ComBuffer::ComBuffer() {}

Check notice

Code scanning / CodeQL

More than one statement per line Note

This line contains 2 statements; only one is allowed.

ComBuffer::~ComBuffer() {
}
ComBuffer::~ComBuffer() {}

Check notice

Code scanning / CodeQL

More than one statement per line Note

This line contains 2 statements; only one is allowed.

ComPacket::ComPacket() : m_type(ComPacketType::FW_PACKET_UNKNOWN) {
}
ComPacket::ComPacket() : m_type(ComPacketType::FW_PACKET_UNKNOWN) {}

Check notice

Code scanning / CodeQL

More than one statement per line Note

This line contains 2 statements; only one is allowed.

ComPacket::~ComPacket() {
}
ComPacket::~ComPacket() {}

Check notice

Code scanning / CodeQL

More than one statement per line Note

This line contains 2 statements; only one is allowed.
#if FW_SERIALIZABLE_TO_STRING
void Buffer::toString(Fw::StringBase& text) const {
static const char * formatString = "(data = %p, size = %u, context = %u)";
static const char* formatString = "(data = %p, size = %u, context = %u)";

Check notice

Code scanning / CodeQL

Use of basic integral type Note

formatString uses the basic integral type char rather than a typedef with size and signedness.
}
CmdArgBuffer::CmdArgBuffer(const CmdArgBuffer& other) : Fw::SerializeBufferBase() {
SerializeStatus stat = this->setBuff(other.m_bufferData, other.getBuffLength());
FW_ASSERT(FW_SERIALIZE_OK == stat, static_cast<FwAssertArgType>(stat));

Check warning

Code scanning / CppCheck

Member variable 'CmdArgBuffer::m_bufferData' is not assigned in the copy constructor. Should it be copied? Warning

Member variable 'CmdArgBuffer::m_bufferData' is not assigned in the copy constructor. Should it be copied?
}
ComBuffer::ComBuffer(const ComBuffer& other) : Fw::SerializeBufferBase() {
SerializeStatus stat = SerializeBufferBase::setBuff(other.m_bufferData, other.getBuffLength());
FW_ASSERT(FW_SERIALIZE_OK == stat, static_cast<FwAssertArgType>(stat));

Check warning

Code scanning / CppCheck

Member variable 'ComBuffer::m_bufferData' is not assigned in the copy constructor. Should it be copied? Warning

Member variable 'ComBuffer::m_bufferData' is not assigned in the copy constructor. Should it be copied?
@thomas-bc thomas-bc mentioned this pull request Jun 23, 2025
3 tasks
@thomas-bc
Copy link
Collaborator Author

thomas-bc commented Jun 23, 2025

Ouch - looks like there's no pre-built version of https://pypi.org/project/clang-format/ for ARM (32bit). So our checks running RPI 32bit are slowed down because pip will try to build from source...

EDIT: fixed by requiring clang-format only when not on ARM32. ARM32 systems can install through other means, and most likely development (code formatting) is not happening on ARM32 anyways.

@thomas-bc thomas-bc requested a review from LeStarch June 23, 2025 21:39
@thomas-bc thomas-bc merged commit 1a07c84 into nasa:devel Jun 24, 2025
75 of 77 checks passed
@thomas-bc thomas-bc deleted the ci/formatting branch June 24, 2025 19:19
@thomas-bc thomas-bc added the Breaking Changes / Needs Release Notes Need to add instructions in the release notes for updates. label Aug 6, 2025
@thomas-bc
Copy link
Collaborator Author

Other Changes

  • Framework code has been entirely formatted for better readability.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Breaking Changes / Needs Release Notes Need to add instructions in the release notes for updates.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Standard way to automatically verify that F Prime code formatting is correct in CI

2 participants