Skip to content
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
2 changes: 1 addition & 1 deletion .devcontainer/post-create.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env bash
set -euo pipefail

# The solution (src/main/SegCtlr.Netstandard.sln) also holds the legacy Xamarin.iOS, Xamarin.Android, Xamarin.Mac
# The solution (src/main/SegCtlr.Netstandard.slnx) also holds the legacy Xamarin.iOS, Xamarin.Android, Xamarin.Mac
# and UWP projects, which cannot restore on Linux. Restore the netstandard test app instead: it references the
# library, so both netstandard projects restore.
solution_path="src/test/Test.SegCtrl.netstandard/Test.SegCtrl.netstandard.csproj"
Expand Down
198 changes: 198 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,198 @@
# Code style for Plugin.SegmentedControl.
#
# SDK-style projects (the library, the shared sample and the tests) enforce these rules at build time through
# EnforceCodeStyleInBuild in Directory.Build.props. Rules set to "warning" fail the library and test builds,
# which use TreatWarningsAsErrors. The legacy Xamarin platform projects only show them in the IDE.

root = true

[*]
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true

[*.{csproj,props,targets,nuspec,xml,xaml,axml,json,yml,yaml}]
indent_size = 2

[*.md]
trim_trailing_whitespace = false

[*.cs]
indent_size = 4
max_line_length = 120

#### Formatting (IDE0055) ####
dotnet_diagnostic.IDE0055.severity = warning
dotnet_sort_system_directives_first = true
dotnet_separate_import_directive_groups = false
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_indent_case_contents = true
csharp_indent_switch_labels = true
csharp_indent_labels = one_less_than_current
csharp_indent_block_contents = true
csharp_indent_braces = false
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
csharp_space_around_binary_operators = before_and_after
csharp_preserve_single_line_statements = false
csharp_preserve_single_line_blocks = true

#### Usings and namespaces ####
csharp_using_directive_placement = outside_namespace:warning
dotnet_diagnostic.IDE0065.severity = warning
# Unnecessary usings (needs GenerateDocumentationFile to be reported at build time).
dotnet_diagnostic.IDE0005.severity = warning
csharp_style_namespace_declarations = file_scoped:warning
dotnet_diagnostic.IDE0161.severity = warning

#### Braces and blocks ####
csharp_prefer_braces = true:warning
dotnet_diagnostic.IDE0011.severity = warning

#### var ####
csharp_style_var_for_built_in_types = true:warning
csharp_style_var_when_type_is_apparent = true:warning
csharp_style_var_elsewhere = true:warning
dotnet_diagnostic.IDE0007.severity = warning
dotnet_diagnostic.IDE0008.severity = none

#### Modifiers ####
dotnet_style_require_accessibility_modifiers = for_non_interface_members:warning
dotnet_diagnostic.IDE0040.severity = warning
csharp_preferred_modifier_order = public,private,protected,internal,file,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,required,volatile,async:warning
dotnet_diagnostic.IDE0036.severity = warning
dotnet_style_readonly_field = true:warning
dotnet_diagnostic.IDE0044.severity = warning

#### this. and predefined types ####
dotnet_style_qualification_for_field = false:warning
dotnet_style_qualification_for_property = false:warning
dotnet_style_qualification_for_method = false:warning
dotnet_style_qualification_for_event = false:warning
dotnet_diagnostic.IDE0003.severity = warning
dotnet_style_predefined_type_for_locals_parameters_members = true:warning
dotnet_style_predefined_type_for_member_access = true:warning
dotnet_diagnostic.IDE0049.severity = warning

