codemaid
codemaid copied to clipboard
Reorganize feature to include operators?
Environment
- Visual Studio version: Visual Studio 2015 Professional Update 3
- CodeMaid version: 10.1
- Code language: C#
Description
Replace this text with a short description and code sample.
Steps to recreate
- Create a class with a public property, method and operator
- Use the CodeMaid Reorganize method
Current behavior
Our team currently uses the following order for reorganizing with CodeMaid:
- Fields
- Constructors
- Destructors
- Delegates
- Events
- Properties
- Indexers
- Methods
- Enums
- Interfaces
- Structs
- Classes
When a class also contains an operator, the operator is classified as a method. For example an operator with the following signature:
public static bool operator !=(MyType left, MyType right)
Our team also uses StyleCop.Analyzers for code quality assurance. One of the rules we are using is SA1201. This rule fails however when the operator is not grouped between the Properties and Methods. It fails with the message: 'A operator should not follow a method'.
Expected behavior
Is it possible to include operators as a separate group when reorganizing? I'd like to have control over this group when determining the order in the CodeMaid Options dialog (within menu Reorganizing > Types).
Thanks for the suggestion, and clear request. Before implementation of this request, it may be worthwhile to see if there are any other exception cases for methods. Indexers (e.g. this[]) was one we previously caught because it stood out in the API.
https://github.com/DotNetAnalyzers/StyleCopAnalyzers/issues/680
Missing operator sort breaks SA1201