Skip to content

Conversation

@Behnam-Emamian
Copy link

Added guideline to include trailing commas in multi-line initializers to avoid MA0007 warnings.

Pull Request Checklist

  • I have read and followed the CONTRIBUTING.md guidelines.
  • My contribution adds a new instruction, prompt, or chat mode file in the correct directory.
  • The file follows the required naming convention.
  • The content is clearly structured and follows the example format.
  • I have tested my instructions, prompt, or chat mode with GitHub Copilot.
  • I have run npm start and verified that README.md is up to date.

Description


Type of Contribution

  • New instruction file.
  • New prompt file.
  • New chat mode file.
  • New collection file.
  • Update to existing instruction, prompt, chat mode, or collection.
  • Other (please specify):

Additional Notes

Added guideline to include trailing commas in multi-line initializers to avoid MA0007 warnings.


By submitting this pull request, I confirm that my contribution abides by the Code of Conduct and will be licensed under the MIT License.

Added guideline to include trailing commas in multi-line initializers to avoid MA0007 warnings.
Copilot AI review requested due to automatic review settings December 7, 2025 03:09
Copy link
Contributor

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 adds a C# formatting guideline to include trailing commas in multi-line initializers to avoid MA0007 analyzer warnings from the Meziantou.Analyzer tooling.

  • Adds a single formatting guideline to the existing C# instruction file

- Use pattern matching and switch expressions wherever possible.
- Use `nameof` instead of string literals when referring to member names.
- Ensure that XML doc comments are created for any public APIs. When applicable, include `<example>` and `<code>` documentation in the comments.
- Add a trailing comma after the last value in multi-line arrays, collection initializers, object initializers, and enum declarations to prevent MA0007 warnings.
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm unfamiliar with this warning - it does not appear to be part of the Roslyn analyser stack

Copy link
Author

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah ok. I'll admit to not being familiar with that analayzer stack.

Given that, I think this is a little overly specific for the generate C# instructions, especially as it's only one of the nearly 200 analyzer rules in that nuget package. I would suggest creating a dedicated instructions file that people can optionally layer in if they are using that analyzer too.

Copy link
Author

Choose a reason for hiding this comment

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

what should be the name of the file of the instruction?

Copy link
Contributor

Choose a reason for hiding this comment

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

meziantou-analuzer-rules.instructions.md would probably make sense

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants