-
Notifications
You must be signed in to change notification settings - Fork 269
Ensure that all comments are complete sentences as per guidelines #4760
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Alan-Jowett
wants to merge
8
commits into
microsoft:main
Choose a base branch
from
Alan-Jowett:comment_grammer
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
eacec2c
Ensure that all comments are complete sentences as per guidelines
28ddeac
PR feedback
db022fb
Update expected output
d14ca7c
Ensure that all comments are complete sentences as per guidelines
001ded3
PR feedback
b9f9ee2
Update expected output
9502e06
Add comprehensive GitHub Copilot instructions for eBPF for Windows
f28aee6
Merge branch 'comment_grammer' of https://github.com/Alan-Jowett/ebpf…
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,82 @@ | ||
| # Copilot Instructions for eBPF for Windows | ||
|
|
||
| When working on the eBPF for Windows project, please follow these guidelines to ensure code quality and consistency. | ||
|
|
||
| ## Comment Guidelines | ||
|
|
||
| ### Comment Formatting | ||
| - **All comments MUST be complete sentences ending with proper punctuation (periods).** | ||
| - Single-line comments should start with `//` followed by a space and a complete sentence ending with a period. | ||
| - Multi-line comments should follow the same complete sentence rule for each line. | ||
| - Inline comments should also be complete sentences ending with periods. | ||
|
|
||
| **Examples:** | ||
| ```c | ||
| // This is a correct comment. | ||
| /* This is also a correct multi-line comment. */ | ||
|
|
||
| // Correct: Calculate the hash value for the key. | ||
| int hash = calculate_hash(key); | ||
|
|
||
| // Incorrect: Calculate the hash value for the key | ||
| // Incorrect: calculate hash value | ||
| ``` | ||
|
|
||
| ### Comment Content | ||
| - Comments should be clear, concise, and add value to understanding the code. | ||
| - Avoid stating the obvious; focus on explaining why, not what. | ||
| - Use doxygen comments with `\[in,out\]` direction annotations for all public API headers. | ||
|
|
||
| ## Coding Conventions | ||
|
|
||
| ### Naming Conventions | ||
| - Use `lower_snake_case` for variable, member/field, and function names. | ||
| - Use `UPPER_SNAKE_CASE` for macro names and constants. | ||
| - Prefix eBPF specific names in the global namespace with `ebpf_` (e.g., `ebpf_result_t`). | ||
| - Prefix names with `_` to indicate internal and private fields or methods. | ||
| - Prefix struct definitions with `_` and always create a typedef with the suffix `_t`. | ||
|
|
||
| ### Type Usage | ||
| - Use fixed length types from `stdint.h` (e.g., `int64_t`, `uint8_t`) instead of language keywords. | ||
| - Use `const` and `static` modifiers to scope exposure appropriately. | ||
|
|
||
| ### Code Structure | ||
| - Source lines MUST NOT exceed 120 columns. | ||
| - Single-line if/else/loop blocks MUST be enclosed in braces. | ||
| - Include local headers (with `""`) before system headers (with `<>`). | ||
| - List headers in alphabetical order where possible. | ||
| - Use `#pragma once` in all header files. | ||
|
|
||
| ### License Header | ||
| Every code file must include this license header: | ||
| ```c | ||
| // Copyright (c) eBPF for Windows contributors | ||
| // SPDX-License-Identifier: MIT | ||
| ``` | ||
|
|
||
| ## What NOT to Do | ||
|
|
||
| - **DON'T** use global variables where possible. | ||
| - **DON'T** use abbreviations unless they are well-known terms. | ||
| - **DON'T** use hard-coded magic numbers; use `#define`, enum, or const values. | ||
| - **DON'T** use commented-out code or code in `#if 0` blocks. | ||
| - **DON'T** leave comments without proper punctuation. | ||
|
|
||
| ## When Generating Code | ||
|
|
||
| 1. Ensure all comments are grammatically complete sentences with proper punctuation. | ||
| 2. Follow the established naming conventions consistently. | ||
| 3. Include appropriate error handling and input validation. | ||
| 4. Add doxygen comments for public APIs. | ||
| 5. Follow the existing code structure and formatting patterns in the file being modified. | ||
| 6. Use meaningful variable and function names that follow the project conventions. | ||
|
|
||
| ## Pull Request Guidelines | ||
|
|
||
| - Ensure existing tests continue to pass. | ||
| - Provide tests for every bug/feature that is completed. | ||
| - Format code using clang-format before submitting. | ||
| - Verify that all comments follow the complete sentence rule. | ||
| - Check that the code follows the project's naming conventions. | ||
|
|
||
| Remember: Code clarity and consistency are paramount. When in doubt, follow the existing patterns in the codebase and ensure all comments are complete, well-formed sentences. | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These duplicate text in docs/DevelopmentGuide.md which is fragile if someone changes one and not the other. Can we just tell copilot to follow the naming conventions in https://github.com/microsoft/ebpf-for-windows/blob/main/docs/DevelopmentGuide.md ?