Skip to content

Commit

Permalink
更新 .editorconfig
Browse files Browse the repository at this point in the history
  • Loading branch information
Roc committed Mar 26, 2021
1 parent d014026 commit 7f73807
Show file tree
Hide file tree
Showing 5 changed files with 123 additions and 107 deletions.
126 changes: 71 additions & 55 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -27,93 +27,99 @@ dotnet_sort_system_directives_first = true
file_header_template = unset

# this. 和 Me. 首选项
dotnet_style_qualification_for_event = false:silent
dotnet_style_qualification_for_field = false:silent
dotnet_style_qualification_for_method = false:silent
dotnet_style_qualification_for_property = false:silent
dotnet_style_qualification_for_event = false
dotnet_style_qualification_for_field = false
dotnet_style_qualification_for_method = false
dotnet_style_qualification_for_property = false

# 语言关键字与 bcl 类型首选项
dotnet_style_predefined_type_for_locals_parameters_members = true:silent
dotnet_style_predefined_type_for_member_access = true:silent
dotnet_style_predefined_type_for_locals_parameters_members = true
dotnet_style_predefined_type_for_member_access = true

# 括号首选项
dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity:silent
dotnet_style_parentheses_in_other_binary_operators = always_for_clarity:silent
dotnet_style_parentheses_in_other_operators = never_if_unnecessary:silent
dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity:silent
dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity
dotnet_style_parentheses_in_other_binary_operators = always_for_clarity
dotnet_style_parentheses_in_other_operators = never_if_unnecessary
dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity

# 修饰符首选项
dotnet_style_require_accessibility_modifiers = for_non_interface_members:silent
dotnet_style_require_accessibility_modifiers = for_non_interface_members

# 表达式级首选项
dotnet_style_coalesce_expression = true:suggestion
dotnet_style_collection_initializer = true:suggestion
dotnet_style_explicit_tuple_names = true:suggestion
dotnet_style_null_propagation = true:suggestion
dotnet_style_object_initializer = true:suggestion
dotnet_style_coalesce_expression = true
dotnet_style_collection_initializer = true
dotnet_style_explicit_tuple_names = true
dotnet_style_null_propagation = true
dotnet_style_object_initializer = true
dotnet_style_operator_placement_when_wrapping = beginning_of_line
dotnet_style_prefer_auto_properties = true:suggestion
dotnet_style_prefer_compound_assignment = true:suggestion
dotnet_style_prefer_conditional_expression_over_assignment = true:silent
dotnet_style_prefer_conditional_expression_over_return = true:silent
dotnet_style_prefer_inferred_anonymous_type_member_names = true:suggestion
dotnet_style_prefer_inferred_tuple_names = true:suggestion
dotnet_style_prefer_is_null_check_over_reference_equality_method = true:suggestion
dotnet_style_prefer_simplified_boolean_expressions = true:suggestion
dotnet_style_prefer_simplified_interpolation = true:suggestion
dotnet_style_prefer_compound_assignment = true
dotnet_style_prefer_conditional_expression_over_assignment = true
dotnet_style_prefer_conditional_expression_over_return = true
dotnet_style_prefer_inferred_anonymous_type_member_names = true
dotnet_style_prefer_inferred_tuple_names = true
dotnet_style_prefer_is_null_check_over_reference_equality_method = true
dotnet_style_prefer_simplified_boolean_expressions = true
dotnet_style_prefer_simplified_interpolation = true

# 字段首选项
dotnet_style_readonly_field = true:suggestion
dotnet_style_readonly_field = true

# 参数首选项
dotnet_code_quality_unused_parameters = all:suggestion
dotnet_code_quality_unused_parameters = all

# 禁止显示首选项
dotnet_remove_unnecessary_suppression_exclusions = none

#### c# 编码约定 ####

# var 首选项
csharp_style_var_elsewhere = false:silent
csharp_style_var_for_built_in_types = false:silent
csharp_style_var_when_type_is_apparent = false:silent
csharp_style_var_elsewhere = false
csharp_style_var_for_built_in_types = false
csharp_style_var_when_type_is_apparent = false

