Skip to content

Instantly share code, notes, and snippets.

@iam3yal
Forked from sliekens/TypeMemberLayout.xaml
Last active July 14, 2023 01:10
Show Gist options
  • Save iam3yal/dd92f7ea3ab57e4e2960eb37c4072ce5 to your computer and use it in GitHub Desktop.
Save iam3yal/dd92f7ea3ab57e4e2960eb37c4072ce5 to your computer and use it in GitHub Desktop.
StyleCop Type Member Layout for Rider and ReSharper
<Patterns xmlns="urn:schemas-jetbrains-com:member-reordering-patterns">
<TypePattern DisplayName="Non-reorderable types">
<TypePattern.Match>
<Or>
<And>
<Kind Is="Interface" />
<Or>
<HasAttribute Name="System.Runtime.InteropServices.InterfaceTypeAttribute" />
<HasAttribute Name="System.Runtime.InteropServices.ComImport" />
</Or>
</And>
<Kind Is="Struct" />
<HasAttribute Name="JetBrains.Annotations.NoReorderAttribute" />
<HasAttribute Name="JetBrains.Annotations.NoReorder" />
</Or>
</TypePattern.Match>
</TypePattern>
<TypePattern DisplayName="xUnit.net Test Classes" RemoveRegions="All">
<TypePattern.Match>
<And>
<Kind Is="Class" />
<HasMember>
<And>
<Kind Is="Method" />
<HasAttribute Name="Xunit.FactAttribute" Inherited="True" />
<HasAttribute Name="Xunit.TheoryAttribute" Inherited="True" />
</And>
</HasMember>
</And>
</TypePattern.Match>
<Entry DisplayName="Setup/Teardown Methods">
<Entry.Match>
<Or>
<Kind Is="Constructor" />
<And>
<Kind Is="Method" />
<ImplementsInterface Name="System.IDisposable" />
</And>
</Or>
</Entry.Match>
<Entry.SortBy>
<Kind>
<Kind.Order>
<DeclarationKind>Constructor</DeclarationKind>
</Kind.Order>
</Kind>
</Entry.SortBy>
</Entry>
<Entry DisplayName="All other members" />
<Entry DisplayName="Test Methods" Priority="100">
<Entry.Match>
<And>
<Kind Is="Method" />
<HasAttribute Name="Xunit.FactAttribute" Inherited="false" />
<HasAttribute Name="Xunit.TheoryAttribute" Inherited="false" />
</And>
</Entry.Match>
<Entry.SortBy>
<Name />
</Entry.SortBy>
</Entry>
</TypePattern>
<TypePattern DisplayName="NUnit Test Fixtures" RemoveRegions="All">
<TypePattern.Match>
<And>
<Kind Is="Class" />
<Or>
<HasAttribute Name="NUnit.Framework.TestFixtureAttribute" Inherited="true" />
<HasAttribute Name="NUnit.Framework.TestFixtureSourceAttribute" Inherited="true" />
<HasMember>
<And>
<Kind Is="Method" />
<HasAttribute Name="NUnit.Framework.TestAttribute" Inherited="false" />
<HasAttribute Name="NUnit.Framework.TestCaseAttribute" Inherited="false" />
<HasAttribute Name="NUnit.Framework.TestCaseSourceAttribute" Inherited="false" />
</And>
</HasMember>
</Or>
</And>
</TypePattern.Match>
<Entry DisplayName="Setup/Teardown Methods">
<Entry.Match>
<And>
<Kind Is="Method" />
<Or>
<HasAttribute Name="NUnit.Framework.SetUpAttribute" Inherited="true" />
<HasAttribute Name="NUnit.Framework.TearDownAttribute" Inherited="true" />
<HasAttribute Name="NUnit.Framework.TestFixtureSetUpAttribute" Inherited="true" />
<HasAttribute Name="NUnit.Framework.TestFixtureTearDownAttribute" Inherited="true" />
<HasAttribute Name="NUnit.Framework.OneTimeSetUpAttribute" Inherited="true" />
<HasAttribute Name="NUnit.Framework.OneTimeTearDownAttribute" Inherited="true" />
</Or>
</And>
</Entry.Match>
</Entry>
<Entry DisplayName="All other members" />
<Entry DisplayName="Test Methods" Priority="100">
<Entry.Match>
<And>
<Kind Is="Method" />
<HasAttribute Name="NUnit.Framework.TestAttribute" Inherited="false" />
<HasAttribute Name="NUnit.Framework.TestCaseAttribute" Inherited="false" />
<HasAttribute Name="NUnit.Framework.TestCaseSourceAttribute" Inherited="false" />
</And>
</Entry.Match>
<Entry.SortBy>
<Name />
</Entry.SortBy>
</Entry>
</TypePattern>
<TypePattern DisplayName="StyleCop Layout Based Pattern">
<Entry DisplayName="Constants">
<Entry.Match>
<Kind Is="Constant" />
</Entry.Match>
<Entry.SortBy>
<Access Order="Public Internal ProtectedInternal Protected Private" />
<Name />
</Entry.SortBy>
</Entry>
<Entry DisplayName="Static Fields">
<Entry.Match>
<And>
<Kind Is="Field" />
<Static />
</And>
</Entry.Match>
<Entry.SortBy>
<Kind Order="Constant Field" />
<Access Order="Public Internal ProtectedInternal Protected Private" />
<Readonly />
<Name />
</Entry.SortBy>
</Entry>
<Entry DisplayName="Fields">
<Entry.Match>
<Kind Is="Field" />
</Entry.Match>
<Entry.SortBy>
<Access Order="Public Internal ProtectedInternal Protected Private" />
<Readonly />
<Name />
</Entry.SortBy>
</Entry>
<Entry DisplayName="Constructors and Destructors" Priority="100">
<Entry.Match>
<Or>
<Kind Is="Constructor" />
<Kind Is="Destructor" />
</Or>
</Entry.Match>
<Entry.SortBy>
<Static />
<Kind Order="Constructor Destructor" />
<Access Order="Public Internal ProtectedInternal Protected Private" />
</Entry.SortBy>
</Entry>
<Entry DisplayName="Delegates">
<Entry.Match>
<Kind Is="Delegate" />
</Entry.Match>
<Entry.SortBy>
<Access Order="Public Internal ProtectedInternal Protected Private" />
<Static />
<Name />
</Entry.SortBy>
</Entry>
<Entry DisplayName="Public Events">
<Entry.Match>
<And>
<Access Is="Public" />
<Kind Is="Event" />
</And>
</Entry.Match>
<Entry.SortBy>
<Access Order="Public" />
<Static />
<Name />
</Entry.SortBy>
</Entry>
<Entry DisplayName="Interface Events">
<Entry.Match>
<And>
<Kind Is="Event" />
<ImplementsInterface />
</And>
</Entry.Match>
<Entry.SortBy>
<ImplementsInterface Immediate="True" />
<Name />
</Entry.SortBy>
</Entry>
<Entry DisplayName="Other Events">
<Entry.Match>
<Kind Is="Event" />
</Entry.Match>
<Entry.SortBy>
<Access Order="Public Internal ProtectedInternal Protected Private" />
<Static />
<Name />
</Entry.SortBy>
</Entry>
<Entry DisplayName="Enums">
<Entry.Match>
<Kind Is="Enum" />
</Entry.Match>
<Entry.SortBy>
<Access Order="Public Internal ProtectedInternal Protected Private" />
<Name />
</Entry.SortBy>
</Entry>
<Entry DisplayName="Public Properties">
<Entry.Match>
<And>
<Kind Is="Property" />
<Access Is="Public" />
</And>
</Entry.Match>
<Entry.SortBy>
<Access Order="Public" />
<Static />
<Name />
</Entry.SortBy>
</Entry>
<Entry DisplayName="Interface Properties">
<Entry.Match>
<And>
<Kind Is="Property" />
<ImplementsInterface />
</And>
</Entry.Match>
<Entry.SortBy>
<ImplementsInterface Immediate="True" />
<Name />
</Entry.SortBy>
</Entry>
<Entry DisplayName="Other Properties">
<Entry.Match>
<Kind Is="Property" />
</Entry.Match>
<Entry.SortBy>
<Access Order="Public Internal ProtectedInternal Protected Private" />
<Static />
<Name />
</Entry.SortBy>
</Entry>
<Entry DisplayName="Public Indexers" Priority="100">
<Entry.Match>
<And>
<Kind Is="Indexer" />
<Access Is="Public" />
</And>
</Entry.Match>
<Entry.SortBy>
<Access Order="Public" />
<Static />
<Name />
</Entry.SortBy>
</Entry>
<Entry DisplayName="Interface Indexers" Priority="100">
<Entry.Match>
<And>
<Kind Is="Indexer" />
<ImplementsInterface />
</And>
</Entry.Match>
<Entry.SortBy>
<ImplementsInterface Immediate="True" />
<Name />
</Entry.SortBy>
</Entry>
<Entry DisplayName="Other indexers" Priority="100">
<Entry.Match>
<Kind Is="Indexer" />
</Entry.Match>
<Entry.SortBy>
<Access Order="Public Internal ProtectedInternal Protected Private" />
<Static />
<Name />
</Entry.SortBy>
</Entry>
<Entry DisplayName="Public Methods">
<Entry.Match>
<And>
<Kind Is="Method" />
<Access Is="Public" />
</And>
</Entry.Match>
<Entry.SortBy>
<Access Order="Public" />
<Static />
<Name />
</Entry.SortBy>
</Entry>
<Entry DisplayName="Interface Methods">
<Entry.Match>
<And>
<Kind Is="Method" />
<ImplementsInterface />
</And>
</Entry.Match>
<Entry.SortBy>
<ImplementsInterface Immediate="True" />
<Name />
</Entry.SortBy>
</Entry>
<Entry DisplayName="Other Methods">
<Entry.Match>
<Kind Is="Method" />
</Entry.Match>
<Entry.SortBy>
<Access Order="Public Internal ProtectedInternal Protected Private" />
<Static />
<Name />
</Entry.SortBy>
</Entry>
<Entry DisplayName="Operators">
<Entry.Match>
<Kind Is="Operator" />
</Entry.Match>
<Entry.SortBy>
<Access Order="Public Internal ProtectedInternal Protected Private" />
<Static />
<Name />
</Entry.SortBy>
</Entry>
<Entry DisplayName="Nested Types" Priority="150">
<Entry.Match>
<Or>
<Kind Is="Interface" />
<Kind Is="Class" />
<Kind Is="Record" />
<Kind Is="Struct" />
</Or>
</Entry.Match>
<Entry.SortBy>
<Kind Order="Interface Class Record Struct" />
<Access Order="Public Internal ProtectedInternal Protected Private" />
<Name />
</Entry.SortBy>
</Entry>
<Entry DisplayName="All other members" />
</TypePattern>
</Patterns>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment