Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonCropp committed Oct 2, 2023
1 parent c08f062 commit c0d4bb4
Show file tree
Hide file tree
Showing 2 changed files with 175 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/Tests/NullabilitySync.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,12 @@ public async Task Run()
infoContext = infoContext
.Replace(".IsGenericMethodParameter", ".IsGenericMethodParameter()")
.Replace("SR.NullabilityInfoContext_NotSupported", "\"NullabilityInfoContext is not supported\"")
.Replace(
"CheckNullabilityAttributes(nullability, setter.GetParameters()[^1].GetCustomAttributesData());",
"""
var parameters = setter.GetParameters();
CheckNullabilityAttributes(nullability, parameters[parameters.Length-1].GetCustomAttributesData());
""")
.Replace(
"CheckNullabilityAttributes(nullability, setter.GetParameters()[^1].GetCustomAttributesData());",
"""
Expand Down
169 changes: 169 additions & 0 deletions src/editorconfig.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,169 @@
root = true
# EditorConfig: http://EditorConfig.org

# top-most EditorConfig file

[*]
indent_style = space


[*.cs]
indent_size = 4
charset = utf-8


# Microsoft .NET properties
trim_trailing_whitespace = true
csharp_preferred_modifier_order = public, private, protected, internal, new, static, abstract, virtual, sealed, readonly, override, extern, unsafe, volatile, async:suggestion
resharper_namespace_body = file_scoped
dotnet_naming_rule.private_constants_rule.severity = warning
dotnet_naming_rule.private_constants_rule.style = upper_camel_case_style
dotnet_naming_rule.private_constants_rule.symbols = private_constants_symbols
dotnet_naming_rule.private_instance_fields_rule.severity = warning
dotnet_naming_rule.private_instance_fields_rule.style = lower_camel_case_style
dotnet_naming_rule.private_instance_fields_rule.symbols = private_instance_fields_symbols
dotnet_naming_rule.private_static_fields_rule.severity = warning
dotnet_naming_rule.private_static_fields_rule.style = lower_camel_case_style
dotnet_naming_rule.private_static_fields_rule.symbols = private_static_fields_symbols
dotnet_naming_rule.private_static_readonly_rule.severity = warning
dotnet_naming_rule.private_static_readonly_rule.style = upper_camel_case_style
dotnet_naming_rule.private_static_readonly_rule.symbols = private_static_readonly_symbols
dotnet_naming_style.lower_camel_case_style.capitalization = camel_case
dotnet_naming_style.upper_camel_case_style.capitalization = pascal_case
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_instance_fields_symbols.applicable_accessibilities = private
dotnet_naming_symbols.private_instance_fields_symbols.applicable_kinds = field
dotnet_naming_symbols.private_static_fields_symbols.applicable_accessibilities = private
dotnet_naming_symbols.private_static_fields_symbols.applicable_kinds = field
dotnet_naming_symbols.private_static_fields_symbols.required_modifiers = static
dotnet_naming_symbols.private_static_readonly_symbols.applicable_accessibilities = private
dotnet_naming_symbols.private_static_readonly_symbols.applicable_kinds = field
dotnet_naming_symbols.private_static_readonly_symbols.required_modifiers = static, readonly
dotnet_style_parentheses_in_arithmetic_binary_operators = never_if_unnecessary:none
dotnet_style_parentheses_in_other_binary_operators = always_for_clarity:none
dotnet_style_parentheses_in_relational_binary_operators = never_if_unnecessary:none

# ReSharper properties
resharper_object_creation_when_type_not_evident = target_typed

# ReSharper inspection severities
resharper_arrange_object_creation_when_type_evident_highlighting = error
resharper_arrange_object_creation_when_type_not_evident_highlighting = error
resharper_arrange_redundant_parentheses_highlighting = error
resharper_arrange_static_member_qualifier_highlighting = error
resharper_arrange_this_qualifier_highlighting = hint
resharper_arrange_type_member_modifiers_highlighting = none
resharper_built_in_type_reference_style_for_member_access_highlighting = hint
resharper_built_in_type_reference_style_highlighting = hint
resharper_check_namespace_highlighting = none
resharper_convert_to_using_declaration_highlighting = error
resharper_css_not_resolved_highlighting = warning
resharper_field_can_be_made_read_only_local_highlighting = none
resharper_merge_into_logical_pattern_highlighting = warning
resharper_merge_into_pattern_highlighting = error
resharper_method_has_async_overload_highlighting = warning
resharper_partial_type_with_single_part_highlighting = error
resharper_redundant_base_qualifier_highlighting = warning
resharper_redundant_cast_highlighting = error
resharper_redundant_empty_object_creation_argument_list_highlighting = error
resharper_redundant_empty_object_or_collection_initializer_highlighting = error
resharper_redundant_name_qualifier_highlighting = error
resharper_redundant_suppress_nullable_warning_expression_highlighting = error
resharper_redundant_using_directive_highlighting = error
resharper_redundant_verbatim_string_prefix_highlighting = error
resharper_replace_substring_with_range_indexer_highlighting = warning
resharper_suggest_var_or_type_built_in_types_highlighting = error
resharper_suggest_var_or_type_elsewhere_highlighting = error
resharper_suggest_var_or_type_simple_types_highlighting = error
resharper_unnecessary_whitespace_highlighting = error
resharper_use_await_using_highlighting = warning
resharper_use_deconstruction_highlighting = warning

# Sort using and Import directives with System.* appearing first
dotnet_sort_system_directives_first = true

# Avoid "this." and "Me." if not necessary
dotnet_style_qualification_for_field = false:error
dotnet_style_qualification_for_property = false:error
dotnet_style_qualification_for_method = false:error
dotnet_style_qualification_for_event = false:error

# Use language keywords instead of framework type names for type references
dotnet_style_predefined_type_for_locals_parameters_members = true:error
dotnet_style_predefined_type_for_member_access = true:error

# Suggest more modern language features when available
dotnet_style_object_initializer = true:suggestion
dotnet_style_collection_initializer = true:suggestion
dotnet_style_coalesce_expression = false:suggestion
dotnet_style_null_propagation = true:suggestion
dotnet_style_explicit_tuple_names = true:suggestion

# Prefer "var" everywhere
csharp_style_var_for_built_in_types = true:error
csharp_style_var_when_type_is_apparent = true:error
csharp_style_var_elsewhere = true:error

# Prefer method-like constructs to have a block body
csharp_style_expression_bodied_methods = true:error
csharp_style_expression_bodied_local_functions = true:error
csharp_style_expression_bodied_constructors = true:error
csharp_style_expression_bodied_operators = true:error
resharper_place_expr_method_on_single_line = false

# Prefer property-like constructs to have an expression-body
csharp_style_expression_bodied_properties = true:error
csharp_style_expression_bodied_indexers = true:error
csharp_style_expression_bodied_accessors = true:error

# Suggest more modern language features when available
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:suggestion
csharp_style_throw_expression = true:suggestion
csharp_style_conditional_delegate_call = true:suggestion

# Newline settings
#csharp_new_line_before_open_brace = all:error
resharper_max_array_initializer_elements_on_line = 1
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
resharper_wrap_before_first_type_parameter_constraint = true
resharper_wrap_extends_list_style = chop_always
resharper_wrap_after_dot_in_method_calls = false
resharper_wrap_before_binary_pattern_op = false
resharper_wrap_object_and_collection_initializer_style = chop_always
resharper_place_simple_initializer_on_single_line = false

# space
resharper_space_around_lambda_arrow = true

dotnet_style_require_accessibility_modifiers = never:error
resharper_place_type_constraints_on_same_line = false
resharper_blank_lines_inside_namespace = 0
resharper_blank_lines_after_file_scoped_namespace_directive = 1
resharper_blank_lines_inside_type = 0

#braces https://www.jetbrains.com/help/resharper/EditorConfig_CSHARP_CSharpCodeStylePageImplSchema.html#Braces
resharper_braces_for_ifelse = required
resharper_braces_for_foreach = required
resharper_braces_for_while = required
resharper_braces_for_dowhile = required
resharper_braces_for_lock = required
resharper_braces_for_fixed = required
resharper_braces_for_for = required

# Xml files
[*.{xml,config,nuspec,resx,vsixmanifest,csproj,targets,props}]
indent_size = 2
# https://www.jetbrains.com/help/resharper/EditorConfig_XML_XmlCodeStylePageSchema.html#resharper_xml_blank_line_after_pi
resharper_blank_line_after_pi = false
resharper_space_before_self_closing = true

[*.json]
indent_size = 2

0 comments on commit c0d4bb4

Please sign in to comment.