From 0682b41ee5f6aeb8ca79eef40741de9f06b114db Mon Sep 17 00:00:00 2001 From: "deepsource-autofix[bot]" <62050782+deepsource-autofix[bot]@users.noreply.github.com> Date: Sat, 30 Sep 2023 00:06:29 +0000 Subject: [PATCH] style: format code with dotnet-format This commit fixes the style issues introduced in f92a133 according to the output from dotnet-format. Details: None --- Decomposer/src/DecomposerConstants.cs | 128 +++++++++++++------------- 1 file changed, 66 insertions(+), 62 deletions(-) diff --git a/Decomposer/src/DecomposerConstants.cs b/Decomposer/src/DecomposerConstants.cs index 76fd09e..7c4bbe0 100644 --- a/Decomposer/src/DecomposerConstants.cs +++ b/Decomposer/src/DecomposerConstants.cs @@ -62,34 +62,36 @@ internal static class Constants public const string DecomposedPropertyDeclaration = GeneratedCodeAttributes + """ - {{ property_type }} - {{ property_name }} - { {{ if is_gettable }} get; {{ end }} {{ if is_settable }} set; {{ end }} } - { {{ if is_gettable }} get; {{ end }} {{ if is_settable }} set; {{ end }} } - """; + {{ property_type + } +} +{ { property_name } } +{ { { if is_gettable } } get; { { end } } { { if is_settable } } set; { { end } } } +{ { { if is_gettable } } get; { { end } } { { if is_settable } } set; { { end } } } +"""; public const string DecomposedMethodDeclaration = GeneratedCodeAttributes + """ - {{ return_type }} - {{ method_name }} ({ { for parameter in parameters }} - {{ parameter.type }} - {{ parameter.name }} - {{ if not loop.last }}, {{ endif }} - {{ endfor }}) - {{ if has_generic_type_constraints }} - {{ for generic_type_constraint in generic_type_constraints }} - where - {{ generic_type_constraint.name }} : {{ type_constraint.constraint }} - {{ endfor }} - {{ endif }} - """; - - public const string DecomposableAttributeFilename = "DecomposableAttribute.g.cs"; + { { return_type } } +{ { method_name } } ({ { for parameter in parameters } } +{ { parameter.type } } +{ { parameter.name } } +{ { if not loop.last } }, { { endif } } +{ { endfor } }) + { { if has_generic_type_constraints } } +{ { for generic_type_constraint in generic_type_constraints } } +where +{ { generic_type_constraint.name } } : { { type_constraint.constraint } } +{ { endfor } } +{ { endif } } +"""; - public const string DecomposableAttributeDeclaration = - DecomposedInterfaceHeader - + """ + public const string DecomposableAttributeFilename = "DecomposableAttribute.g.cs"; + +public const string DecomposableAttributeDeclaration = + DecomposedInterfaceHeader + + """ [global::System.AttributeUsage(global::System.AttributeTargets.Class | global::System.AttributeTargets.Struct | global::System.AttributeTargets.Interface | global::System.AttributeTargets.Assembly)] public sealed class DecomposeAttribute : global::System.Attribute { @@ -99,32 +101,34 @@ public DecomposeAttribute(global::System.Type type, string @namespace = null) { """; public const string IComposedClassDeclaration = """ - public partial class {{ class_name }} : { { for type_member_tuple in decomposed_from } } - IDecomposed <{{ decomposed_from.type }}> - { - {{ for type_member_tuple in decomposed_from }} - {{ if type_member_tuple.member.is_property }} - public - {{~ type_member_tuple.member.type }} - {{~ type_member_tuple.member.name }} - {{ get; }} - {{ elif type_member_tuple.member.is_method }} - public - {{ decomposed_from.type }} - {{ decomposed_from.member }} {{ get; }} - {{ endfor }} - - - public - {{ class_name }} ({ decomposed_from } decomposed) - { - { decomposed_from } = decomposed; - } - - public - { decomposed_from } - { decomposed_from } - {{ get; }} + public partial class {{ class_name }} : { { for type_member_tuple in decomposed_from } } +IDecomposed <{ { decomposed_from.type } }> + { + { { for type_member_tuple in decomposed_from } } + { { if type_member_tuple.member.is_property } } + public +{ { ~type_member_tuple.member.type } } +{ { ~type_member_tuple.member.name } } +{ { get; } } +{ { elif type_member_tuple.member.is_method } } +public +{ { decomposed_from.type } } +{ { decomposed_from.member } } +{ { get; } } +{ { endfor } } + + +public +{ { class_name } } ({ decomposed_from } +decomposed) + { + { decomposed_from } = decomposed; +} + +public +{ decomposed_from } +{ decomposed_from } +{ { get; } } } """; @@ -156,18 +160,18 @@ public DecomposeAttribute(global::System.Type type, string @namespace = null) { | SymbolDisplayMiscellaneousOptions.UseErrorTypeSymbolName | SymbolDisplayMiscellaneousOptions.IncludeNullableReferenceTypeModifier | SymbolDisplayMiscellaneousOptions.IncludeNotNullableReferenceTypeModifier - ); - - internal const string AttributeName = "Decompose"; - internal const string AttributeFullName = AttributeName + nameof(Attribute); - internal const string InterfaceNamePrefix = "I"; - internal const string InterfaceSuffix = "Decomposition"; - internal const string NamespaceSuffix = ".Decompositions"; - internal const string SourceFileNameSuffix = ".Decompositions.g.cs"; - internal const string GeneratedCodeAttributeName = "GeneratedCodeAttribute"; - internal const string GeneratedCodeAttributeFullName = - $"System.Diagnostics.CodeAnalysis.{GeneratedCodeAttributeName}"; - internal const string CompilerGeneratedAttributeFullName = - "System.Runtime.CompilerServices.CompilerGeneratedAttribute"; + ); + +internal const string AttributeName = "Decompose"; +internal const string AttributeFullName = AttributeName + nameof(Attribute); +internal const string InterfaceNamePrefix = "I"; +internal const string InterfaceSuffix = "Decomposition"; +internal const string NamespaceSuffix = ".Decompositions"; +internal const string SourceFileNameSuffix = ".Decompositions.g.cs"; +internal const string GeneratedCodeAttributeName = "GeneratedCodeAttribute"; +internal const string GeneratedCodeAttributeFullName = + $"System.Diagnostics.CodeAnalysis.{GeneratedCodeAttributeName}"; +internal const string CompilerGeneratedAttributeFullName = + "System.Runtime.CompilerServices.CompilerGeneratedAttribute"; } }