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
199 changes: 198 additions & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
@@ -1,4 +1,201 @@
root = true

[*]
indent_style = space
indent_size = 4

[*.cs]

#### 1. Layout & wrapping — Rider: WRAP_LIMIT, WRAP_LINES, LINE_FEED_AT_FILE_END, PLACE_COMMENTS_AT_FIRST_COLUMN, MAX_ENUM_MEMBERS_ON_LINE
indent_style = space
indent_size = 4
tab_width = 4
insert_final_newline = true
trim_trailing_whitespace = true
max_line_length = 180
resharper_wrap_lines = false
resharper_place_comments_at_first_column = true
resharper_max_enum_members_on_line = 1
resharper_place_accessorholder_attribute_on_same_line = never

#### 2. Braces — Allman, and required on every control statement (Rider: BRACES_FOR_IFELSE/_FOR/_FOREACH/_WHILE = Required)
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_prefer_braces = true:warning
resharper_braces_for_ifelse = required
resharper_braces_for_for = required
resharper_braces_for_foreach = required
resharper_braces_for_while = required
resharper_enforce_if_statement_braces_highlighting = warning
resharper_enforce_for_statement_braces_highlighting = warning
resharper_enforce_foreach_statement_braces_highlighting = warning
resharper_enforce_while_statement_braces_highlighting = warning
resharper_enforce_do_while_statement_braces_highlighting = warning
resharper_enforce_using_statement_braces_highlighting = warning
resharper_enforce_lock_statement_braces_highlighting = warning
resharper_enforce_fixed_statement_braces_highlighting = warning
resharper_remove_redundant_braces_highlighting = warning

#### 3. Blank lines — DEVELOPMENT_STANDARDS.md §1.3 (blank line on both sides of every braced block)
resharper_blank_lines_before_block_statements = 1
resharper_blank_lines_after_control_transfer_statements = 1
resharper_blank_lines_before_multiline_statements = 1
resharper_blank_lines_after_multiline_statements = 1
resharper_blank_lines_before_single_line_comment = 1
resharper_blank_lines_around_single_line_invocable = 1
resharper_blank_lines_around_single_line_local_method = 1
resharper_blank_lines_around_single_line_property = 1
resharper_blank_lines_around_single_line_auto_property = 1
resharper_blank_lines_between_using_groups = 1
resharper_keep_blank_lines_in_code = 1
resharper_keep_blank_lines_in_declarations = 1

#### 4. Namespaces & usings — DEVELOPMENT_STANDARDS.md §1.10; Rider: NAMESPACE_BODY = BlockScoped, AddImportsToDeepestScope = True
csharp_style_namespace_declarations = block_scoped:warning
csharp_using_directive_placement = inside_namespace:warning
dotnet_sort_system_directives_first = true
dotnet_separate_import_directive_groups = true
resharper_arrange_namespace_body_highlighting = warning
resharper_qualified_using_at_nested_scope = true
resharper_can_use_global_alias = false

#### 5. `this.` qualification — Rider: INSTANCE_MEMBERS_QUALIFY_MEMBERS = Field, Property, Event, Method
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
resharper_arrange_this_qualifier_highlighting = warning

#### 6. `var` — house rule: `var` wherever it is applicable
csharp_style_var_for_built_in_types = true:suggestion
csharp_style_var_when_type_is_apparent = true:suggestion
csharp_style_var_elsewhere = true:suggestion
resharper_suggest_var_or_type_built_in_types_highlighting = warning
resharper_suggest_var_or_type_simple_types_highlighting = warning
resharper_suggest_var_or_type_elsewhere_highlighting = warning

