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

[Improvement] Add static code analyzers #2760

Closed
Evangelink opened this issue Jul 16, 2021 · 5 comments · Fixed by #2761
Closed

[Improvement] Add static code analyzers #2760

Evangelink opened this issue Jul 16, 2021 · 5 comments · Fixed by #2761
Milestone

Comments

@Evangelink
Copy link
Contributor

I would like to suggest to install Microsoft.CodeAnalysis.NetAnalyzers to enhance code quality and also Microsoft.CodeAnalysis.CSharp.CodeStyle for styling/formatting rules.

This would help this project to increase the overall quality but also help to enforce certain code style you would like to see.

Detailed Description

Context

The first package would help to prevent certain code smells and future bugs to sneak into the codebase. The second helps to have a defined code style and could help contributors to "code" the way you prefer.

Possible Implementation

There are a lot of alternative code analyzers but these two are Microsoft actively contributed and are becoming a defacto standard in .NET5+ (can be opt-in/opt-out).

@arturcic
Copy link
Member

That would be a nice addition. After we add the packages we'll need to fix the code to conform the styles. And then we can increase the level from warning to error

@arturcic
Copy link
Member

Do you mind making a PR? Adding the packages and fixing the code?

@Evangelink
Copy link
Contributor Author

That's absolutely fine. I will go with the default set of rules and let you decide if there are specific you would like to enable (or disable).

@asbjornu
Copy link
Member

This would be great. I've started asbjornu#25 which I'm struggling to get past the tests, but please have a look at the code style I'm aiming for there so we can get compatibility between ReSharper (.DotSettings) and Microsoft.CodeAnalysis.CSharp.CodeStyle (if possible).

@github-actions
Copy link

🎉 This issue has been resolved in version 5.6.11 🎉
The release is available on:

Your GitReleaseManager bot 📦🚀

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

Successfully merging a pull request may close this issue.

3 participants