Skip to content

Commit

Permalink
Add .editorconfig (#1130)
Browse files Browse the repository at this point in the history
* Remove unused WinForms properties from WPF

* Explicitly set LangVersion to 10

* Use string literal instead of nameof :(

* Disable analyzers in WPF

* Create editorconfig
  • Loading branch information
ScrubN authored Jul 2, 2024
1 parent cdab290 commit 564752a
Show file tree
Hide file tree
Showing 7 changed files with 108 additions and 18 deletions.
101 changes: 101 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@

[*.{appxmanifest,asax,ascx,aspx,axaml,build,c,c++,c++m,cc,ccm,cginc,compute,cp,cpp,cppm,cs,cshtml,cu,cuh,cxx,cxxm,dtd,fs,fsi,fsscript,fsx,fx,fxh,h,hh,hlsl,hlsli,hlslinc,hpp,hxx,inc,inl,ino,ipp,ixx,master,ml,mli,mpp,mq4,mq5,mqh,mxx,nuspec,paml,razor,resw,resx,shader,skin,tpp,usf,ush,uxml,vb,xaml,xamlx,xoml,xsd}]
indent_style = space
indent_size = 4
tab_width = 4

[*.cs]

# Microsoft .NET properties
csharp_new_line_before_members_in_object_initializers = false
csharp_preferred_modifier_order = public, private, protected, internal, file, new, static, abstract, virtual, sealed, readonly, override, extern, unsafe, volatile, async, required:suggestion
csharp_style_namespace_declarations = block_scoped:warning
csharp_style_prefer_utf8_string_literals = true:suggestion
# csharp_style_var_elsewhere = true:suggestion
# csharp_style_var_for_built_in_types = true:suggestion
# csharp_style_var_when_type_is_apparent = true:suggestion
dotnet_naming_rule.constants_rule.import_to_resharper = True
dotnet_naming_rule.constants_rule.resharper_description = Constant fields (not private)
dotnet_naming_rule.constants_rule.resharper_guid = 669e5282-fb4b-4e90-91e7-07d269d04b60
dotnet_naming_rule.constants_rule.severity = warning
dotnet_naming_rule.constants_rule.style = all_upper_style
dotnet_naming_rule.constants_rule.symbols = constants_symbols
dotnet_naming_rule.local_constants_rule.import_to_resharper = True
dotnet_naming_rule.local_constants_rule.resharper_description = Local constants
dotnet_naming_rule.local_constants_rule.resharper_guid = a4f433b8-abcd-4e55-a08f-82e78cef0f0c
dotnet_naming_rule.local_constants_rule.severity = warning
dotnet_naming_rule.local_constants_rule.style = all_upper_style
dotnet_naming_rule.local_constants_rule.symbols = local_constants_symbols
dotnet_naming_rule.private_constants_rule.import_to_resharper = True
dotnet_naming_rule.private_constants_rule.resharper_description = Constant fields (private)
dotnet_naming_rule.private_constants_rule.resharper_guid = 236f7aa5-7b06-43ca-bf2a-9b31bfcff09a
dotnet_naming_rule.private_constants_rule.resharper_style = AA_BB, FLASHW_ + AA_BB
dotnet_naming_rule.private_constants_rule.severity = warning
dotnet_naming_rule.private_constants_rule.style = all_upper_style
dotnet_naming_rule.private_constants_rule.symbols = private_constants_symbols
dotnet_naming_rule.public_static_fields_rule.import_to_resharper = True
dotnet_naming_rule.public_static_fields_rule.resharper_description = Static fields (not private)
dotnet_naming_rule.public_static_fields_rule.resharper_guid = 70345118-4b40-4ece-937c-bbeb7a0b2e70
dotnet_naming_rule.public_static_fields_rule.resharper_style = aaBb, AaBb
dotnet_naming_rule.public_static_fields_rule.severity = warning
dotnet_naming_rule.public_static_fields_rule.style = lower_camel_case_style
dotnet_naming_rule.public_static_fields_rule.symbols = public_static_fields_symbols
dotnet_naming_rule.static_readonly_rule.import_to_resharper = True
dotnet_naming_rule.static_readonly_rule.resharper_description = Static readonly fields (not private)
dotnet_naming_rule.static_readonly_rule.resharper_guid = c873eafb-d57f-481d-8c93-77f6863c2f88
dotnet_naming_rule.static_readonly_rule.severity = warning
dotnet_naming_rule.static_readonly_rule.style = upper_camel_case_style
dotnet_naming_rule.static_readonly_rule.symbols = static_readonly_symbols
dotnet_naming_style.all_upper_style.capitalization = all_upper
dotnet_naming_style.all_upper_style.word_separator = _
dotnet_naming_style.lower_camel_case_style.capitalization = camel_case
dotnet_naming_style.upper_camel_case_style.capitalization = pascal_case
dotnet_naming_symbols.constants_symbols.applicable_accessibilities = public,internal,protected,protected_internal,private_protected
dotnet_naming_symbols.constants_symbols.applicable_kinds = field
dotnet_naming_symbols.constants_symbols.required_modifiers = const
dotnet_naming_symbols.constants_symbols.resharper_applicable_kinds = constant_field
dotnet_naming_symbols.constants_symbols.resharper_required_modifiers = any
dotnet_naming_symbols.local_constants_symbols.applicable_accessibilities = *
dotnet_naming_symbols.local_constants_symbols.applicable_kinds = local
dotnet_naming_symbols.local_constants_symbols.required_modifiers = const
dotnet_naming_symbols.local_constants_symbols.resharper_applicable_kinds = local_constant
dotnet_naming_symbols.local_constants_symbols.resharper_required_modifiers = any
dotnet_naming_symbols.private_constants_symbols.applicable_accessibilities = private
dotnet_naming_symbols.private_constants_symbols.applicable_kinds = field
dotnet_naming_symbols.private_constants_symbols.required_modifiers = const
dotnet_naming_symbols.private_constants_symbols.resharper_applicable_kinds = constant_field
dotnet_naming_symbols.private_constants_symbols.resharper_required_modifiers = any
dotnet_naming_symbols.public_static_fields_symbols.applicable_accessibilities = public,internal,protected,protected_internal,private_protected
dotnet_naming_symbols.public_static_fields_symbols.applicable_kinds = field
dotnet_naming_symbols.public_static_fields_symbols.required_modifiers = static
dotnet_naming_symbols.public_static_fields_symbols.resharper_applicable_kinds = field
dotnet_naming_symbols.public_static_fields_symbols.resharper_required_modifiers = static
dotnet_naming_symbols.static_readonly_symbols.applicable_accessibilities = public,internal,protected,protected_internal,private_protected
dotnet_naming_symbols.static_readonly_symbols.applicable_kinds = field
dotnet_naming_symbols.static_readonly_symbols.required_modifiers = readonly,static
dotnet_naming_symbols.static_readonly_symbols.resharper_applicable_kinds = readonly_field
dotnet_naming_symbols.static_readonly_symbols.resharper_required_modifiers = static
dotnet_style_parentheses_in_arithmetic_binary_operators = never_if_unnecessary:suggestion
dotnet_style_parentheses_in_other_binary_operators = always_for_clarity:suggestion
dotnet_style_parentheses_in_relational_binary_operators = never_if_unnecessary:suggestion
dotnet_style_predefined_type_for_locals_parameters_members = true:suggestion
dotnet_style_predefined_type_for_member_access = true:suggestion
dotnet_style_qualification_for_event = false:suggestion
dotnet_style_qualification_for_field = false:suggestion
dotnet_style_qualification_for_method = false:suggestion
dotnet_style_qualification_for_property = false:suggestion
dotnet_style_require_accessibility_modifiers = for_non_interface_members:warning

# ReSharper properties
resharper_autodetect_indent_settings = true
resharper_blank_lines_after_control_transfer_statements = 1
resharper_braces_redundant = false
resharper_builtin_type_apply_to_native_integer = true
resharper_csharp_empty_block_style = together_same_line
resharper_csharp_wrap_before_binary_opsign = true
resharper_formatter_off_tag = @formatter:off
resharper_formatter_on_tag = @formatter:on
resharper_formatter_tags_enabled = true
resharper_place_field_attribute_on_same_line = false
resharper_trailing_comma_in_multiline_lists = true
resharper_use_indent_from_vs = false
1 change: 1 addition & 0 deletions TwitchDownloaderCLI.Tests/TwitchDownloaderCLI.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

<IsPackable>false</IsPackable>
<IsTestProject>true</IsTestProject>
<LangVersion>10</LangVersion>
</PropertyGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion TwitchDownloaderCLI/TwitchDownloaderCLI.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<Platforms>AnyCPU;x64</Platforms>
<TargetFramework>net6.0</TargetFramework>
<LangVersion>default</LangVersion>
<LangVersion>10</LangVersion>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

<IsPackable>false</IsPackable>
<IsTestProject>true</IsTestProject>
<LangVersion>default</LangVersion>
<LangVersion>10</LangVersion>
</PropertyGroup>

<ItemGroup>
Expand Down
3 changes: 2 additions & 1 deletion TwitchDownloaderCore/Tools/FilenameService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,8 @@ private static string[] GetTemplateSubfolders(ref string fullPath)

private static readonly char[] FilenameInvalidChars = Path.GetInvalidFileNameChars();

[return: NotNullIfNotNull(nameof(filename))]
// TODO: Use nameof(filename) when C# 11+
[return: NotNullIfNotNull("filename")]
public static string ReplaceInvalidFilenameChars([AllowNull] string filename)
{
if (string.IsNullOrEmpty(filename))
Expand Down
2 changes: 1 addition & 1 deletion TwitchDownloaderCore/TwitchDownloaderCore.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<Authors>Lewis Pardo</Authors>
<Version>1.1.6</Version>
<Platforms>AnyCPU;x64</Platforms>
<LangVersion>default</LangVersion>
<LangVersion>10</LangVersion>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<!--TODO: <Nullable>enable</Nullable> once we have required keyword-->
</PropertyGroup>
Expand Down
15 changes: 1 addition & 14 deletions TwitchDownloaderWPF/TwitchDownloaderWPF.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,13 @@
<PropertyGroup>
<TargetFramework>net6.0-windows</TargetFramework>
<OutputType>WinExe</OutputType>
<IsWebBootstrapper>false</IsWebBootstrapper>
<PublishUrl>publish\</PublishUrl>
<Install>true</Install>
<InstallFrom>Disk</InstallFrom>
<UpdateEnabled>false</UpdateEnabled>
<UpdateMode>Foreground</UpdateMode>
<UpdateInterval>7</UpdateInterval>
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
<UpdatePeriodically>false</UpdatePeriodically>
<UpdateRequired>false</UpdateRequired>
<MapFileExtensions>true</MapFileExtensions>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<UseWPF>true</UseWPF>
<ImportWindowsDesktopTargets>true</ImportWindowsDesktopTargets>
<EnableNETAnalyzers>false</EnableNETAnalyzers>
<Platforms>AnyCPU;x64</Platforms>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<LangVersion>10</LangVersion>
<!--TODO: <Nullable>enable</Nullable> once we have required keyword-->
</PropertyGroup>
<PropertyGroup>
Expand Down

0 comments on commit 564752a

Please sign in to comment.