#### 7. Expressions, patterns & members — DEVELOPMENT_STANDARDS.md §1.1, §1.2, §1.5, §1.6, §2
dotnet_style_prefer_auto_properties = true:warning
dotnet_style_prefer_collection_expression = true:warning
dotnet_style_collection_initializer = true:warning
dotnet_style_object_initializer = true:suggestion
dotnet_style_prefer_conditional_expression_over_return = true:suggestion
dotnet_style_prefer_conditional_expression_over_assignment = true:suggestion
dotnet_style_coalesce_expression = true:suggestion
dotnet_style_null_propagation = true:suggestion
dotnet_style_readonly_field = true:suggestion
dotnet_style_predefined_type_for_locals_parameters_members = true:warning
dotnet_style_predefined_type_for_member_access = true:warning
csharp_style_prefer_switch_expression = true:warning
csharp_style_prefer_pattern_matching = true:warning
csharp_style_pattern_matching_over_is_with_cast_check = true:warning
csharp_style_pattern_matching_over_as_with_null_check = true:warning
csharp_style_prefer_not_pattern = true:warning
csharp_style_prefer_extended_property_pattern = true:warning
csharp_style_throw_expression = true:suggestion
csharp_style_conditional_delegate_call = true:suggestion
csharp_style_prefer_static_local_function = true:suggestion
csharp_style_expression_bodied_methods = 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_style_expression_bodied_accessors = when_on_single_line:suggestion
csharp_style_expression_bodied_operators = 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_expression_bodied_constructors = false:suggestion
csharp_style_prefer_primary_constructors = false:none

#### 8. XML documentation formatting — Rider: XmlDocFormatter
resharper_xmldoc_indent_size = 1
resharper_xmldoc_tab_width = 1
resharper_xmldoc_indent_tag_content = ZeroIndent
resharper_xmldoc_wrap_inside_text = false

#### 9. Inspection severities — mirrors the Rider inspection profile
resharper_inconsistent_naming_highlighting = hint
resharper_arrange_accessor_owner_body_highlighting = hint
resharper_field_can_be_made_read_only_local_highlighting = hint
resharper_bad_control_braces_line_breaks_highlighting = hint
resharper_bad_declaration_braces_line_breaks_highlighting = hint
resharper_bad_empty_braces_line_breaks_highlighting = hint
resharper_bad_expression_braces_line_breaks_highlighting = hint
resharper_bad_linq_line_breaks_highlighting = hint
resharper_bad_list_line_breaks_highlighting = hint
resharper_bad_parens_line_breaks_highlighting = hint
resharper_incorrect_blank_lines_near_braces_highlighting = hint
resharper_missing_blank_lines_highlighting = hint
resharper_missing_linebreak_highlighting = hint
resharper_multiple_statements_on_one_line_highlighting = hint
resharper_multiple_type_members_on_one_line_highlighting = hint
resharper_redundant_blank_lines_highlighting = hint
resharper_redundant_linebreak_highlighting = hint
resharper_auto_property_can_be_made_get_only_local_highlighting = none
resharper_non_readonly_member_in_get_hash_code_highlighting = none
resharper_redundant_name_qualifier_highlighting = none
resharper_convert_to_primary_constructor_highlighting = none
resharper_replace_with_primary_constructor_parameter_highlighting = none
resharper_comment_typo_highlighting = none
resharper_identifier_typo_highlighting = none
resharper_string_literal_typo_highlighting = none

#### 10. Naming — mirrors the Rider naming rules; Roslyn applies the first matching rule, so specific ones come first
dotnet_naming_style.pascal_case_style.capitalization = pascal_case
dotnet_naming_style.camel_case_style.capitalization = camel_case
dotnet_naming_style.interface_style.capitalization = pascal_case
dotnet_naming_style.interface_style.required_prefix = I
dotnet_naming_style.type_parameter_style.capitalization = pascal_case
dotnet_naming_style.type_parameter_style.required_prefix = T

dotnet_naming_symbols.private_const_fields_symbols.applicable_kinds = field
dotnet_naming_symbols.private_const_fields_symbols.applicable_accessibilities = private, private_protected
dotnet_naming_symbols.private_const_fields_symbols.required_modifiers = const
dotnet_naming_symbols.private_static_readonly_fields_symbols.applicable_kinds = field
dotnet_naming_symbols.private_static_readonly_fields_symbols.applicable_accessibilities = private, private_protected
dotnet_naming_symbols.private_static_readonly_fields_symbols.required_modifiers = static, readonly
dotnet_naming_symbols.private_fields_symbols.applicable_kinds = field
dotnet_naming_symbols.private_fields_symbols.applicable_accessibilities = private, private_protected
dotnet_naming_symbols.non_private_fields_symbols.applicable_kinds = field
dotnet_naming_symbols.non_private_fields_symbols.applicable_accessibilities = public, internal, protected, protected_internal
dotnet_naming_symbols.interfaces_symbols.applicable_kinds = interface
dotnet_naming_symbols.interfaces_symbols.applicable_accessibilities = *
dotnet_naming_symbols.type_parameters_symbols.applicable_kinds = type_parameter
dotnet_naming_symbols.type_parameters_symbols.applicable_accessibilities = *
dotnet_naming_symbols.types_and_members_symbols.applicable_kinds = namespace, class, struct, enum, delegate, method, property, event, local_function
dotnet_naming_symbols.types_and_members_symbols.applicable_accessibilities = *
dotnet_naming_symbols.parameters_and_locals_symbols.applicable_kinds = parameter, local
dotnet_naming_symbols.parameters_and_locals_symbols.applicable_accessibilities = *

dotnet_naming_rule.private_const_fields_are_pascal_case.symbols = private_const_fields_symbols
dotnet_naming_rule.private_const_fields_are_pascal_case.style = pascal_case_style
dotnet_naming_rule.private_const_fields_are_pascal_case.severity = suggestion
dotnet_naming_rule.private_static_readonly_fields_are_pascal_case.symbols = private_static_readonly_fields_symbols
dotnet_naming_rule.private_static_readonly_fields_are_pascal_case.style = pascal_case_style
dotnet_naming_rule.private_static_readonly_fields_are_pascal_case.severity = suggestion
dotnet_naming_rule.private_fields_are_camel_case.symbols = private_fields_symbols
dotnet_naming_rule.private_fields_are_camel_case.style = camel_case_style
dotnet_naming_rule.private_fields_are_camel_case.severity = suggestion
dotnet_naming_rule.non_private_fields_are_pascal_case.symbols = non_private_fields_symbols
dotnet_naming_rule.non_private_fields_are_pascal_case.style = pascal_case_style
dotnet_naming_rule.non_private_fields_are_pascal_case.severity = suggestion
dotnet_naming_rule.interfaces_are_prefixed.symbols = interfaces_symbols
dotnet_naming_rule.interfaces_are_prefixed.style = interface_style
dotnet_naming_rule.interfaces_are_prefixed.severity = suggestion
dotnet_naming_rule.type_parameters_are_prefixed.symbols = type_parameters_symbols
dotnet_naming_rule.type_parameters_are_prefixed.style = type_parameter_style
dotnet_naming_rule.type_parameters_are_prefixed.severity = suggestion
dotnet_naming_rule.types_and_members_are_pascal_case.symbols = types_and_members_symbols
dotnet_naming_rule.types_and_members_are_pascal_case.style = pascal_case_style
dotnet_naming_rule.types_and_members_are_pascal_case.severity = suggestion
dotnet_naming_rule.parameters_and_locals_are_camel_case.symbols = parameters_and_locals_symbols
dotnet_naming_rule.parameters_and_locals_are_camel_case.style = camel_case_style
dotnet_naming_rule.parameters_and_locals_are_camel_case.severity = suggestion

#### 11. Analyzers
# Disable S3776: Cognitive Complexity Warning
dotnet_diagnostic.S3776.severity = none

Expand All @@ -8,4 +205,4 @@ dotnet_diagnostic.CS1570.severity = none
dotnet_diagnostic.CS1584.severity = none
dotnet_diagnostic.CS1658.severity = none
# Disable CA1815: generated value types carry data only; equality semantics are not part of their contract
dotnet_diagnostic.CA1815.severity = none
dotnet_diagnostic.CA1815.severity = none
24 changes: 17 additions & 7 deletions DEVELOPMENT_STANDARDS.md
Original file line number Diff line number Diff line change
Expand Up @@ -141,19 +141,29 @@ Each repository should reference this file from its own `CLAUDE.md` /

### 1.7 `var` for local variables

- Use `var` for local variable declarations when the type is unambiguous from
the right-hand side (constructor call, cast, or literal initialiser).
- Use `var` for every local variable declaration where the compiler accepts
it — including built-in types, `foreach` iteration variables and `out var`
declarations.

```csharp
var person = new Person("Alice", 30);
var names = new List<string>();
var count = 0;
var typed = (IFoo)source;

foreach (var element in elements)
{
if (cache.TryGetValue(element.Id, out var cached))
{
}
}
```

- Spell out the type explicitly when `var` would hide it — e.g. return
values from opaque method calls, LINQ chains where the element type is
not obvious to the reader, or local variables whose declared type matters
for overload resolution downstream.
- Spell out the type only where `var` cannot express the declaration: no
initialiser, a `const`, a `null` / lambda / method-group /
collection-expression initialiser, or a declared type that must be wider
than the constructed one (`IFoo foo = new Foo();`).
- Enforced by `.editorconfig` (`csharp_style_var_*`) — see §0.

