Ongoing existing rules list that could be analyzed/implemented in our C# project. They seem to be good candidates but need reviewing first.
From Roslynator:
- Optimize LINQ method call: RCS1077
- Use string.Length instead of comparison with empty string: RCS1156
- Use 'is' operator instead of 'as' operator: RCS1172
- Unnecessary assignment: RCS1179
- Use constant instead of field : RCS1187
- Optimize StringBuilder.Append/AppendLine call : RCS1197
- Avoid unnecessary boxing of value type : RCS1198
- Optimize method call : RCS1235
- Do not pass non-read-only struct by read-only reference : RCS1242
From Meziantou Analyzer:
- Use EventArgs.Empty: MA0019
- Use direct methods instead of LINQ methods: MA0020
- Optimize StringBuilder usage: MA0028
- Combine LINQ methods: MA0029
- Optimize Enumerable.Count() usage: MA0031
- Do not use blocking calls in an async method: MA0042
- Do not use finalizer: MA0055
- Use Where before OrderBy: MA0063
- Default ValueType.Equals or HashCode is used for struct equality: MA0065
- Use 'Cast' instead of 'Select' to cast: MA0078
- Optimize string method usage: MA0089
- Use the Regex source generator: MA0110
From SonarQube:
- Private fields only used as local variables in methods should become local variables: S1450
- Properties should not make collection or array copies: S2365
- "StringBuilder" data should be used: S3063
- "Assembly.GetExecutingAssembly" should not be called: S3902
- "static readonly" constants should be "const" instead: S3962
- Non-abstract attributes should be sealed: S4060
Rules that are natively implemented in Roslyn, that we could transitively enable: