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
171 changes: 171 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,171 @@
# EditorConfig - https://editorconfig.org
root = true

# All files
[*]
indent_style = space
indent_size = 4
end_of_line = crlf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

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

# XML config files
[*.{xml,config,nuspec,resx,ruleset,vsixmanifest,vsct}]
indent_size = 2

# JSON files
[*.json]
indent_size = 2

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

# Markdown files
[*.md]
trim_trailing_whitespace = false

# C# files
[*.cs]
# Organize usings
dotnet_sort_system_directives_first = true
dotnet_separate_import_directive_groups = false

# Namespace preferences
csharp_style_namespace_declarations = file_scoped:suggestion

# var preferences
csharp_style_var_for_built_in_types = false:suggestion
csharp_style_var_when_type_is_apparent = true:suggestion
csharp_style_var_elsewhere = false:suggestion

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

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

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

# 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

# Indentation preferences
csharp_indent_case_contents = true
csharp_indent_switch_labels = true

# Space preferences
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

# Wrapping preferences
csharp_preserve_single_line_statements = true
csharp_preserve_single_line_blocks = true

# Naming conventions
dotnet_naming_rule.interface_should_be_begins_with_i.severity = warning
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_symbols.interface.applicable_kinds = interface
dotnet_naming_symbols.interface.applicable_accessibilities = public, internal, private, protected, protected_internal

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

# Analyzer severity overrides

# --- Suppressed: not applicable across all target frameworks ---
# CA1510: Use ArgumentNullException.ThrowIfNull (.NET 6+ only, library targets netstandard2.0)
dotnet_diagnostic.CA1510.severity = none
# CA1512: Use ArgumentOutOfRangeException.ThrowIfNegativeOrZero (.NET 8+ only)
dotnet_diagnostic.CA1512.severity = none
# CA1835: Use Memory-based ReadAsync/WriteAsync (.NET Standard doesn't have these overloads)
dotnet_diagnostic.CA1835.severity = none

# --- Suppressed: intentional design choices ---
# CA1711: Do not suffix type names with 'EventArgs' - these ARE EventArgs subclasses
dotnet_diagnostic.CA1711.severity = none
# CA1720: Identifier contains type name - 'guid' is the domain term for client identifiers
dotnet_diagnostic.CA1720.severity = none
# CA1805: Do not explicitly initialize to default - intentional for readability in this codebase
dotnet_diagnostic.CA1805.severity = none
# CA5359: Do not disable certificate validation - AcceptInvalidCertificates is a documented user choice
dotnet_diagnostic.CA5359.severity = none

# --- Suppressed: pre-existing patterns, low risk ---
# CA1031: Do not catch general exception types
dotnet_diagnostic.CA1031.severity = none
# CA1032: Implement standard exception constructors
dotnet_diagnostic.CA1032.severity = none
# CA1051: Do not declare visible instance fields - internal fields on internal types
dotnet_diagnostic.CA1051.severity = none
# CA1062: Validate arguments of public methods
dotnet_diagnostic.CA1062.severity = none
# CA1303: Do not pass literals as localized parameters
dotnet_diagnostic.CA1303.severity = none
# CA1304: Specify CultureInfo
dotnet_diagnostic.CA1304.severity = none
# CA1311: Specify a culture or use an invariant version
dotnet_diagnostic.CA1311.severity = none
# CA1725: Parameter names should match base declaration
dotnet_diagnostic.CA1725.severity = none
# CA1850: Prefer static HashData method over ComputeHash
dotnet_diagnostic.CA1850.severity = none
# CA1854: Prefer TryGetValue over ContainsKey+indexer
dotnet_diagnostic.CA1854.severity = none
# CA1859: Change type for improved performance
dotnet_diagnostic.CA1859.severity = none
# CA1872: Prefer Convert.ToHexString over BitConverter.ToString chains
dotnet_diagnostic.CA1872.severity = none
# CA2201: Do not raise reserved exception types
dotnet_diagnostic.CA2201.severity = none
# CA5351: Do not use broken cryptographic algorithms (MD5 in test projects)
dotnet_diagnostic.CA5351.severity = none
# CA2263: Prefer generic overload of Enum.Parse - not available on all target frameworks
dotnet_diagnostic.CA2263.severity = none

# --- Suppressed globally, enforced in library csproj via AnalysisLevel ---
# CA1305: Specify IFormatProvider
dotnet_diagnostic.CA1305.severity = none
# CA1309: Use ordinal string comparison
dotnet_diagnostic.CA1309.severity = none
# CA1816: Call GC.SuppressFinalize correctly
dotnet_diagnostic.CA1816.severity = none
# CA1822: Member can be static
dotnet_diagnostic.CA1822.severity = none
# CA1852: Type can be sealed
dotnet_diagnostic.CA1852.severity = none
# CA2016: Forward CancellationToken
dotnet_diagnostic.CA2016.severity = none
# CA2208: Instantiate argument exceptions correctly
dotnet_diagnostic.CA2208.severity = none
# CA2007: Do not directly await a Task without ConfigureAwait
dotnet_diagnostic.CA2007.severity = none
# CA2227: Collection properties should be read only
dotnet_diagnostic.CA2227.severity = none

# IDE0005: Using directive is unnecessary
dotnet_diagnostic.IDE0005.severity = none
# IDE0044: Add readonly modifier
dotnet_diagnostic.IDE0044.severity = none
# IDE0060: Remove unused parameter
dotnet_diagnostic.IDE0060.severity = none
56 changes: 56 additions & 0 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Build and Test

on:
push:
branches: [main, master]
pull_request:
branches: [main, master]

jobs:
build-and-test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest]

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup .NET SDK
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
8.0.x
10.0.x

- name: Restore dependencies
run: dotnet restore src/WatsonTcp/WatsonTcp.csproj

- name: Restore test dependencies
run: dotnet restore src/Test.XUnit/Test.XUnit.csproj

- name: Build library (Release)
run: dotnet build src/WatsonTcp/WatsonTcp.csproj --configuration Release --no-restore

- name: Build tests (Release)
run: dotnet build src/Test.XUnit/Test.XUnit.csproj --configuration Release --no-restore

- name: Run tests (Linux - net8.0 and net10.0 only)
if: runner.os == 'Linux'
run: |
dotnet test src/Test.XUnit/Test.XUnit.csproj --configuration Release --no-build --framework net8.0 --logger "trx;LogFileName=test-results-net8.0.trx" --results-directory ./test-results
dotnet test src/Test.XUnit/Test.XUnit.csproj --configuration Release --no-build --framework net10.0 --logger "trx;LogFileName=test-results-net10.0.trx" --results-directory ./test-results

- name: Run tests (Windows - all frameworks)
if: runner.os == 'Windows'
run: |
dotnet test src/Test.XUnit/Test.XUnit.csproj --configuration Release --no-build --logger "trx;LogFileName=test-results.trx" --results-directory ./test-results

- name: Upload test results
if: always()
uses: actions/upload-artifact@v4
with:
name: test-results-${{ matrix.os }}
path: ./test-results/*.trx
Loading
Loading