Skip to content
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

IDE0290: Fix JsonObject structs/classes to use primary constructors #25142

Conversation

ArmaanMcleod
Copy link
Contributor

PR Summary

I have fixed some of the structs/classes in JsonObject to use primary constructors to simplify code.

Rule: https://learn.microsoft.com/en-gb/dotnet/fundamentals/code-analysis/style-rules/ide0290

Which is from csharp_style_prefer_primary_constructors which is set to true by default.

PR Context

PR Checklist

@ArmaanMcleod ArmaanMcleod changed the title IDE0290: Fix JsonObject to use primary constructors IDE0290: Fix JsonObject structs/classes to use primary constructors Mar 8, 2025
@iSazonov
Copy link
Collaborator

iSazonov commented Mar 8, 2025

We would have to fix the entire codebase to make this rule mandatory. That would be a lot of work. I don't see the point in that.
But if this is recommended by default, contributors could use the new syntax for the new code.
I suggest to close the PR.
If you want to do something really useful in the area you could look our discussion about migrating from .globalconfig and Settings.StyleCop to .editorconfig. That would be really helpful.

@ArmaanMcleod
Copy link
Contributor Author

We would have to fix the entire codebase to make this rule mandatory. That would be a lot of work. I don't see the point in that. But if this is recommended by default, contributors could use the new syntax for the new code. I suggest to close the PR. If you want to do something really useful in the area you could look our discussion about migrating from .globalconfig and Settings.StyleCop to .editorconfig. That would be really helpful.

@iSazonov Yeah wasn't sure with this one. I came across it but it seems like many files which need fixing when I did "Fix All", and some errors from moving some of the classes to primary constructors. I'll close the PR since this one seems less worth it than the other PR which provides performance gain.

Copy link
Contributor

microsoft-github-policy-service bot commented Mar 8, 2025

📣 Hey @ArmaanMcleod, how did we do? We would love to hear your feedback with the link below! 🗣️

🔗 https://aka.ms/PSRepoFeedback

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