Skip to content

Conversation

@Dimi1010
Copy link
Collaborator

@Dimi1010 Dimi1010 commented Oct 9, 2025

Application of #1962 (comment)

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR applies clang-format rules to add braces for multiline control blocks, improving code readability and consistency. The changes enforce the coding standard that any multiline control flow statements should have their bodies enclosed in braces.

  • Adds braces around single-line control blocks in if/else/while/for statements
  • Maintains code functionality while improving formatting consistency
  • Applies across multiple test and source files to establish uniform code style

Reviewed Changes

Copilot reviewed 143 out of 143 changed files in this pull request and generated no comments.

Show a summary per file
File Description
Tests/Pcap++Test/main.cpp Added braces for multiline if statements in configuration setup
Tests/Pcap++Test/Tests/*.cpp Added braces for control blocks in test files across various protocol implementations
Tests/Packet++Test/main.cpp Added braces for configuration if statements
Tests/Packet++Test/Utils/TestUtils.cpp Added braces for control flow statements in utility functions
Tests/Fuzzers/*.cpp Added braces for conditional statements in fuzzing test code
Pcap++/src/*.cpp Added braces for control blocks in networking device implementation files
Packet++/src/*.cpp Added braces for control blocks in packet parsing and protocol layer implementations

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@codecov
Copy link

codecov bot commented Oct 9, 2025

Codecov Report

❌ Patch coverage is 74.48276% with 74 lines in your changes missing coverage. Please review.
✅ Project coverage is 83.38%. Comparing base (722ace3) to head (0dd44a5).

Files with missing lines Patch % Lines
Packet++/src/SSLHandshake.cpp 33.33% 6 Missing ⚠️
Packet++/header/TLVData.h 33.33% 4 Missing ⚠️
Packet++/src/TextBasedProtocol.cpp 83.33% 4 Missing ⚠️
Pcap++/src/PcapFileDevice.cpp 20.00% 4 Missing ⚠️
Pcap++/src/PcapFilter.cpp 42.85% 4 Missing ⚠️
Packet++/src/IPv6Extensions.cpp 57.14% 3 Missing ⚠️
Packet++/src/IPv6Layer.cpp 62.50% 3 Missing ⚠️
Packet++/src/SingleCommandTextProtocol.cpp 70.00% 3 Missing ⚠️
Packet++/src/SipLayer.cpp 66.66% 3 Missing ⚠️
Packet++/src/TcpLayer.cpp 75.00% 3 Missing ⚠️
... and 24 more
Additional details and impacted files
@@            Coverage Diff             @@
##              dev    #1990      +/-   ##
==========================================
- Coverage   83.43%   83.38%   -0.05%     
==========================================
  Files         311      311              
  Lines       54989    55273     +284     
  Branches    12084    12065      -19     
==========================================
+ Hits        45879    46091     +212     
- Misses       7845     8310     +465     
+ Partials     1265      872     -393     
Flag Coverage Δ
alpine320 75.92% <ø> (-0.01%) ⬇️
fedora42 75.86% <ø> (+0.01%) ⬆️
macos-14 81.55% <81.92%> (+<0.01%) ⬆️
macos-15 81.56% <81.92%> (+<0.01%) ⬆️
mingw32 70.64% <ø> (-0.01%) ⬇️
mingw64 70.60% <ø> (+0.11%) ⬆️
npcap ?
rhel94 75.87% <ø> (-0.03%) ⬇️
ubuntu2004 60.17% <ø> (+0.02%) ⬆️
ubuntu2004-zstd 60.25% <ø> (-0.02%) ⬇️
ubuntu2204 75.84% <ø> (-0.01%) ⬇️
ubuntu2204-icpx 60.87% <81.34%> (+0.24%) ⬆️
ubuntu2404 75.93% <ø> (+<0.01%) ⬆️
ubuntu2404-arm64 75.59% <ø> (-0.01%) ⬇️
unittest 83.38% <74.48%> (-0.05%) ⬇️
windows-2022 85.36% <65.25%> (+0.05%) ⬆️
windows-2025 85.39% <65.25%> (+0.01%) ⬆️
winpcap 85.39% <65.25%> (-0.17%) ⬇️
xdp 53.56% <ø> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Dimi1010 Dimi1010 marked this pull request as ready for review October 20, 2025 08:15
@Dimi1010 Dimi1010 requested a review from seladb as a code owner October 20, 2025 08:15
@Dimi1010
Copy link
Collaborator Author

The CI error is unrelated to the PR.

It is because clang tidy can't find a header in FuzzTarget.cpp for some reason.

@seladb
Copy link
Owner

seladb commented Oct 21, 2025

@Dimi1010 this PR has 143 files and ~3200 lines changed. It's very hard to review... what do you suggest?

@Dimi1010
Copy link
Collaborator Author

@Dimi1010 this PR has 143 files and ~3200 lines changed. It's very hard to review... what do you suggest?

Tbf, not much can be done...

We can split it into multiple and have the change to clang-format config added last.

That would still mean reviewing everything but potentially in smaller sections? Maybe 10~15 files a batch. Most of the chages are trivial "add line + {" or "add line + }".

@Dimi1010
Copy link
Collaborator Author

Alternatively, I suppose github UI has a "viewed" checkmark on a file to support marking off which files have already been seen when doing a long review so it can be done in several sessions.

@seladb
Copy link
Owner

seladb commented Oct 21, 2025

@Dimi1010 going over all changes will take quite a long time (and it's also quite boring 🙈 ). I can do it if we don't have a better option...

@Dimi1010
Copy link
Collaborator Author

Dimi1010 commented Oct 21, 2025

@Dimi1010 going over all changes will take quite a long time (and it's also quite boring 🙈 ). I can do it if we don't have a better option...

I know... I don't really have better ideas at the moment, though. Formatting chages are always a pain... sigh. That is why I ran the copilot review on it. I suppose we can trust that. (Famous last words)

@Dimi1010
Copy link
Collaborator Author

@seladb Btw, any idea why clang-tidy doesn't see the pcpp headers in the Fuzzer?

@seladb
Copy link
Owner

seladb commented Oct 21, 2025

@seladb Btw, any idea why clang-tidy doesn't see the pcpp headers in the Fuzzer?

I have no idea... it shouldn't be related to this PR, but it usually passes so maybe it is related to these changes somehow?

@seladb
Copy link
Owner

seladb commented Oct 21, 2025

@Dimi1010 going over all changes will take quite a long time (and it's also quite boring 🙈 ). I can do it if we don't have a better option...

I know... I don't really have better ideas at the moment, though. Formatting chages are always a pain... sigh. That is why I ran the copilot review on it. I suppose we can trust that. (Famous last words)

Ok, I guess I'll review it... it might take some time though... first let's make sure the CI passes?

@Dimi1010
Copy link
Collaborator Author

@seladb also, as this is just formatting, I would rate it as a low priority PR.

If you have the time to review it, I would much prefer to have #1971 done before that as it has been sitting stale for a while.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants