Skip to content

Conversation

@joseph5wu
Copy link
Contributor

Pre-submission checklist

  • I've ran the linters locally and fixed lint errors related to the files I modified in this PR. You can install the linters by running pip install -r requirements-dev.txt && pre-commit install
  • pre-commit run

Summary

This PR will introduce a new FBOSS github pull request template which shows the pre-submission checklist, and the two basic sessions that Meta internal diff format: Summary and Test Plan

I also integrated pre-commit in this diff to allow clang formatting which is using the .clang-format in our fboss directory.
Once a user run pre-commit run once, it will automatically create a hook and will trigger the pre-commit automatically every time when they run git commit.

TODO: In the future, I'll introduce clang-linter in the pre-commit so users can correct any linter error before commit

Test Plan

Unfortunately, I can't verify whether my .github/pull_request_template.md works in this diff when I was composing my PR description, because it only works in the default branch and my PR has to use a local branch.

But I did verify my pre-commit work by manually messed up with one file to violate the clang-format rule.
You can see when I try to amend my commit, now the file was modified to the right format

[root@2ce8c3df3a07 fboss]# git commit --amend
clang-format.............................................................Failed
- hook id: clang-format
- files were modified by this hook

Formatting [1/1] fboss/agent/state/tests/InterfaceTests.cpp

[root@2ce8c3df3a07 fboss]# git status
On branch fboss_pull_request_template
Changes to be committed:
  (use "git restore --staged <file>..." to unstage)
        modified:   fboss/agent/state/tests/InterfaceTests.cpp

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git restore <file>..." to discard changes in working directory)
        modified:   fboss/agent/state/tests/InterfaceTests.cpp

[root@2ce8c3df3a07 fboss]# git diff
diff --git a/fboss/agent/state/tests/InterfaceTests.cpp b/fboss/agent/state/tests/InterfaceTests.cpp
index fc8685394d..f577b28dcc 100644
--- a/fboss/agent/state/tests/InterfaceTests.cpp
+++ b/fboss/agent/state/tests/InterfaceTests.cpp
@@ -801,7 +801,8 @@ TEST(Interface, getRemoteInterfacesBySwitchId) {

   remoteInterfaces->addNode(
       rif,
-      HwSwitchMatcher(std::unordered_set<SwitchID>(
+      HwSwitchMatcher(
+          std::unordered_set<SwitchID>(
               {static_cast<SwitchID>(static_cast<uint16_t>(remoteSwitchId))})));

   EXPECT_EQ(stateV2->getInterfaces(SwitchID(remoteSwitchId))->size(), 1);

@joseph5wu joseph5wu self-assigned this Oct 29, 2025
@meta-cla meta-cla bot added the CLA Signed label Oct 29, 2025
@meta-codesync
Copy link

meta-codesync bot commented Oct 29, 2025

@joseph5wu has imported this pull request. If you are a Meta employee, you can view this in D85806947.

@meta-codesync meta-codesync bot closed this in 669b74a Oct 29, 2025
@meta-codesync
Copy link

meta-codesync bot commented Oct 29, 2025

@joseph5wu merged this pull request in 669b74a.

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.

3 participants