Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add editor config #12

Merged
merged 5 commits into from
Feb 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
343 changes: 343 additions & 0 deletions DotnetFoundation/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,343 @@
# Naming rules

dotnet_naming_rule.interface_should_be_begins_with_i.severity = suggestion
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.types_should_be_pascal_case.severity = suggestion
dotnet_naming_rule.types_should_be_pascal_case.symbols = types
dotnet_naming_rule.types_should_be_pascal_case.style = pascal_case

dotnet_naming_rule.non_field_members_should_be_pascal_case.severity = suggestion
dotnet_naming_rule.non_field_members_should_be_pascal_case.symbols = non_field_members
dotnet_naming_rule.non_field_members_should_be_pascal_case.style = pascal_case

# Symbol specifications

dotnet_naming_symbols.interface.applicable_kinds = interface
dotnet_naming_symbols.interface.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
dotnet_naming_symbols.interface.required_modifiers =

dotnet_naming_symbols.types.applicable_kinds = class, struct, interface, enum
dotnet_naming_symbols.types.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
dotnet_naming_symbols.types.required_modifiers =

dotnet_naming_symbols.non_field_members.applicable_kinds = property, event, method
dotnet_naming_symbols.non_field_members.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
dotnet_naming_symbols.non_field_members.required_modifiers =

# Naming styles

dotnet_naming_style.begins_with_i.required_prefix = I
dotnet_naming_style.begins_with_i.required_suffix =
dotnet_naming_style.begins_with_i.word_separator =
dotnet_naming_style.begins_with_i.capitalization = pascal_case

dotnet_naming_style.pascal_case.required_prefix =
dotnet_naming_style.pascal_case.required_suffix =
dotnet_naming_style.pascal_case.word_separator =
dotnet_naming_style.pascal_case.capitalization = pascal_case

dotnet_naming_style.pascal_case.required_prefix =
dotnet_naming_style.pascal_case.required_suffix =
dotnet_naming_style.pascal_case.word_separator =
dotnet_naming_style.pascal_case.capitalization = pascal_case
dotnet_style_operator_placement_when_wrapping = beginning_of_line
tab_width = 4
indent_size = 4
end_of_line = crlf
dotnet_style_coalesce_expression = true:suggestion
dotnet_style_null_propagation = true:warning
dotnet_style_prefer_is_null_check_over_reference_equality_method = true:warning
dotnet_style_prefer_auto_properties = true:silent
dotnet_style_object_initializer = true:silent
dotnet_style_collection_initializer = true:silent
dotnet_style_prefer_simplified_boolean_expressions = true:suggestion
dotnet_style_prefer_conditional_expression_over_assignment = true:suggestion
dotnet_style_prefer_conditional_expression_over_return = true:suggestion
dotnet_style_explicit_tuple_names = true:warning
dotnet_style_prefer_inferred_tuple_names = false:suggestion
dotnet_style_prefer_inferred_anonymous_type_member_names = false:suggestion
dotnet_style_prefer_compound_assignment = true:silent
dotnet_style_prefer_simplified_interpolation = true:suggestion
dotnet_style_namespace_match_folder = true:suggestion
dotnet_style_readonly_field = true:suggestion
dotnet_style_predefined_type_for_locals_parameters_members = true:silent
dotnet_style_predefined_type_for_member_access = true:silent
dotnet_style_require_accessibility_modifiers = always:warning
dotnet_style_allow_multiple_blank_lines_experimental = true:silent
dotnet_style_allow_statement_immediately_after_block_experimental = true:silent
dotnet_code_quality_unused_parameters = non_public:error
dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity:silent
dotnet_style_parentheses_in_other_binary_operators = always_for_clarity:silent
dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity:silent
dotnet_style_parentheses_in_other_operators = never_if_unnecessary:silent
dotnet_style_qualification_for_field = true:warning
dotnet_style_qualification_for_property = true:warning
dotnet_style_qualification_for_method = true:warning
dotnet_style_qualification_for_event = true:warning

[*.cs]
csharp_using_directive_placement = outside_namespace:silent
csharp_prefer_simple_using_statement = true:suggestion
csharp_prefer_braces = true:error
csharp_style_namespace_declarations = file_scoped:error
csharp_style_prefer_method_group_conversion = true:suggestion
csharp_style_prefer_top_level_statements = true:silent
csharp_style_expression_bodied_methods = when_on_single_line:suggestion
csharp_style_expression_bodied_constructors = when_on_single_line:suggestion
csharp_style_expression_bodied_operators = when_on_single_line:suggestion
csharp_style_expression_bodied_properties = when_on_single_line:suggestion
csharp_style_expression_bodied_indexers = when_on_single_line:suggestion
csharp_indent_labels = one_less_than_current
csharp_style_expression_bodied_accessors = when_on_single_line:suggestion
csharp_style_expression_bodied_lambdas = when_on_single_line:suggestion
csharp_style_expression_bodied_local_functions = when_on_single_line:suggestion
csharp_style_throw_expression = true:suggestion
csharp_style_prefer_null_check_over_type_check = true:suggestion
csharp_prefer_simple_default_expression = true:suggestion
csharp_style_prefer_local_over_anonymous_function = true:suggestion
csharp_style_prefer_index_operator = true:suggestion
csharp_style_prefer_range_operator = true:suggestion
csharp_style_implicit_object_creation_when_type_is_apparent = true:suggestion
csharp_style_prefer_tuple_swap = true:suggestion
csharp_style_prefer_utf8_string_literals = true:suggestion
csharp_style_inlined_variable_declaration = false:suggestion
csharp_style_deconstructed_variable_declaration = true:suggestion
csharp_style_unused_value_assignment_preference = discard_variable:suggestion
csharp_style_unused_value_expression_statement_preference = discard_variable:silent
csharp_prefer_static_local_function = true:warning
csharp_style_prefer_readonly_struct = true:suggestion
csharp_style_allow_embedded_statements_on_same_line_experimental = true:silent
csharp_style_allow_blank_lines_between_consecutive_braces_experimental = true:silent
csharp_style_allow_blank_line_after_colon_in_constructor_initializer_experimental = true:silent
csharp_style_allow_blank_line_after_token_in_conditional_expression_experimental = true:silent
csharp_style_allow_blank_line_after_token_in_arrow_expression_clause_experimental = true:silent
csharp_style_conditional_delegate_call = true:suggestion
csharp_style_prefer_switch_expression = true:suggestion
csharp_style_prefer_pattern_matching = true:silent
csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion
csharp_style_pattern_matching_over_as_with_null_check = true:suggestion
csharp_style_prefer_not_pattern = true:suggestion
csharp_style_prefer_extended_property_pattern = true:suggestion
csharp_style_var_for_built_in_types = false:error
csharp_style_var_when_type_is_apparent = false:error
csharp_style_var_elsewhere = false:error

csharp_space_around_binary_operators = before_and_after

# Code analysis rules

# The cref tag in an XML documentation comment uses a prefix.
dotnet_diagnostic.CA1200.severity = none

# Do not pass literals as localized parameters
dotnet_diagnostic.CA1303.severity = none

dotnet_diagnostic.CA1304.severity = suggestion

dotnet_diagnostic.CA1305.severity = suggestion

# Specify StringComparison for clarity when comparing string
dotnet_diagnostic.CA1307.severity = suggestion

# Normalize strings to uppercase
dotnet_diagnostic.CA1308.severity = none

# Use ordinal StringComparison when comparing string
dotnet_diagnostic.CA1309.severity = suggestion

# Specify StringComparison for correctness when comparing string
dotnet_diagnostic.CA1310.severity = suggestion

# Specify a culture or use an invariant version for string to upper or to lower
dotnet_diagnostic.CA1311.severity = none

# Platform Invocation Services related method should not be exposed
dotnet_diagnostic.CA1401.severity = error

# The analyzer is enabled by default only for projects that target .NET 5 or later and have an AnalysisLevel of 5 or higher. It can be enabled for target frameworks lower than net5.0 by adding the following config
dotnet_code_quality.enable_platform_analyzer_on_pre_net5_target = true

# Validate platform compatibility for obsoleted APIs
dotnet_diagnostic.CA1422.severity = suggestion

# Avoid excessive inheritance (5 or more levels)
dotnet_diagnostic.CA1501.severity = suggestion

# Avoid excessive cyclomatic complexity
dotnet_diagnostic.CA1502.severity = warning

# Avoid low maintainability index value code
dotnet_diagnostic.CA1505.severity = suggestion

# Avoid excessive class coupling
dotnet_diagnostic.CA1506.severity = suggestion

# Avoid dead conditional code
dotnet_diagnostic.CA1508.severity = warning

# Invalid entry in code metrics configuration file
dotnet_diagnostic.CA1509.severity = error

# Avoid redundant length argument
dotnet_diagnostic.CA1514.severity = warning

# Do not name enum values 'Reserved'
dotnet_diagnostic.CA1700.severity = warning

# Identifiers should not contain underscores
dotnet_diagnostic.CA1707.severity = warning

# Identifiers should differ by more than case
dotnet_diagnostic.CA1708.severity = warning

# Identifiers should have correct suffix
dotnet_diagnostic.CA1710.severity = none