# Expression-bodied 成员
csharp_style_expression_bodied_accessors = true:silent
csharp_style_expression_bodied_constructors = false:silent
csharp_style_expression_bodied_indexers = true:silent
csharp_style_expression_bodied_lambdas = true:silent
csharp_style_expression_bodied_local_functions = false:silent
csharp_style_expression_bodied_methods = false:silent
csharp_style_expression_bodied_operators = false:silent
csharp_style_expression_bodied_properties = true:silent
csharp_style_expression_bodied_accessors = true
csharp_style_expression_bodied_constructors = false
csharp_style_expression_bodied_indexers = true
csharp_style_expression_bodied_lambdas = true
csharp_style_expression_bodied_local_functions = false
csharp_style_expression_bodied_methods = false
csharp_style_expression_bodied_operators = false
csharp_style_expression_bodied_properties = true

# 模式匹配首选项
csharp_style_pattern_matching_over_as_with_null_check = true:suggestion
csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion
csharp_style_prefer_switch_expression = true:suggestion
csharp_style_pattern_matching_over_as_with_null_check = true
csharp_style_pattern_matching_over_is_with_cast_check = true
csharp_style_prefer_not_pattern = true
csharp_style_prefer_pattern_matching = true
csharp_style_prefer_switch_expression = true

# Null 检查首选项
csharp_style_conditional_delegate_call = true:suggestion
csharp_style_conditional_delegate_call = true

# 修饰符首选项
csharp_prefer_static_local_function = true:suggestion
csharp_preferred_modifier_order = public,private,protected,internal,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,volatile,async:silent
csharp_prefer_static_local_function = true
csharp_preferred_modifier_order = public,private,protected,internal,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,volatile,async

# 代码块首选项
csharp_prefer_braces = true:silent
csharp_prefer_simple_using_statement = false:suggestion
csharp_prefer_braces = true
csharp_prefer_simple_using_statement = false

# 表达式级首选项
csharp_prefer_simple_default_expression = true:suggestion
csharp_style_deconstructed_variable_declaration = true:suggestion
csharp_style_inlined_variable_declaration = true:suggestion
csharp_style_pattern_local_over_anonymous_function = true:suggestion
csharp_style_prefer_index_operator = true:suggestion
csharp_style_prefer_range_operator = true:suggestion
csharp_style_throw_expression = true:suggestion
csharp_style_unused_value_assignment_preference = discard_variable:suggestion
csharp_style_unused_value_expression_statement_preference = discard_variable:silent
csharp_prefer_simple_default_expression = true
csharp_style_deconstructed_variable_declaration = true
csharp_style_implicit_object_creation_when_type_is_apparent = true
csharp_style_inlined_variable_declaration = true
csharp_style_pattern_local_over_anonymous_function = true
csharp_style_prefer_index_operator = true
csharp_style_prefer_range_operator = true
csharp_style_throw_expression = true
csharp_style_unused_value_assignment_preference = discard_variable
csharp_style_unused_value_expression_statement_preference = discard_variable

# "using" 指令首选项
csharp_using_directive_placement = outside_namespace:silent
csharp_using_directive_placement = outside_namespace

#### C# 格式规则 ####

Expand Down Expand Up @@ -203,3 +209,13 @@ dotnet_naming_style.begins_with_i.required_prefix = I
dotnet_naming_style.begins_with_i.required_suffix =
dotnet_naming_style.begins_with_i.word_separator =
dotnet_naming_style.begins_with_i.capitalization = pascal_case

# csproj 文件
[*.csproj]
charset = utf-8-bom
indent_style = space
indent_size = 4

# sln 文件
[*.sln]
charset = utf-8-bom
34 changes: 17 additions & 17 deletions samples/WebApplicationSample/WebApplicationSample.csproj
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<UserSecretsId>a59ca38e-9b52-44fe-b3d2-8cb5a1641623</UserSecretsId>
<SignAssembly>false</SignAssembly>
<GenerateDocumentationFile>false</GenerateDocumentationFile>
<GeneratePackageOnBuild>false</GeneratePackageOnBuild>
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
<DockerfileContext>..\..</DockerfileContext>
</PropertyGroup>
<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<UserSecretsId>a59ca38e-9b52-44fe-b3d2-8cb5a1641623</UserSecretsId>
<SignAssembly>false</SignAssembly>
<GenerateDocumentationFile>false</GenerateDocumentationFile>
<GeneratePackageOnBuild>false</GeneratePackageOnBuild>
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
<DockerfileContext>..\..</DockerfileContext>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.10.13" />
<PackageReference Include="QRCoder" Version="1.4.1" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.10.13" />
<PackageReference Include="QRCoder" Version="1.4.1" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\src\Essensoft.Paylink.Alipay\Essensoft.Paylink.Alipay.csproj" />
<ProjectReference Include="..\..\src\Essensoft.Paylink.WeChatPay\Essensoft.Paylink.WeChatPay.csproj" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\src\Essensoft.Paylink.Alipay\Essensoft.Paylink.Alipay.csproj" />
<ProjectReference Include="..\..\src\Essensoft.Paylink.WeChatPay\Essensoft.Paylink.WeChatPay.csproj" />
</ItemGroup>

