root = true
# EditorConfig is awesome: http://EditorConfig.org

# top-most EditorConfig file

# Global settings
[*]
end_of_line = crlf
insert_final_newline = true
trim_trailing_whitespace = true

# Xml project files
[*.{csproj,vbproj,vcxproj,vcxproj.filters,proj,projitems,shproj}]
indent_style = space
indent_size = 2

# Xml config files
[*.{props,targets,ruleset,config,nuspec,resx,vsixmanifest,vsct}]
indent_style = space
indent_size = 2

[*.{md,json}]
indent_style = space
indent_size = 4

[*.cs]
indent_style = space
indent_size = 4
max_line_length = 130

# New line preferences
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

# Indentation preferences
csharp_indent_block_contents = true
csharp_indent_braces = false
csharp_indent_case_contents = true
csharp_indent_switch_labels = true
csharp_indent_labels = one_less_than_current

# avoid this. unless absolutely necessary
dotnet_style_qualification_for_field = false:suggestion
dotnet_style_qualification_for_property = false:suggestion
dotnet_style_qualification_for_method = false:suggestion
dotnet_style_qualification_for_event = false:suggestion

# only use var when it's obvious what the variable type is
csharp_style_var_for_built_in_types = false:none
csharp_style_var_when_type_is_apparent = false:none
csharp_style_var_elsewhere = false:suggestion

# use language keywords instead of BCL types
dotnet_style_predefined_type_for_locals_parameters_members = true:error
dotnet_style_predefined_type_for_member_access = 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

# Code style defaults
csharp_using_directive_placement = outside_namespace:warning
dotnet_sort_system_directives_first = true
csharp_preserve_single_line_blocks = true
csharp_preserve_single_line_statements = false

# Expression-level preferences
dotnet_style_object_initializer = true:suggestion
dotnet_style_collection_initializer = true:suggestion
dotnet_style_explicit_tuple_names = true:suggestion
dotnet_style_coalesce_expression = true:suggestion
dotnet_style_null_propagation = true:suggestion

# Expression-bodied members
csharp_style_expression_bodied_methods = true:none
csharp_style_expression_bodied_constructors = false:none
csharp_style_expression_bodied_operators = false:none
csharp_style_expression_bodied_properties = true:none
csharp_style_expression_bodied_indexers = true:none
csharp_style_expression_bodied_accessors = true:none

# Pattern matching
csharp_style_pattern_matching_over_is_with_cast_check = true:error
csharp_style_pattern_matching_over_as_with_null_check = true:error
csharp_style_inlined_variable_declaration = true:error

# Null checking preferences
csharp_style_throw_expression = true:suggestion
csharp_style_conditional_delegate_call = true:suggestion

dotnet_style_require_accessibility_modifiers = for_non_interface_members:error
dotnet_style_readonly_field = true:error

# Space preferences
csharp_space_after_cast = false
csharp_space_after_colon_in_inheritance_clause = true
csharp_space_after_comma = true
csharp_space_after_dot = false
csharp_space_after_keywords_in_control_flow_statements = true
csharp_space_after_semicolon_in_for_statement = true
csharp_space_around_binary_operators = before_and_after
csharp_space_around_declaration_statements = do_not_ignore
csharp_space_before_colon_in_inheritance_clause = true
csharp_space_before_comma = false
csharp_space_before_dot = false
csharp_space_before_open_square_brackets = false
csharp_space_before_semicolon_in_for_statement = false
csharp_space_between_attribute_sections = false
csharp_space_between_empty_square_brackets = false
csharp_space_between_method_call_empty_parameter_list_parentheses = false
csharp_space_between_method_call_name_and_opening_parenthesis = false
csharp_space_between_method_call_parameter_list_parentheses = false
csharp_space_between_method_declaration_empty_parameter_list_parentheses = false
csharp_space_between_method_declaration_name_and_open_parenthesis = false
csharp_space_between_method_declaration_parameter_list_parentheses = false
csharp_space_between_parentheses = false
csharp_space_between_square_brackets = false

# FxCop Analyzers
dotnet_diagnostic.CA1030.severity = none
dotnet_diagnostic.CA1034.severity = none
dotnet_diagnostic.CA1062.severity = suggestion
dotnet_code_quality.CA1062.exclude_extension_method_this_parameter = true
dotnet_code_quality.exclude_extension_method_this_parameter = true
dotnet_code_quality.null_check_validation_methods = ThrowIfArgumentIsNull
# CA1031: Do not catch general exception types
dotnet_diagnostic.CA1031.severity = none
# CA1303: Do not pass literals as localized parameters
dotnet_diagnostic.CA1303.severity = none
# CA1304: Specify CultureInfo
dotnet_diagnostic.CA1304.severity = error
# CA1307: Specify StringComparison for clarity
dotnet_diagnostic.CA1307.severity = error
# CA1308: Normalize strings to uppercase
dotnet_diagnostic.CA1308.severity = error
# CA1309: Use ordinal StringComparison
dotnet_diagnostic.CA1309.severity = error

# Purpose: Rename virtual/interface member ITestFramework.Throw(string) so that it no longer conflicts with the reserved language keyword 'Throw'
# Reason: We don't care about other languages than C#
dotnet_diagnostic.CA1716.severity = none

# CA1724: Type names should not match namespaces
dotnet_diagnostic.CA1724.severity = none
# CA1819: Properties should not return arrays
dotnet_diagnostic.CA1819.severity = none
# CA1851: Possible multiple enumerations of IEnumerable collection. Related to GH-issue #2000
dotnet_diagnostic.CA1851.severity = suggestion
# CA1859: Use concrete types when possible for improved performance
dotnet_diagnostic.CA1859.severity = suggestion
# CA1860: Avoid using 'Enumerable.Any()' extension method
dotnet_diagnostic.CA1860.severity = warning
# CA1861: Avoid constant arrays as arguments
dotnet_diagnostic.CA1861.severity = none
# CA2007: Do not directly await a Task
dotnet_diagnostic.CA2007.severity = none
# CA2225: Operator overloads have named alternates
dotnet_diagnostic.CA2225.severity = none
# CA3075: Insecure DTD Processing
dotnet_diagnostic.CA3075.severity = none
# CA5369: Use XmlReader for Deserialize
dotnet_diagnostic.CA5369.severity = none

# Banned API Analyzers
dotnet_diagnostic.RS0030.severity = error

# IDE0004: Remove unnecessary cast
dotnet_diagnostic.IDE0004.severity = error

# IDE0005: Remove unnecessary usings/imports
dotnet_diagnostic.IDE0005.severity = suggestion

# IDE0051: Remove unused private members (no reads or writes)
dotnet_diagnostic.IDE0051.severity = error

# IDE0052: Remove unread private members (writes but no reads)
dotnet_diagnostic.IDE0052.severity = error

# IDE0055: Fix formatting
dotnet_diagnostic.IDE0055.severity = error

# CS1574: XML comment on 'construct' has syntactically incorrect cref attribute 'name'
dotnet_diagnostic.CS1574.severity = error

# StyleCop
# SA1028: Code should not contain trailing whitespace
dotnet_diagnostic.SA1028.severity = suggestion
# SA1101: Prefix local calls with this
dotnet_diagnostic.SA1101.severity = none
# SA1116: The parameters should begin on the line after the declaration, whenever the parameter span across multiple lines
dotnet_diagnostic.SA1116.severity = none
# SA1117: The parameters should all be placed on the same line or each parameter should be placed on its own line.
dotnet_diagnostic.SA1117.severity = none
# SA1200: Using directive should appear within a namespace declaration
dotnet_diagnostic.SA1200.severity = none

# Purpose: Use string. Empty for empty strings
# Reason: There's no performance difference. See https://medium.com/@dk.kravtsov/string-empty-vs-in-c-70c64971161f 
dotnet_diagnostic.SA1122.severity = none

