codemaid icon indicating copy to clipboard operation
codemaid copied to clipboard

Reorganize feature to include operators?

Open HermanCordes opened this issue 9 years ago • 3 comments

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

  1. Create a class with a public property, method and operator
  2. 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).

HermanCordes avatar Sep 06 '16 11:09 HermanCordes

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.

codecadwallader avatar Sep 06 '16 11:09 codecadwallader

https://github.com/DotNetAnalyzers/StyleCopAnalyzers/issues/680

wwuck avatar Sep 27 '16 06:09 wwuck

Missing operator sort breaks SA1201

SymbioticKilla avatar May 12 '22 15:05 SymbioticKilla