#### Modern language features ####
# `is null` / `is not null` rather than `== null` or `!(x is null)`.
dotnet_style_prefer_is_null_check_over_reference_equality_method = true:warning
dotnet_diagnostic.IDE0041.severity = warning
csharp_style_prefer_not_pattern = true:warning
dotnet_diagnostic.IDE0083.severity = warning
csharp_style_prefer_pattern_matching = true:suggestion
csharp_style_pattern_matching_over_as_with_null_check = true:warning
dotnet_diagnostic.IDE0019.severity = warning
csharp_style_pattern_matching_over_is_with_cast_check = true:warning
dotnet_diagnostic.IDE0020.severity = warning
# Target-typed new and collection expressions.
csharp_style_implicit_object_creation_when_type_is_apparent = true:warning
dotnet_diagnostic.IDE0090.severity = warning
dotnet_style_prefer_collection_expression = when_types_loosely_match:warning
dotnet_diagnostic.IDE0028.severity = warning
dotnet_diagnostic.IDE0300.severity = warning
dotnet_diagnostic.IDE0301.severity = warning
dotnet_diagnostic.IDE0303.severity = warning
dotnet_diagnostic.IDE0305.severity = warning
# Null propagation, coalescing and conditional delegate calls.
dotnet_style_null_propagation = true:warning
dotnet_diagnostic.IDE0031.severity = warning
dotnet_style_coalesce_expression = true:warning
dotnet_diagnostic.IDE0029.severity = warning
dotnet_diagnostic.IDE0030.severity = warning
csharp_style_conditional_delegate_call = true:warning
dotnet_diagnostic.IDE1005.severity = warning
dotnet_style_object_initializer = true:warning
dotnet_diagnostic.IDE0017.severity = warning
csharp_style_inlined_variable_declaration = true:warning
dotnet_diagnostic.IDE0018.severity = warning
csharp_style_deconstructed_variable_declaration = true:suggestion
csharp_style_prefer_primary_constructors = true:suggestion
csharp_style_prefer_switch_expression = true:suggestion
csharp_style_prefer_range_operator = true:suggestion
csharp_style_prefer_index_operator = true:suggestion
csharp_style_expression_bodied_properties = true:suggestion
csharp_style_expression_bodied_accessors = true:suggestion
csharp_style_expression_bodied_indexers = true:suggestion
csharp_style_expression_bodied_lambdas = true:suggestion
csharp_style_expression_bodied_methods = when_on_single_line:suggestion
csharp_style_expression_bodied_constructors = false:suggestion
csharp_style_expression_bodied_operators = when_on_single_line:suggestion
csharp_style_expression_bodied_local_functions = when_on_single_line:suggestion
csharp_style_unused_value_assignment_preference = discard_variable:warning
dotnet_diagnostic.IDE0059.severity = warning
csharp_style_unused_value_expression_statement_preference = discard_variable:suggestion
dotnet_code_quality_unused_parameters = non_public:warning
dotnet_diagnostic.IDE0060.severity = warning
dotnet_diagnostic.IDE0051.severity = warning
dotnet_diagnostic.IDE0052.severity = warning
# Redundant casts.
dotnet_diagnostic.IDE0004.severity = warning
# Simplify names.
dotnet_diagnostic.IDE0001.severity = warning
dotnet_diagnostic.IDE0002.severity = warning
# Remove unnecessary parentheses / empty lines.
dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity:suggestion
dotnet_style_parentheses_in_other_binary_operators = always_for_clarity:suggestion
dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity:suggestion
dotnet_style_parentheses_in_other_operators = never_if_unnecessary:suggestion
dotnet_style_allow_multiple_blank_lines_experimental = false:warning
dotnet_diagnostic.IDE2000.severity = warning
csharp_style_allow_blank_lines_between_consecutive_braces_experimental = false:warning
dotnet_diagnostic.IDE2002.severity = warning

#### Naming (IDE1006) ####
dotnet_diagnostic.IDE1006.severity = warning

dotnet_naming_symbols.interfaces.applicable_kinds = interface
dotnet_naming_style.begins_with_i.required_prefix = I
dotnet_naming_style.begins_with_i.capitalization = pascal_case
dotnet_naming_rule.interfaces_begin_with_i.symbols = interfaces
dotnet_naming_rule.interfaces_begin_with_i.style = begins_with_i
dotnet_naming_rule.interfaces_begin_with_i.severity = warning

dotnet_naming_symbols.types_and_members.applicable_kinds = class, struct, enum, delegate, property, method, event
dotnet_naming_style.pascal_case.capitalization = pascal_case
dotnet_naming_rule.types_and_members_pascal_case.symbols = types_and_members
dotnet_naming_rule.types_and_members_pascal_case.style = pascal_case
dotnet_naming_rule.types_and_members_pascal_case.severity = warning

dotnet_naming_symbols.constants.applicable_kinds = field
dotnet_naming_symbols.constants.required_modifiers = const
dotnet_naming_rule.constants_pascal_case.symbols = constants
dotnet_naming_rule.constants_pascal_case.style = pascal_case
dotnet_naming_rule.constants_pascal_case.severity = warning

dotnet_naming_symbols.public_fields.applicable_kinds = field
dotnet_naming_symbols.public_fields.applicable_accessibilities = public, internal, protected, protected_internal
dotnet_naming_rule.public_fields_pascal_case.symbols = public_fields
dotnet_naming_rule.public_fields_pascal_case.style = pascal_case
dotnet_naming_rule.public_fields_pascal_case.severity = warning

dotnet_naming_symbols.private_fields.applicable_kinds = field
dotnet_naming_symbols.private_fields.applicable_accessibilities = private, private_protected
dotnet_naming_style.underscore_camel_case.required_prefix = _
dotnet_naming_style.underscore_camel_case.capitalization = camel_case
dotnet_naming_rule.private_fields_underscore.symbols = private_fields
dotnet_naming_rule.private_fields_underscore.style = underscore_camel_case
dotnet_naming_rule.private_fields_underscore.severity = warning

dotnet_naming_symbols.locals_and_parameters.applicable_kinds = parameter, local, local_function
dotnet_naming_style.camel_case.capitalization = camel_case
dotnet_naming_rule.locals_camel_case.symbols = locals_and_parameters
dotnet_naming_rule.locals_camel_case.style = camel_case
dotnet_naming_rule.locals_camel_case.severity = warning

[src/test/SegCtlr.Tests/**.cs]
# xUnit test names read as sentences: Method_does_thing_when_condition.
dotnet_naming_rule.types_and_members_pascal_case.severity = none
# Test classes are public, but their members don't need XML docs.
dotnet_diagnostic.CS1591.severity = none
Loading
Loading