Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
ByteDecoder committed Aug 18, 2020
0 parents commit 2f49299
Show file tree
Hide file tree
Showing 27 changed files with 1,229 additions and 0 deletions.
250 changes: 250 additions & 0 deletions src/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,250 @@
# Schema: http://EditorConfig.org
# Docs: https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-code-style-settings-reference

# top-most EditorConfig file
root = true

# Don't use tabs for indentation.
[*]
indent_style = space
trim_trailing_whitespace = true

# Code files
[*.{cs,csx,vb,vbx}]
indent_size = 4
insert_final_newline = true
charset = utf-8-bom

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

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

# JSON files
[*.{json,json5}]
indent_size = 2

# YAML Files
[*.{yml,yaml}]
indent_size = 2

# Shell scripts
[*.sh]
end_of_line = lf

[*.{cmd,bat}]
end_of_line = crlf

# Web Files
[*.{htm,html,js,ts,css,scss,less}]
indent_size = 2
insert_final_newline = true

## Language conventions
# Dotnet code style settings:
[*.{cs,csx,cake,vb}]
# Avoid "this." and "Me." if not necessary
dotnet_style_qualification_for_event = false : warning
dotnet_style_qualification_for_field = false : warning
dotnet_style_qualification_for_method = false : warning
dotnet_style_qualification_for_property = false : warning

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

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

dotnet_style_prefer_is_null_check_over_reference_equality_method = true : warning
dotnet_style_readonly_field = true : warning
dotnet_style_prefer_auto_properties = true : suggestion
dotnet_style_prefer_inferred_tuple_names = true : suggestion
dotnet_style_prefer_inferred_anonymous_type_member_names = true : suggestion

# CSharp code style settings:
[*.cs]
# Prefer "var" everywhere (Implicit and explicit types)
csharp_style_var_elsewhere = true : suggestion
csharp_style_var_for_built_in_types = true : suggestion
csharp_style_var_when_type_is_apparent = true : warning

# Expression-Bodied members
csharp_style_expression_bodied_accessors = true : suggestion
csharp_style_expression_bodied_indexers = true : suggestion
csharp_style_expression_bodied_operators = true : suggestion
csharp_style_expression_bodied_properties = true : suggestion
# Explicitly disabled due to difference in coding style between source and tests
#csharp_style_expression_bodied_constructors = true : warning
#csharp_style_expression_bodied_methods = true : warning

# Pattern matching
csharp_style_pattern_matching_over_as_with_null_check = true : suggestion
csharp_style_pattern_matching_over_is_with_cast_check = true : suggestion

# Inlined variable declarations
csharp_style_inlined_variable_declaration = true : suggestion

# Expression-level preferences
csharp_prefer_inferred_anonymous_type_member_names = true : warning
csharp_prefer_inferred_tuple_names = true : warning
csharp_prefer_simple_default_expression = true : warning
csharp_preferred_modifier_order = public,private,protected,internal,const,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,volatile,async
csharp_style_deconstructed_variable_declaration = true : warning
csharp_style_pattern_local_over_anonymous_function = true : warning

# Null-checking preference
csharp_style_conditional_delegate_call = true : warning
csharp_style_throw_expression = true : warning

# Code block preferences
#csharp_prefer_braces = true : suggestion # Disabled because it doesn't support no braces for control flow keywords (return, break, throw)

## Formatting conventions
# Dotnet formatting settings:
[*.{cs,vb}]
# Organize usings
dotnet_sort_system_directives_first = true

# CSharp formatting settings:
[*.cs]
# Newline options
csharp_new_line_before_catch = true
csharp_new_line_before_else = true
csharp_new_line_before_finally = true
csharp_new_line_before_members_in_anonymous_types = true
csharp_new_line_before_members_in_object_initializers = true
csharp_new_line_before_open_brace = all
csharp_new_line_between_query_expression_clauses = true

# Identation options
csharp_indent_block_contents = true
csharp_indent_braces = false
csharp_indent_case_contents = true
csharp_indent_case_contents_when_block = true
csharp_indent_switch_labels = true
csharp_indent_labels = flush_left

# Spacing options
csharp_space_after_cast = false
csharp_space_after_keywords_in_control_flow_statements = true
csharp_space_around_binary_operators = before_and_after
csharp_space_between_method_call_parameter_list_parentheses = false
csharp_space_between_method_declaration_parameter_list_parentheses = false
csharp_space_between_parentheses = false
csharp_space_before_colon_in_inheritance_clause = true
csharp_space_after_colon_in_inheritance_clause = true
csharp_space_between_method_declaration_empty_parameter_list_parentheses = false
csharp_space_between_method_call_name_and_opening_parenthesis = false
csharp_space_between_method_call_empty_parameter_list_parentheses = false

# Wrapping options
csharp_preserve_single_line_blocks = true
csharp_preserve_single_line_statements = false

## Naming conventions
[*.{cs,vb}]

# Non-private static fields are PascalCase
dotnet_naming_rule.non_private_static_fields_should_be_pascal_case.severity = suggestion
dotnet_naming_rule.non_private_static_fields_should_be_pascal_case.symbols = non_private_static_fields
dotnet_naming_rule.non_private_static_fields_should_be_pascal_case.style = non_private_static_field_style

dotnet_naming_symbols.non_private_static_fields.applicable_kinds = field
dotnet_naming_symbols.non_private_static_fields.applicable_accessibilities = public, protected, internal, protected internal, private protected
dotnet_naming_symbols.non_private_static_fields.required_modifiers = static

dotnet_naming_style.non_private_static_field_style.capitalization = pascal_case

# Constants are PascalCase
dotnet_naming_rule.constants_should_be_pascal_case.severity = suggestion
dotnet_naming_rule.constants_should_be_pascal_case.symbols = constants
dotnet_naming_rule.constants_should_be_pascal_case.style = constant_style

dotnet_naming_symbols.constants.applicable_kinds = field, local
dotnet_naming_symbols.constants.required_modifiers = const

dotnet_naming_style.constant_style.capitalization = pascal_case

# Static fields are camelCase and start with s_
dotnet_naming_rule.static_fields_should_be_camel_case.severity = suggestion
dotnet_naming_rule.static_fields_should_be_camel_case.symbols = static_fields
dotnet_naming_rule.static_fields_should_be_camel_case.style = static_field_style

dotnet_naming_symbols.static_fields.applicable_kinds = field
dotnet_naming_symbols.static_fields.required_modifiers = static

dotnet_naming_style.static_field_style.capitalization = camel_case
dotnet_naming_style.static_field_style.required_prefix = s_

# Instance fields are camelCase and start with _
dotnet_naming_rule.instance_fields_should_be_camel_case.severity = suggestion
dotnet_naming_rule.instance_fields_should_be_camel_case.symbols = instance_fields
dotnet_naming_rule.instance_fields_should_be_camel_case.style = instance_field_style

dotnet_naming_symbols.instance_fields.applicable_kinds = field

dotnet_naming_style.instance_field_style.capitalization = camel_case
dotnet_naming_style.instance_field_style.required_prefix = _

# Locals and parameters are camelCase
dotnet_naming_rule.locals_should_be_camel_case.severity = suggestion
dotnet_naming_rule.locals_should_be_camel_case.symbols = locals_and_parameters
dotnet_naming_rule.locals_should_be_camel_case.style = camel_case_style

dotnet_naming_symbols.locals_and_parameters.applicable_kinds = parameter, local
dotnet_naming_style.camel_case_style.capitalization = camel_case

# Local functions are PascalCase
dotnet_naming_rule.local_functions_should_be_pascal_case.severity = suggestion
dotnet_naming_rule.local_functions_should_be_pascal_case.symbols = local_functions
dotnet_naming_rule.local_functions_should_be_pascal_case.style = local_function_style

dotnet_naming_symbols.local_functions.applicable_kinds = local_function
dotnet_naming_style.local_function_style.capitalization = pascal_case

# Type Parameters
dotnet_naming_style.type_parameter_style.capitalization = pascal_case
dotnet_naming_style.type_parameter_style.required_prefix = T

dotnet_naming_rule.type_parameter_naming.symbols = type_parameter_symbol
dotnet_naming_rule.type_parameter_naming.style = type_parameter_style
dotnet_naming_rule.type_parameter_naming.severity = warning
dotnet_naming_symbols.type_parameter_symbol.applicable_kinds = type_parameter
dotnet_naming_symbols.type_parameter_symbol.applicable_accessibilities = *

# By default, name items with PascalCase
dotnet_naming_rule.members_should_be_pascal_case.severity = suggestion
dotnet_naming_rule.members_should_be_pascal_case.symbols = all_members
dotnet_naming_rule.members_should_be_pascal_case.style = pascal_case_style

dotnet_naming_symbols.all_members.applicable_kinds = *

dotnet_naming_style.pascal_case_style.capitalization = pascal_case

## Analyzers
# IDE0002: Name can be simplified
dotnet_diagnostic.IDE0002.severity = suggestion

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

# IDE1006: Naming rule violation
dotnet_diagnostic.IDE1006.severity = suggestion

# MA0006: use String.Equals
dotnet_diagnostic.MA0006.severity = none

# Meziantou Analyzer
MA0051.maximum_statements_per_method = 40
MA0051.skip_local_functions = false
MA0051.maximum_lines_per_method = 60
MA0053.public_class_should_be_sealed = true
1 change: 1 addition & 0 deletions src/ByteDecoder.Common.Tests/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
coverage.json
41 changes: 41 additions & 0 deletions src/ByteDecoder.Common.Tests/ByteDecoder.Common.Tests.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<IsPackable>false</IsPackable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.7.0" />
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="coverlet.collector" Version="1.3.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="coverlet.msbuild" Version="2.9.0" />
<PackageReference Include="Microsoft.CodeAnalysis.FxCopAnalyzers" Version="3.3.0" />
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118" >
<PrivateAssets>all</PrivateAssets>
</PackageReference>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\ByteDecoder.Common\ByteDecoder.Common.csproj" />
</ItemGroup>

<ItemGroup>
<AdditionalFiles Include="$(SolutionDir)\_stylecop\stylecop.json" Link="stylecop.json" />
</ItemGroup>

<PropertyGroup>
<CodeAnalysisRuleSet>$(SolutionDir)\_stylecop\TestProjStyleCopRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<TreatWarningsAsErrors>True</TreatWarningsAsErrors>
<TreatSpecificWarningsAsErrors />
<NoWarn>1701;1702;1705</NoWarn>
</PropertyGroup>

</Project>
Loading

0 comments on commit 2f49299

Please sign in to comment.