# SA1124: Do not use regions
dotnet_diagnostic.SA1124.severity = none
# SA1201: A property should not follow a method
dotnet_diagnostic.SA1201.severity = none
# SA1202: 'public' members should come before 'private' members
dotnet_diagnostic.SA1202.severity = none
# SA1204: Static members should appear before non-static members
dotnet_diagnostic.SA1204.severity = none
# SA1312: variable should begin with lower-case letter
dotnet_diagnostic.SA1312.severity = suggestion # re-enable if using statements can be discarded
# SA1313: parameter should begin with lower-case letter
dotnet_diagnostic.SA1313.severity = suggestion # re-enable when parameters discards are available
# SA1316: Tuple element names should use correct casing
dotnet_diagnostic.SA1316.severity = none
# SA1402: File may only contain a single type. Handled better by AV1507
dotnet_diagnostic.SA1402.severity = none
# SA1404: Code analysis suppression should have justification
dotnet_diagnostic.SA1404.severity = none
# SA1413: Use trailing comma in multi-line initializers
dotnet_diagnostic.SA1413.severity = none
# SA1600: Elements should be documented
dotnet_diagnostic.SA1600.severity = suggestion
# SA1602: Enumeration items should be documented
dotnet_diagnostic.SA1602.severity = suggestion
# SA1611: The documentation for parameter is missing
dotnet_diagnostic.SA1611.severity = suggestion
# SA1612: The parameter documentation for parameter should be at position
dotnet_diagnostic.SA1612.severity = suggestion
# SA1614: Element parameter documentation should have text
dotnet_diagnostic.SA1614.severity = suggestion
# SA1615: Element return value should be documented
dotnet_diagnostic.SA1615.severity = none
# SA1616: Element return value documentation should have text
dotnet_diagnostic.SA1616.severity = suggestion
# SA1618: The documentation for type parameter is missing
dotnet_diagnostic.SA1618.severity = suggestion
# SA1623: The property's documentation summary text should begin with: 'Gets'
dotnet_diagnostic.SA1623.severity = none
# SA1629: Documentation text should end with a period
dotnet_diagnostic.SA1629.severity = none
# SA1633: The file header is missing or not located at the top of the file
dotnet_diagnostic.SA1633.severity = none
# SA1642: Constructor summary documentation should begin with standard text
dotnet_diagnostic.SA1642.severity = suggestion

# CSharpGuidelines
dotnet_diagnostic.AV1561.max_parameter_count = 5
# AV1008: Class should be non-static or its name should be suffixed with Extensions
dotnet_diagnostic.AV1008.severity = none
# AV1010: Type hides inherited member
dotnet_diagnostic.AV1010.severity = none
# AV1115: Member or local function contains the word 'and', which suggests doing multiple things
dotnet_diagnostic.AV1115.severity = suggestion
# AV1130: Return type in signature for Type should be a collection interface instead of a concrete type
dotnet_diagnostic.AV1130.severity = none
# AV1135: null is returned from method which has return type of string, collection or task
dotnet_diagnostic.AV1135.severity = none # re-enable if we can distinguish between string, collection and task
# AV1210: Catch a specific exception instead of Exception, SystemException or ApplicationException
dotnet_diagnostic.AV1210.severity = none
# AV1250: Evaluate LINQ query before returning it
dotnet_diagnostic.AV1250.severity = suggestion
# AV1500: Method 'CallerIdentifier.DetermineCallerIdentity()' contains 10 statements, which exceeds the maximum of 7 statements
dotnet_diagnostic.AV1500.severity = none
# AV1532: Loop statement contains nested loop
dotnet_diagnostic.AV1532.severity = suggestion
# AV1535: Missing block in case or default clause of switch statement
dotnet_diagnostic.AV1535.severity = none # re-enable if we can adjust the formatting to not indent the scope braces
# AV1537: If-else-if construct should end with an unconditional else clause
dotnet_diagnostic.AV1537.severity = suggestion
# AV1551: Method overload with the most parameters should be virtual
dotnet_diagnostic.AV1551.severity = none
# AV1555: Avoid using non-(nullable-)boolean named arguments
dotnet_diagnostic.AV1555.severity = suggestion
# AV1561: Method contains 5 parameters, which exceeds the maximum of 3 parameters
dotnet_diagnostic.AV1561.severity = suggestion
# AV1564: Parameter in public or internal member is of type bool or bool?
dotnet_diagnostic.AV1564.severity = suggestion
# AV1554: Do not use optional parameters in interface methods or their concrete implementations
dotnet_diagnostic.AV1554.severity = none
# AV1580: Argument for parameter calls nested method
dotnet_diagnostic.AV1580.severity = none
# AV1706: Parameter 'p' should have a more descriptive name
dotnet_diagnostic.AV1706.severity = suggestion
# AV1708: Type name contains term that should be avoided
dotnet_diagnostic.AV1708.severity = suggestion
# AV1710: Field contains the name of its containing type
dotnet_diagnostic.AV1710.severity = none
# AV2202: Replace call to Nullable<T>.HasValue with null check
dotnet_diagnostic.AV2202.severity = none
# AV2305: Missing XML comment for internally visible type or member
dotnet_diagnostic.AV2305.severity = none
# AV2407: Region should be removed
dotnet_diagnostic.AV2407.severity = none

