Provide a sorting that works with StyleCop

Issue #2 resolved
Frederik Terstappen created an issue

It would be nice to have a sorting that is following the stylecop rules. I had to build one on my own but with the very short documentation its not so easy.

Comments (5)

  1. Dennis Kniep repo owner

    Added a button "StyleCop" to the page Resharper > Options > Greenkeeper > Sorting. This button overwrites the current sortingdefinition with a definition that matches the stylecop rules (StyleCop Sortingdefinition). There are still some tasks to solve this issue completely (sort for nested classes, nested structs, sort by interface regardless to the order). Could you give me some feedback if the EAP does what you expected.

    Download Greenkeeper 1.1 EAP or install it from the Resharper Extension Manager Greenkeeper Pre-release package.

  2. Frederik Terstappen reporter

    Seems to work fine.

    Way better than my little order-script

    <?xml version="1.0" encoding="utf-8"?>
    <DeclarationSortingDefinition>
        <DeclarationSorter type="DeclarationSorter"> 
            <DeclarationComparer type="MultiDeclarationComparer">
                <DeclarationComparer type="TypeDeclarationComparer" TypeOrder="Constant,Field,Constructor,Property,Method"/>        
                <DeclarationComparer type="ConditionalDeclarationComparer"> 
                    <DeclarationCondition type="TypeDeclarationCondition" Types="Method"/>
                    <DeclarationComparer type="MultiDeclarationComparer">   
                        <DeclarationComparer type="AccessRightsDeclarationComparer" AccessRightsOrder="PUBLIC,INTERNAL,PROTECTED,PRIVATE"/> 
                        <DeclarationComparer type="AlphanumericDeclarationComparer"/>
                        <DeclarationComparer type="ParameterCountDeclarationComparer"/>     
                    </DeclarationComparer> 
                </DeclarationComparer> 
                <DeclarationComparer type="ConditionalDeclarationComparer">
                    <DeclarationCondition type="TypeDeclarationCondition" Types="Constructor"/>
                    <DeclarationComparer type="ParameterCountDeclarationComparer"/>
                </DeclarationComparer>
            </DeclarationComparer>      
        </DeclarationSorter>
    </DeclarationSortingDefinition>
    
  3. Log in to comment