### 1.8 Member ordering

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public partial class DataVersion : IResponse, SysML2.NET.Common.IIdentified
/// <summary>
/// Gets or sets the payload of the DataVersion
/// </summary>
public IData Payload { get; set; }
public SysML2.NET.Common.IData Payload { get; set; }
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ namespace SysML2.NET.PSM.DTO
/// Data transfer object that represents the ExternalData schema of the Systems Modeling API and Services
/// </summary>
[GeneratedCode("SysML2.NET", "latest")]
public partial class ExternalData : IData, IResponse, SysML2.NET.Common.IIdentified
public partial class ExternalData : IResponse, SysML2.NET.Common.IData, SysML2.NET.Common.IIdentified
{
/// <summary>
/// The value of the type discriminator of the ExternalData schema
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
// -------------------------------------------------------------------------------------------------
// <copyright file="BranchSerializer.cs" company="Starion Group S.A.">
//
// Copyright (C) 2022-2026 Starion Group S.A.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// </copyright>
// ------------------------------------------------------------------------------------------------

// ------------------------------------------------------------------------------------------------
// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!--------
// ------------------------------------------------------------------------------------------------

namespace SysML2.NET.Serializer.Json.PSM
{
using System;
using System.Text.Json;

using SysML2.NET.PSM.DTO;
using SysML2.NET.PSM.Enumerations;
using SysML2.NET.Serializer.Json;

/// <summary>
/// The purpose of the <see cref="BranchSerializer"/> is to provide serialization capabilities
/// for the <see cref="Branch"/> class
/// </summary>
internal static class BranchSerializer
{
/// <summary>
/// Serializes an instance of <see cref="Branch"/> using an <see cref="Utf8JsonWriter"/>
/// </summary>
/// <param name="obj">
/// The <see cref="Branch"/> to serialize
/// </param>
/// <param name="writer">
/// The target <see cref="Utf8JsonWriter"/>
/// </param>
/// <param name="serializationModeKind">
/// enumeration specifying what kind of serialization shall be used
/// </param>
/// <param name="includeDerivedProperties">
/// Asserts that derived properties should also be part of the serialization
/// </param>
/// <exception cref="ArgumentException">
/// Thrown when the object is not a <see cref="Branch"/>
/// </exception>
/// <exception cref="NotSupportedException">
/// Thrown when the serialization mode is not supported
/// </exception>
internal static void Serialize(object obj, Utf8JsonWriter writer, SerializationModeKind serializationModeKind, bool includeDerivedProperties)
{
if (obj is not Branch branch)
{
throw new ArgumentException("The object shall be a Branch", nameof(obj));
}

if (serializationModeKind != SerializationModeKind.JSON)
{
throw new NotSupportedException($"The {serializationModeKind} serialization mode is not supported");
}

writer.WriteStartObject();

writer.WriteString("@type"u8, "Branch");

writer.WriteString("@id"u8, branch.Id);

writer.WriteStartArray("alias"u8);

if (branch.Alias != null)
{
foreach (var item in branch.Alias)
{
writer.WriteStringValue(item);
}
}

writer.WriteEndArray();

writer.WriteString("created"u8, branch.Created);

if (branch.Deleted.HasValue)
{
writer.WriteString("deleted"u8, branch.Deleted.Value);
}
else
{
writer.WriteNull("deleted"u8);
}

writer.WriteString("description"u8, branch.Description);

if (branch.Head.HasValue)
{
writer.WriteStartObject("head"u8);
writer.WriteString("@id"u8, branch.Head.Value);
writer.WriteEndObject();
}
else
{
writer.WriteNull("head"u8);
}

writer.WriteString("name"u8, branch.Name);

writer.WriteStartObject("owningProject"u8);
writer.WriteString("@id"u8, branch.OwningProject);
writer.WriteEndObject();

writer.WriteStartObject("referencedCommit"u8);
writer.WriteString("@id"u8, branch.ReferencedCommit);
writer.WriteEndObject();

writer.WriteEndObject();
}
}
}

// ------------------------------------------------------------------------------------------------
// --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!--------
// ------------------------------------------------------------------------------------------------
Loading
Loading