audaciaconsulting / Audacia.CodeAnalysis

MIT License
1 stars 3 forks source link

feature: updating base config to include ide rules #10

Closed Audacia-RhysSmith closed 7 months ago

Audacia-RhysSmith commented 9 months ago
Action Done?
Code compiles and unit tests all pass locally N/A
Debug/console log code removed N/A
Commented out code removed N/A
Unit tests added/updated N/A
README updated N/A
Considered:
- Performance
- Security
- Logging
N/A
Licenses of any new/upgraded dependencies checked, with no copyleft dependencies introduced N/A
jackpercy-acl commented 9 months ago

There is also rules IDE0240 to IDE0290 that have presumably been added more recently - worth getting those in here too?

OwenLacey28 commented 9 months ago

For my benefit, what are IDE rules & where to they come from? Is this something we should be replicating in other projects?

jackpercy-acl commented 9 months ago

@OwenLacey28 the IDEXXXX rules are rules made by .NET that are focused on code style rather than code quality.

Code quality analysis ("CAxxxx") rules inspect your C# or Visual Basic code for security, performance, design and other issues.

Code-style analysis ("IDExxxx") rules enable you to define and maintain consistent code style in your codebase.

https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/overview?tabs=net-8

Usually when this .editorconfig is updated, there will be a post in "Audacia Development Updates" recommending to incorporate these changes into your projects configs.

Audacia-RhysSmith commented 9 months ago

@OwenLacey28 @jackspercy The description on the Microsoft page is ".NET code-style analysis provides rules that aim to maintain consistent style in your codebase. These rules have an "IDE" prefix in the rule ID."

Here's the link if you would like a read of where the rules came from: https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/style-rules/

Audacia-RhysSmith commented 7 months ago

There is also rules IDE0240 to IDE0290 that have presumably been added more recently - worth getting those in here too?

Not sure how it will work if the project is .NET7 will it show as warning, but unable to resolve unless upgraded to .NET8?

jackpercy-acl commented 7 months ago

There is also rules IDE0240 to IDE0290 that have presumably been added more recently - worth getting those in here too?

Not sure how it will work if the project is .NET7 will it show as warning, but unable to resolve unless upgraded to .NET8?

@Audacia-RhysSmith they are C#12 rules so I assume if your version of C# is lower than that it won't warn you - so should be fine on .NET 7. Happy to leave out though.

Audacia-RhysSmith commented 7 months ago

There is also rules IDE0240 to IDE0290 that have presumably been added more recently - worth getting those in here too?

Not sure how it will work if the project is .NET7 will it show as warning, but unable to resolve unless upgraded to .NET8?

@Audacia-RhysSmith they are C#12 rules so I assume if your version of C# is lower than that it won't warn you - so should be fine on .NET 7. Happy to leave out though.

Tested it locally and ignores on .NET7, so happy to add. Added a few more which I think have also been added since this PR was made roughly IDE0251 to IDE0305.