</Project>
30 changes: 15 additions & 15 deletions src/Essensoft.Paylink.Alipay/Essensoft.Paylink.Alipay.csproj
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>netstandard2.1;netcoreapp3.1;net5.0</TargetFrameworks>
<PackageId>Essensoft.Paylink.Alipay</PackageId>
<PackageTags>Essensoft;Paylink;Alipay;支付宝</PackageTags>
</PropertyGroup>
<PropertyGroup>
<TargetFrameworks>netstandard2.1;netcoreapp3.1;net5.0</TargetFrameworks>
<PackageId>Essensoft.Paylink.Alipay</PackageId>
<PackageTags>Essensoft;Paylink;Alipay;支付宝</PackageTags>
</PropertyGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.1'">
<PackageReference Include="System.Text.Json" Version="5.0.1" />
<PackageReference Include="Microsoft.Extensions.Http" Version="5.0.0" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.1'">
<PackageReference Include="System.Text.Json" Version="5.0.1" />
<PackageReference Include="Microsoft.Extensions.Http" Version="5.0.0" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'netcoreapp3.1' or '$(TargetFramework)' == 'net5.0'">
<FrameworkReference Include="Microsoft.AspNetCore.App" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'netcoreapp3.1' or '$(TargetFramework)' == 'net5.0'">
<FrameworkReference Include="Microsoft.AspNetCore.App" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\Essensoft.Paylink.Security\Essensoft.Paylink.Security.csproj" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Essensoft.Paylink.Security\Essensoft.Paylink.Security.csproj" />
</ItemGroup>

</Project>
10 changes: 5 additions & 5 deletions src/Essensoft.Paylink.Security/Essensoft.Paylink.Security.csproj
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>netstandard2.1;net5.0</TargetFrameworks>
<PackageId>Essensoft.Paylink.Security</PackageId>
<PackageTags>Essensoft;Paylink;Security</PackageTags>
</PropertyGroup>
<PropertyGroup>
<TargetFrameworks>netstandard2.1;net5.0</TargetFrameworks>
<PackageId>Essensoft.Paylink.Security</PackageId>
<PackageTags>Essensoft;Paylink;Security</PackageTags>
</PropertyGroup>

</Project>
30 changes: 15 additions & 15 deletions src/Essensoft.Paylink.WeChatPay/Essensoft.Paylink.WeChatPay.csproj
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>netstandard2.1;netcoreapp3.1;net5.0</TargetFrameworks>
<PackageId>Essensoft.Paylink.WeChatPay</PackageId>
<PackageTags>Essensoft;Paylink;WeChatPay;微信支付</PackageTags>
</PropertyGroup>
<PropertyGroup>
<TargetFrameworks>netstandard2.1;netcoreapp3.1;net5.0</TargetFrameworks>
<PackageId>Essensoft.Paylink.WeChatPay</PackageId>
<PackageTags>Essensoft;Paylink;WeChatPay;微信支付</PackageTags>
</PropertyGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.1'">
<PackageReference Include="System.Text.Json" Version="5.0.1" />
<PackageReference Include="Microsoft.Extensions.Http" Version="5.0.0" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.1'">
<PackageReference Include="System.Text.Json" Version="5.0.1" />
<PackageReference Include="Microsoft.Extensions.Http" Version="5.0.0" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'netcoreapp3.1' or '$(TargetFramework)' == 'net5.0'">
<FrameworkReference Include="Microsoft.AspNetCore.App" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'netcoreapp3.1' or '$(TargetFramework)' == 'net5.0'">
<FrameworkReference Include="Microsoft.AspNetCore.App" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\Essensoft.Paylink.Security\Essensoft.Paylink.Security.csproj" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Essensoft.Paylink.Security\Essensoft.Paylink.Security.csproj" />
</ItemGroup>

</Project>

0 comments on commit 7f73807

Please sign in to comment.