# Identifiers should not have incorrect suffix
dotnet_diagnostic.CA1711.severity = none

# Do not prefix enum values with type name
dotnet_diagnostic.CA1712.severity = warning

# Events should not have before or after prefix
dotnet_diagnostic.CA1713.severity = warning

# Flags enums should have plural names
dotnet_diagnostic.CA1714.severity = none

# Identifiers should not match keywords
dotnet_diagnostic.CA1716.severity = warning

# Only FlagsAttribute enums should have plural names
dotnet_diagnostic.CA1717.severity = none

# Identifiers should not contain type names
dotnet_diagnostic.CA1718.severity = suggestion

# Use PascalCase for named placeholders with ILogger
dotnet_diagnostic.CA1727.severity = none

# Call GC.SuppressFinalize correctly
dotnet_diagnostic.CA1816.severity = warning

# Rethrow to preserve stack details
dotnet_diagnostic.CA2200.severity = warning

# Disposable fields should be disposed
dotnet_diagnostic.CA2213.severity = suggestion

# Do not call overridable methods in constructors
dotnet_diagnostic.CA2214.severity = error

# Dispose methods should call base class dispose
dotnet_diagnostic.CA2215.severity = warning

# Disposable types should declare finalizer
dotnet_diagnostic.CA2216.severity = warning

# Operator overloads have named alternates
dotnet_diagnostic.CA2225.severity = none

# Collection properties should be read only
dotnet_diagnostic.CA2227.severity = none

# Overload operator equals on overriding ValueType.Equals
dotnet_diagnostic.CA2231.severity = none

# Pass System.Uri objects instead of strings
dotnet_diagnostic.CA2234.severity = none

# Mark ISerializable types with SerializableAttribute
dotnet_diagnostic.CA2237.severity = warning

# Attribute string literals should parse correctly
dotnet_diagnostic.CA2243.severity = none

# Do not assign a property to itself
dotnet_diagnostic.CA2245.severity = error

# Argument passed to TaskCompletionSource constructor should be TaskCreationOptions enum instead of TaskContinuationOptions enum
dotnet_diagnostic.CA2247.severity = warning

# Consider using String.Contains instead of String.IndexOf
dotnet_diagnostic.CA2249.severity = error

# Use ThrowIfCancellationRequested
dotnet_diagnostic.CA2250.severity = suggestion

# Use String.Equals over String.Compare
dotnet_diagnostic.CA2251.severity = error

# Template should be a static expression
dotnet_diagnostic.CA2254.severity = suggestion

# The ModuleInitializer attribute should not be used in libraries
dotnet_diagnostic.CA2255.severity = none

# Dispose objects before losing scope
dotnet_diagnostic.CA2000.severity = warning

# Do not directly await a Task
dotnet_diagnostic.CA2007.severity = warning

# Do not call ToImmutableCollection on an ImmutableCollection value
dotnet_diagnostic.CA2009.severity = warning

# Do not assign property within its setter
dotnet_diagnostic.CA2011.severity = error

# Do not use ReferenceEquals with value types
dotnet_diagnostic.CA2013.severity = error

# Do not use stackalloc in loops
dotnet_diagnostic.CA2014.severity = error

# Forward the CancellationToken parameter to methods that take one
dotnet_diagnostic.CA2016.severity = suggestion

# Parameter count mismatch
dotnet_diagnostic.CA2017.severity = error

# Types that own disposable fields should be disposable
dotnet_diagnostic.CA1001.severity = warning

# Define accessors for attribute arguments
dotnet_diagnostic.CA1019.severity = warning

# Avoid out parameters
dotnet_diagnostic.CA1021.severity = none

# Use properties where appropriate
dotnet_diagnostic.CA1024.severity = none

# Mark enums with FlagsAttribute
dotnet_diagnostic.CA1027.severity = none

# Do not catch general exception types
dotnet_diagnostic.CA1031.severity = suggestion

# Implement standard exception constructors
dotnet_diagnostic.CA1032.severity = warning

# Avoid empty interfaces
dotnet_diagnostic.CA1040.severity = suggestion

# Declare types in namespaces
dotnet_diagnostic.CA1050.severity = warning

# Static holder types should be Static or NotInheritable
dotnet_diagnostic.CA1052.severity = suggestion

# URI parameters should not be strings
dotnet_diagnostic.CA1054.severity = none

# URI return values should not be strings
dotnet_diagnostic.CA1055.severity = none

# URI properties should not be strings
dotnet_diagnostic.CA1056.severity = none

# Enums should not have duplicate values
dotnet_diagnostic.CA1069.severity = error
Loading
Loading