diff --git a/.editorconfig b/.editorconfig index 29c9293c913e..08b1166ca527 100644 --- a/.editorconfig +++ b/.editorconfig @@ -1,11 +1,125 @@ root = true -[**/*.cs] +[**/*.xaml] indent_style = tab indent_size = 4 tab_width = 4 -[**/*.xaml] +[**/*.cs] indent_style = tab indent_size = 4 -tab_width = 4 \ No newline at end of file +tab_width = 4 + +# https://files.community/docs/contributing/code-style + +dotnet_naming_rule.pascal_case_for_classes.symbols = classes +dotnet_naming_symbols.classes.applicable_kinds = class +dotnet_naming_symbols.classes.applicable_accessibilities = * +dotnet_naming_symbols.classes.required_prefix = +dotnet_naming_symbols.classes.required_suffix = + +dotnet_naming_rule.pascal_case_for_interfaces.symbols = interfaces +dotnet_naming_symbols.interfaces.applicable_kinds = interface +dotnet_naming_symbols.interfaces.applicable_accessibilities = * +dotnet_naming_symbols.interfaces.required_prefix = I +dotnet_naming_symbols.interfaces.required_suffix = + +dotnet_naming_rule.pascal_case_for_structs.symbols = structs +dotnet_naming_symbols.structs.applicable_kinds = struct +dotnet_naming_symbols.structs.applicable_accessibilities = * +dotnet_naming_symbols.structs.required_prefix = +dotnet_naming_symbols.structs.required_suffix = + +dotnet_naming_rule.pascal_case_for_methods.symbols = methods +dotnet_naming_symbols.methods.applicable_kinds = method +dotnet_naming_symbols.methods.applicable_accessibilities = * +dotnet_naming_symbols.methods.required_prefix = + +dotnet_naming_rule.camel_case_for_variables.symbols = variables +dotnet_naming_symbols.variables.applicable_kinds = field +dotnet_naming_symbols.variables.applicable_accessibilities = private +dotnet_naming_symbols.variables.required_prefix = _ +dotnet_naming_symbols.variables.required_suffix = + +dotnet_naming_rule.camel_case_for_parameters.symbols = parameters +dotnet_naming_symbols.parameters.applicable_kinds = parameter +dotnet_naming_symbols.parameters.applicable_accessibilities = * +dotnet_naming_symbols.parameters.required_prefix = +dotnet_naming_symbols.parameters.required_suffix = + +dotnet_naming_rule.pascal_case_for_properties.symbols = properties +dotnet_naming_symbols.properties.applicable_kinds = property +dotnet_naming_symbols.properties.applicable_accessibilities = * +dotnet_naming_symbols.properties.required_prefix = +dotnet_naming_symbols.properties.required_suffix = + +dotnet_naming_rule.upper_case_for_constants.symbols = constants +dotnet_naming_symbols.constants.applicable_kinds = field +dotnet_naming_symbols.constants.applicable_accessibilities = * +dotnet_naming_symbols.constants.required_prefix = +dotnet_naming_symbols.constants.required_suffix = +dotnet_naming_symbols.constants.required_capitalization = all_upper + +dotnet_style_require_accessibility_modifiers = always:suggestion +dotnet_style_readonly_field = true:suggestion +dotnet_style_qualify_field_access = false +dotnet_style_qualify_property_access = false +dotnet_style_qualify_method_access = false +dotnet_style_qualify_event_access = false +dotnet_style_prefer_auto_properties = true:suggestion +dotnet_style_prefer_is_null_check_over_reference_equality_method = true:suggestion + +csharp_new_line_before_open_brace = all +csharp_new_line_before_else = true +csharp_new_line_before_catch = true +csharp_new_line_before_finally = true +csharp_new_line_before_members_in_object_initializers = true +csharp_new_line_before_members_in_anonymous_types = true +csharp_new_line_between_query_expression_clauses = true + +csharp_style_var_for_built_in_types = true:suggestion +csharp_style_var_when_type_is_apparent = true:suggestion +csharp_style_var_elsewhere = true:suggestion + +csharp_style_namespace_declarations = file_scoped + +dotnet_naming_rule.pascal_case_for_classes.style = pascal_case +dotnet_naming_rule.pascal_case_for_interfaces.style = pascal_case +dotnet_naming_rule.pascal_case_for_structs.style = pascal_case +dotnet_naming_rule.pascal_case_for_methods.style = pascal_case +dotnet_naming_rule.camel_case_for_variables.style = camel_case +dotnet_naming_rule.camel_case_for_parameters.style = camel_case +dotnet_naming_rule.pascal_case_for_properties.style = pascal_case +dotnet_naming_rule.upper_case_for_constants.style = all_upper + +dotnet_naming_style.pascal_case.capitalization = pascal_case +dotnet_naming_style.camel_case.capitalization = camel_case +dotnet_naming_style.all_upper.capitalization = all_upper + +dotnet_naming_rule.suffix_async_should_be_asyncsuffix.severity = error +dotnet_naming_rule.suffix_async_should_be_asyncsuffix.symbols = suffix_async +dotnet_naming_rule.suffix_async_should_be_asyncsuffix.style = asyncsuffix +dotnet_naming_symbols.suffix_async.applicable_kinds = method +dotnet_naming_symbols.suffix_async.applicable_accessibilities = * +dotnet_naming_symbols.suffix_async.required_modifiers = async +dotnet_naming_style.asyncsuffix.required_prefix = +dotnet_naming_style.asyncsuffix.required_suffix = Async +dotnet_naming_style.asyncsuffix.word_separator = +dotnet_naming_style.asyncsuffix.capitalization = pascal_case + +csharp_preserve_single_line_statements = true +csharp_style_allow_embedded_statements_on_same_line_experimental = false +csharp_style_allow_blank_line_after_block = true +csharp_prefer_braces = true +csharp_style_allow_blank_line_after_block = true +csharp_prefer_braces = true +csharp_style_allow_blank_line_after_block = true +csharp_prefer_braces = true +csharp_style_allow_blank_line_after_block = true +csharp_prefer_braces = true +csharp_style_allow_blank_line_after_block = true +csharp_prefer_braces = true +csharp_style_allow_blank_line_after_block = true +csharp_prefer_braces = true +csharp_style_allow_blank_line_after_block = true +csharp_prefer_braces = true \ No newline at end of file diff --git a/src/Files.App/.editorconfig b/src/Files.App/.editorconfig new file mode 100644 index 000000000000..a519564334e0 --- /dev/null +++ b/src/Files.App/.editorconfig @@ -0,0 +1,124 @@ +# Top-most EditorConfig file +root = true + +# All files +[*] +indent_style = tab +indent_size = 4 +end_of_line = crlf +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true + +# C# files +[*.cs] +# Naming conventions +dotnet_naming_rule.interface_should_be_begins_with_i.severity = error +dotnet_naming_rule.interface_should_be_begins_with_i.symbols = interface +dotnet_naming_rule.interface_should_be_begins_with_i.style = begins_with_i + +dotnet_naming_rule.class_should_be_pascal_case.severity = error +dotnet_naming_rule.class_should_be_pascal_case.symbols = class +dotnet_naming_rule.class_should_be_pascal_case.style = pascal_case + +dotnet_naming_rule.struct_should_be_pascal_case.severity = error +dotnet_naming_rule.struct_should_be_pascal_case.symbols = struct +dotnet_naming_rule.struct_should_be_pascal_case.style = pascal_case + +dotnet_naming_rule.method_should_be_pascal_case.severity = error +dotnet_naming_rule.method_should_be_pascal_case.symbols = method +dotnet_naming_rule.method_should_be_pascal_case.style = pascal_case + +dotnet_naming_rule.property_should_be_pascal_case.severity = error +dotnet_naming_rule.property_should_be_pascal_case.symbols = property +dotnet_naming_rule.property_should_be_pascal_case.style = pascal_case + +dotnet_naming_rule.private_field_should_be_camel_case_with_underscore.severity = error +dotnet_naming_rule.private_field_should_be_camel_case_with_underscore.symbols = private_field +dotnet_naming_rule.private_field_should_be_camel_case_with_underscore.style = camel_case_with_underscore + +dotnet_naming_rule.constant_should_be_upper_case.severity = error +dotnet_naming_rule.constant_should_be_upper_case.symbols = constant_field +dotnet_naming_rule.constant_should_be_upper_case.style = upper_case + +# Symbol specifications +dotnet_naming_symbols.interface.applicable_kinds = interface +dotnet_naming_symbols.interface.applicable_accessibilities = * + +dotnet_naming_symbols.class.applicable_kinds = class +dotnet_naming_symbols.class.applicable_accessibilities = * + +dotnet_naming_symbols.struct.applicable_kinds = struct +dotnet_naming_symbols.struct.applicable_accessibilities = * + +dotnet_naming_symbols.method.applicable_kinds = method +dotnet_naming_symbols.method.applicable_accessibilities = * + +dotnet_naming_symbols.property.applicable_kinds = property +dotnet_naming_symbols.property.applicable_accessibilities = * + +dotnet_naming_symbols.private_field.applicable_kinds = field +dotnet_naming_symbols.private_field.applicable_accessibilities = private + +dotnet_naming_symbols.constant_field.applicable_kinds = field +dotnet_naming_symbols.constant_field.required_modifiers = const + +# Naming styles +dotnet_naming_style.begins_with_i.required_prefix = I +dotnet_naming_style.begins_with_i.capitalization = pascal_case + +dotnet_naming_style.pascal_case.capitalization = pascal_case + +dotnet_naming_style.camel_case_with_underscore.required_prefix = _ +dotnet_naming_style.camel_case_with_underscore.capitalization = camel_case + +dotnet_naming_style.upper_case.capitalization = all_upper +dotnet_naming_style.upper_case.word_separator = _ + +# Code style rules +csharp_new_line_before_open_brace = all +csharp_new_line_before_else = true +csharp_new_line_before_catch = true +csharp_new_line_before_finally = true + +# Prefer predefined type names +dotnet_style_predefined_type_for_locals_parameters_members = true:error +dotnet_style_predefined_type_for_member_access = true:error + +# Single-line control structures +csharp_prefer_braces = false:warning +csharp_preserve_single_line_statements = true +csharp_preserve_single_line_blocks = true + +# Async suffix +dotnet_naming_rule.async_methods_must_end_with_async.severity = error +dotnet_naming_rule.async_methods_must_end_with_async.symbols = async_method +dotnet_naming_rule.async_methods_must_end_with_async.style = end_with_async + +dotnet_naming_symbols.async_method.applicable_kinds = method +dotnet_naming_symbols.async_method.required_modifiers = async + +dotnet_naming_style.end_with_async.required_suffix = Async +dotnet_naming_style.end_with_async.capitalization = pascal_case + +# Spacing +csharp_space_after_cast = false +csharp_space_after_keywords_in_control_flow_statements = true +csharp_space_between_method_declaration_parameter_list_parentheses = false +csharp_space_between_method_call_parameter_list_parentheses = false + +# No regions +csharp_style_region_directive = false:error + +# Class structure ordering +csharp_preferred_modifier_order = public,private,protected,internal,static,readonly,abstract,sealed,override,virtual:error + +# Interfaces must be documented +dotnet_diagnostic.CS1591.severity = error + +# Disposable pattern +dotnet_diagnostic.CA1063.severity = error + +# No public fields +dotnet_diagnostic.CA1051.severity = error +