﻿# Based on https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-code-style-settings-reference
# Use https://github.com/dotnet/roslyn/blob/master/.editorconfig as a sample

root = true

[*]
end_of_line              = crlf
charset                  = utf-8
trim_trailing_whitespace = true
insert_final_newline     = false
indent_style = tab
indent_size = 4
max_line_length = 120

[*.md]
trim_trailing_whitespace = false
insert_final_newline     = true


[*.cs]
dotnet_sort_system_directives_first = true

dotnet_style_coalesce_expression = true:error
dotnet_style_collection_initializer = true:error
dotnet_style_explicit_tuple_names = true:error
dotnet_style_null_propagation = true:error
dotnet_style_object_initializer = true:error
dotnet_style_predefined_type_for_locals_parameters_members = true:error
dotnet_style_predefined_type_for_member_access = true:error
dotnet_style_qualification_for_event = false:error
dotnet_style_qualification_for_field = false:error
dotnet_style_qualification_for_method = false:error
dotnet_style_qualification_for_property = false:error

csharp_new_line_before_catch = true : error
csharp_new_line_before_else = true : error
csharp_new_line_before_finally = true : error
csharp_new_line_before_members_in_anonymous_types  = false : error
csharp_new_line_before_members_in_object_initializers = false : error
csharp_new_line_before_open_brace = none : error
csharp_new_line_between_query_expression_clauses = false : error

csharp_indent_block_contents = true : error
csharp_indent_braces = true : error
csharp_indent_case_contents = true : error
csharp_indent_switch_labels = true : error

csharp_preserve_single_line_blocks = true : error
csharp_preserve_single_line_statements = true : error

csharp_space_after_cast = false : error
csharp_space_after_colon_in_inheritance_clause = true : error
csharp_space_after_comma = true : error
csharp_space_after_dot = false : error
csharp_space_after_keywords_in_control_flow_statements = true : error
csharp_space_after_semicolon_in_for_statement = true : error

csharp_space_around_binary_operators = before_and_after : error
csharp_space_around_declaration_statements = do_not_ignore : error

csharp_space_before_colon_in_inheritance_clause = false : error
csharp_space_before_comma = false : error
csharp_space_before_dot = false : error
csharp_space_before_open_square_brackets = false : error
csharp_space_before_semicolon_in_for_statement = false : error

csharp_space_between_empty_square_brackets = false : error
csharp_space_between_method_call_empty_parameter_list_parentheses = false : error
csharp_space_between_method_call_name_and_opening_parenthesis = false : error
csharp_space_between_method_call_parameter_list_parentheses = false : error
csharp_space_between_method_declaration_empty_parameter_list_parentheses = false : error
csharp_space_between_method_declaration_name_and_open_parenthesis = false : error
csharp_space_between_method_declaration_parameter_list_parentheses = false : error
csharp_space_between_parentheses = control_flow_statements : error
csharp_space_between_square_brackets = false : error

csharp_style_conditional_delegate_call = true : error
csharp_style_expression_bodied_accessors = false : error
csharp_style_expression_bodied_constructors = false: error
csharp_style_expression_bodied_indexers = true:warning
csharp_style_expression_bodied_methods = false:error
csharp_style_expression_bodied_operators = false:error
csharp_style_expression_bodied_properties = true: warning
csharp_style_inlined_variable_declaration = false: error
csharp_style_pattern_matching_over_as_with_null_check = false : error
csharp_style_pattern_matching_over_is_with_cast_check = false:error
csharp_style_throw_expression = false:warning
csharp_style_var_elsewhere = true:error
csharp_style_var_for_built_in_types = true:error
csharp_style_var_when_type_is_apparent = true:error

# Name all constant fields using PascalCase
dotnet_naming_rule.constant_fields_should_be_pascal_case.severity = suggestion
dotnet_naming_rule.constant_fields_should_be_pascal_case.symbols  = constant_fields
dotnet_naming_rule.constant_fields_should_be_pascal_case.style    = pascal_case_style

dotnet_naming_symbols.constant_fields.applicable_kinds   = field
dotnet_naming_symbols.constant_fields.required_modifiers = const

dotnet_naming_style.pascal_case_style.capitalization = pascal_case

# Internal and private fields should be _camelCase
dotnet_naming_rule.camel_case_for_private_internal_fields.severity = suggestion
dotnet_naming_rule.camel_case_for_private_internal_fields.symbols  = private_internal_fields
dotnet_naming_rule.camel_case_for_private_internal_fields.style    = camel_case_underscore_style

dotnet_naming_symbols.private_internal_fields.applicable_kinds = field
dotnet_naming_symbols.private_internal_fields.applicable_accessibilities = private, internal

dotnet_naming_style.camel_case_underscore_style.required_prefix = _
dotnet_naming_style.camel_case_underscore_style.capitalization = camel_case 