# Convert lambda expression to method group
resharper_convert_closure_to_method_group_highlighting = none

# Start each element in a object or collection initializer on a new line
resharper_wrap_object_and_collection_initializer_style = chop_always

# Force an empty line
resharper_blank_lines_after_multiline_statements = 1

# Don't remove existing line breaks
resharper_keep_existing_initializer_arrangement = true
resharper_keep_existing_arrangement = true

# We care about that extra else after an else-if
resharper_redundant_if_else_block_highlighting = none

# Don't remove explicit default cases in switch statements 
resharper_redundant_empty_switch_section_highlighting = none

resharper_align_multiline_binary_expressions_chain = false

# Only use new() when the type is obvious
resharper_object_creation_when_type_not_evident = explicitly_typed
resharper_object_creation_when_type_evident = target_typed

# Indent 4 spaces per necessary indention
resharper_continuous_indent_multiplier = 1

# Avoid breaking a generic definition
resharper_wrap_before_extends_colon = true

resharper_blank_lines_before_multiline_statements = 1

resharper_parentheses_non_obvious_operations = arithmetic, multiplicative, equality, relational, additive
resharper_parentheses_redundancy_style = remove_if_not_clarifies_precedence

dotnet_analyzer_diagnostic.category-roslynator.severity = error

# Purpose: Remove trailing white-space
# Reason: It also complains about this when pressing enter to start a new empty line. 
dotnet_diagnostic.RCS1037.severity = none

# Remove suffix 'Async' from non-asynchronous method name. Disabled because we like that suffix for now.
dotnet_diagnostic.RCS1047.severity = none

# Combine 'Enumerable.Where' method chain. It doesn't make it more readable in all cases.
dotnet_diagnostic.RCS1112.severity = suggestion

# Inline local variable.
dotnet_diagnostic.RCS1124.severity = suggestion

# Add exception to documentation comment. Nice suggestion, but we don't want to document exceptions for internal code.
dotnet_diagnostic.RCS1140.severity = suggestion

# Missing documentation
dotnet_diagnostic.RCS1141.severity = suggestion
dotnet_diagnostic.RCS1142.severity = suggestion

# Use conditional access. Suggestion because it doesn't always improve readability
dotnet_diagnostic.RCS1146.severity = suggestion

# Enum should declare explicit values. Disabled because we're not storing them.
dotnet_diagnostic.RCS1161.severity = none

# Static member in generic type should use a type parameter. Disabled because it's not always applicable.
dotnet_diagnostic.RCS1158.severity = none

# Add region name to #endregion.
dotnet_diagnostic.RCS1189.severity = none

# Convert comment to documentation comment. Disabled because it also complains about SMELL/REFACTOR comments
dotnet_diagnostic.RCS1181.severity = none

# Use Regex instance instead of static method. Disabled because it's not always worth it.
dotnet_diagnostic.RCS1186.severity = none

# Use bit shift operator.
dotnet_diagnostic.RCS1237.severity = none

# RCS1228: Unused element in documentation comment. (Equivalent to SA1614)
dotnet_diagnostic.RCS1228.severity = suggestion

# Use an overload that has a IEqualityComparer<string> or IComparer<string> parameter
dotnet_diagnostic.MA0002.severity = suggestion

# Use Task.ConfigureAwait(false) as the current SynchronizationContext is not needed
dotnet_diagnostic.MA0004.severity = none

#  Use string.Equals instead of Equals operator 
dotnet_diagnostic.MA0006.severity = none

# Add regex evaluation timeout
dotnet_diagnostic.MA0009.severity = none

# Use an overload of 'ToString' that has a 'System.IFormatProvider' parameter. Already caught by CA1305.
dotnet_diagnostic.MA0011.severity = none

# Use an overload of 'System.ArgumentException' with the parameter name. Just a suggestion since we have a bunch of justified exceptions. 
dotnet_diagnostic.MA0015.severity = suggestion

# Use an explicit StringComparer to compute hash codes
dotnet_diagnostic.MA0021.severity = none

# Declare types in namespaces. Already caught by CA1050 
dotnet_diagnostic.MA0047.severity = none

# Use an overload of 'GetHashCode' that has a StringComparison parameter
dotnet_diagnostic.MA0074.severity = none
