-
-
Notifications
You must be signed in to change notification settings - Fork 61
Add copilot instructions #907
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
Merged
+64
−0
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
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,36 @@ | ||
| **Any code you commit SHOULD compile, and new and existing tests related to the change SHOULD pass.** | ||
|
|
||
| You MUST make your best effort to ensure your changes satisfy those criteria before committing. If for any reason you were unable to build or test the changes, you MUST report that. You MUST NOT claim success unless all builds and tests pass as described above. | ||
|
|
||
| Do not complete without checking the relevant code builds and relevant tests still pass after the last edits you make. Do not simply assume that your changes fix test failures you see, actually build and run those tests again to confirm. | ||
|
|
||
| You MUST follow all code-formatting and naming conventions defined in [`.editorconfig`](/.editorconfig). | ||
|
|
||
| In addition to the rules enforced by `.editorconfig`, you SHOULD: | ||
|
|
||
| - Prefer file-scoped namespace declarations and single-line using directives. | ||
| - Ensure that the final return statement of a method is on its own line. | ||
| - Use pattern matching and switch expressions wherever possible. | ||
| - Use `nameof` instead of string literals when referring to member names. | ||
| - Always use `is null` or `is not null` instead of `== null` or `!= null`. | ||
| - Trust the C# null annotations and don't add null checks when the type system says a value cannot be null. | ||
| - Prefer `?.` if applicable (e.g. `scope?.Dispose()`). | ||
| - Use `ObjectDisposedException.ThrowIf` where applicable. | ||
| - When adding new unit tests, strongly prefer to add them to existing test code files rather than creating new code files. | ||
| - When running tests, if possible use filters and check test run counts, or look at test logs, to ensure they actually ran. | ||
| - Do not finish work with any tests commented out or disabled that were not previously commented out or disabled. | ||
| - Do not update `global.json` file | ||
| - When writing tests, do not emit "Act", "Arrange" or "Assert" comments. | ||
| - There should be no trailing whitespace in any lines. | ||
| - There should be an empty line before the beginning of XML documentation comments if there is code before them. | ||
|
|
||
| ## Implementing Roslyn analyzers | ||
|
|
||
| - When creating a new rule, create a new constant in `src/Meziantou.Analyzer/RuleIdentifiers.cs` using the name of the new rule. The value must be unique and incremented from the last rule. | ||
| - The analyzers must be under `src/Meziantou.Analyzer/Rules/` | ||
| - The code fixers must be under `src/Meziantou.Analyzer.CodeFixers/Rules` | ||
| - The tests must be under `tests/Meziantou.Analyzer.Test/Rules` | ||
|
|
||
| The analyzer must use `IOperation` or `ISymbol` to analyze the content. Only fallback to `SyntaxNode` when the other ways are not supported. | ||
|
|
||
| The tests must indicates which part of the snippet must report a diagnostic using the `[|code|]` syntax or `{|id:code|}` syntax. Do not explicitly indicates lines or columns. |
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,28 @@ | ||
| # See https://docs.github.com/en/copilot/customizing-copilot/customizing-the-development-environment-for-copilot-coding-agent | ||
| name: "Copilot Setup Steps" | ||
| on: | ||
| workflow_dispatch: | ||
| push: | ||
| paths: | ||
| - .github/workflows/copilot-setup-steps.yml | ||
| pull_request: | ||
| paths: | ||
| - .github/workflows/copilot-setup-steps.yml | ||
|
|
||
|
|
||
| jobs: | ||
| # The job MUST be called `copilot-setup-steps` or it will not be picked up by Copilot. | ||
| copilot-setup-steps: | ||
| runs-on: ubuntu-latest | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v5 | ||
| - uses: actions/setup-dotnet@v5 | ||
meziantou marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| with: | ||
| global-json-file: './global.json' | ||
|
|
||
| - name: Restore solution | ||
| run: dotnet restore | ||
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.
Uh oh!
There was an error while loading. Please reload this page.