<commit_before>using System;
using System.CodeDom;
using System.Collections.Generic;
using System.Linq;

namespace PublicApiGenerator
{
    internal static class CodeTypeDeclarationExtensions
    {
        public static CodeTypeDeclaration Sort(this CodeTypeDeclaration original)
        {
            if (original.IsEnum)
            {
                return original;
            }

            var sorted = new CodeTypeDeclaration(original.Name)
            {
                Attributes = original.Attributes,
                CustomAttributes = original.CustomAttributes,
                IsClass = original.IsClass,
                IsEnum = original.IsEnum,
                IsInterface = original.IsInterface,
                IsPartial = original.IsPartial,
                IsStruct = original.IsStruct,
                LinePragma = original.LinePragma,
                Name = original.Name,
                TypeAttributes = original.TypeAttributes,
            };

            sorted.BaseTypes.AddRange(original.BaseTypes);
            sorted.Comments.AddRange(original.Comments);
            sorted.EndDirectives.AddRange(original.EndDirectives);
            sorted.StartDirectives.AddRange(original.StartDirectives);
            sorted.TypeParameters.AddRange(original.TypeParameters);

            foreach (var key in original.UserData.Keys)
            {
                sorted.UserData[key] = original.UserData[key];
            }

            var emptyParamList = new List<CodeParameterDeclarationExpression>();

            var sortedMembers = original.Members.OfType<CodeTypeMember>()
                .OrderBy(m => m.GetType().Name, StringComparer.Ordinal)
                .ThenBy(m => m.Name, StringComparer.Ordinal)
                .ThenBy(m => m is CodeMemberMethod method
                            ? method.TypeParameters.Count
                            : 0)
                .ThenBy(m => m is CodeMemberMethod method
                            ? method.Parameters.OfType<CodeParameterDeclarationExpression>().ToList()
                            : emptyParamList,
                        new ParamListComparer());

            foreach (var member in sortedMembers)
            {
                sorted.Members.Add(member);
            }<commit_msg>fixup! green: fix member ordering<commit_after>using System;
using System.CodeDom;
using System.Collections.Generic;
using System.Linq;

namespace PublicApiGenerator
{
    internal static class CodeTypeDeclarationExtensions
    {
        public static CodeTypeDeclaration Sort(this CodeTypeDeclaration original)
        {
            if (original.IsEnum)
            {
                return original;
            }

            var sorted = new CodeTypeDeclaration(original.Name)
            {
                Attributes = original.Attributes,
                CustomAttributes = original.CustomAttributes,
                IsClass = original.IsClass,
                IsEnum = original.IsEnum,
                IsInterface = original.IsInterface,
                IsPartial = original.IsPartial,
                IsStruct = original.IsStruct,
                LinePragma = original.LinePragma,
                Name = original.Name,
                TypeAttributes = original.TypeAttributes,
            };

            sorted.BaseTypes.AddRange(original.BaseTypes);
            sorted.Comments.AddRange(original.Comments);
            sorted.EndDirectives.AddRange(original.EndDirectives);
            sorted.StartDirectives.AddRange(original.StartDirectives);
            sorted.TypeParameters.AddRange(original.TypeParameters);

            foreach (var key in original.UserData.Keys)
            {
                sorted.UserData[key] = original.UserData[key];
            }

            var emptyParamList = new List<CodeParameterDeclarationExpression>();

            var sortedMembers = original.Members.OfType<CodeTypeMember>()
                .OrderBy(m => m.Attributes.HasFlag(MemberAttributes.Static))
                .ThenBy(m => m.GetType().Name, StringComparer.Ordinal)
                .ThenBy(m => m.Name, StringComparer.Ordinal)
                .ThenBy(m => m is CodeMemberMethod method
                            ? method.TypeParameters.Count
                            : 0)
                .ThenBy(m => m is CodeMemberMethod method
                            ? method.Parameters.OfType<CodeParameterDeclarationExpression>().ToList()
                            : emptyParamList,
                        new ParamListComparer());

            foreach (var member in sortedMembers)
            {
                sorted.Members.Add(member);
            }
{'fraction_non_alphanumeric': 0.07725507121277514, 'fraction_numerical': 0.00043159257660768235, 'mean_word_length': 1.6916376306620209, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 18, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3951946', 'n_tokens_mistral': 1087, 'n_tokens_neox': 1046, 'n_words': 196}