IntelliTect / CodingGuidelines

A repository to contain IntelliTect's tools for coding conventions
https://intellitect.github.io/CodingGuidelines/
MIT License
11 stars 17 forks source link

Include Roslynator.Analyzers and Roslynator.CodeFixes with more strict default severity levels #83

Open ascott18 opened 4 years ago

ascott18 commented 4 years ago

Introduce https://github.com/JosefPihrt/Roslynator, which has 500+ analyzers, and also a large number of refactorings.

Lists of each:

http://pihrt.net/Roslynator/Analyzers http://pihrt.net/Roslynator/Refactorings

Here's a very preliminary set of some recommendations for default severities. This is by no means exhaustive and is only the set that I came up with upon looking at the Info level severity issues from a single project I'm working on at the moment.

For some of these that aren't already covered, corresponding rules should be added to the C# standards.

# RCS1001: Add braces (when expression spans over multiple lines).
dotnet_diagnostic.RCS1001.severity = error

# RCS1003: Add braces to if-else (when expression spans over multiple lines).
dotnet_diagnostic.RCS1003.severity = error

# RCS1007: Add braces
dotnet_diagnostic.RCS1007.severity = error

# RCS1044: Remove original exception from throw statement
dotnet_diagnostic.RCS1044.severity = error

# RCS1123: Add parentheses according to operator precedence.
dotnet_diagnostic.RCS1123.severity = error

# RCS1037: Remove trailing white-space.
dotnet_diagnostic.RCS1037.severity = none

# RCS1036: Remove redundant empty line.
dotnet_diagnostic.RCS1036.severity = none

# RCS1170: Use read-only auto-implemented property.
dotnet_diagnostic.RCS1170.severity = warning

# RCS1213: Remove unused member declaration.
dotnet_diagnostic.RCS1213.severity = warning
ascott18 commented 4 years ago

There's also Roslynator.Formatting.Analyzers for formatting-only analyzers:

https://github.com/JosefPihrt/Roslynator/tree/master/src/Formatting.Analyzers

Keboo commented 4 years ago

As per discussion. We want to do the following:

~1. Update IntelliTect Analyzer NuGet to take a dependency on Roslynator.Analyzers~

  1. Update default .editorconfig with the proposed defaults from Andrew above.
adamskt commented 3 years ago

I think we should update the .editorconfig to add a section to include the Roslynator rules, and allow consumers to choose whether to bring in the dependency on Roslynator. Rules that don't match existing tooling won't break anything if included in the config file.