Skip to content
Merged
13 changes: 13 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,10 @@ dotnet_naming_rule.private_static_readonly_fields_should_be_pascalcase.severity
dotnet_naming_rule.private_static_readonly_fields_should_be_pascalcase.symbols = private_static_readonly_fields
dotnet_naming_rule.private_static_readonly_fields_should_be_pascalcase.style = pascalcase

dotnet_naming_rule.private_fields_should_be_camelcase.severity = suggestion
dotnet_naming_rule.private_fields_should_be_camelcase.symbols = private_fields
dotnet_naming_rule.private_fields_should_be_camelcase.style = camelcase_no_prefix

dotnet_naming_rule.enums_should_be_pascalcase.severity = suggestion
dotnet_naming_rule.enums_should_be_pascalcase.symbols = enums
dotnet_naming_rule.enums_should_be_pascalcase.style = pascalcase
Expand Down Expand Up @@ -302,6 +306,10 @@ dotnet_naming_symbols.private_constant_fields.applicable_kinds = field
dotnet_naming_symbols.private_constant_fields.applicable_accessibilities = private, protected, protected_internal, private_protected
dotnet_naming_symbols.private_constant_fields.required_modifiers = const

dotnet_naming_symbols.private_fields.applicable_kinds = field
dotnet_naming_symbols.private_fields.applicable_accessibilities = private, protected, protected_internal, private_protected
dotnet_naming_symbols.private_fields.required_modifiers =

Comment thread
coderabbitai[bot] marked this conversation as resolved.
Outdated
dotnet_naming_symbols.local_variables.applicable_kinds = local
dotnet_naming_symbols.local_variables.applicable_accessibilities = local
dotnet_naming_symbols.local_variables.required_modifiers =
Expand Down Expand Up @@ -352,6 +360,11 @@ dotnet_naming_style._camelcase.required_suffix =
dotnet_naming_style._camelcase.word_separator =
dotnet_naming_style._camelcase.capitalization = camel_case

dotnet_naming_style.camelcase_no_prefix.required_prefix =
dotnet_naming_style.camelcase_no_prefix.required_suffix =
dotnet_naming_style.camelcase_no_prefix.word_separator =
dotnet_naming_style.camelcase_no_prefix.capitalization = camel_case

dotnet_naming_style.camelcase.required_prefix =
dotnet_naming_style.camelcase.required_suffix =
dotnet_naming_style.camelcase.word_separator =
Expand Down
1 change: 1 addition & 0 deletions docs/AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ Run these first if source generator tests fail with missing generated types.
- 4-space indentation; `crlf` line endings for C# files per `.editorconfig`.
- `var` is discouraged (`csharp_style_var_* = false:silent`).
- `TreatWarningsAsErrors` is enabled on most production projects.
- **Private fields must NOT be prefixed with `_`** — use camelCase without underscore prefix (e.g., `openApiPath` not `_openApiPath`).

## Key Conventions

Expand Down
100 changes: 0 additions & 100 deletions docs/prd/prd-04-deepen-interface-generator.md

This file was deleted.

56 changes: 28 additions & 28 deletions src/Refitter.Core/ApizrOptionsBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,69 +5,69 @@ namespace Refitter.Core;

internal class ApizrOptionsBuilder : IApizrOptionsBuilder
{
private readonly StringBuilder _optionsCode;
private readonly StringBuilder _usingsCode;
private readonly HashSet<ApizrPackages> _packages = new();
private bool _hasOptions;
private readonly StringBuilder optionsCode;
private readonly StringBuilder usingsCode;
private readonly HashSet<ApizrPackages> packages = new();
private bool hasOptions;

public ApizrOptionsBuilder(string initialOptionsCode, string initialUsings)
{
_optionsCode = new StringBuilder(initialOptionsCode);
_usingsCode = new StringBuilder(initialUsings);
_usingsCode.AppendLine();
optionsCode = new StringBuilder(initialOptionsCode);
usingsCode = new StringBuilder(initialUsings);
usingsCode.AppendLine();
}

public bool HasOptions => _hasOptions;
public bool HasOptions => hasOptions;

public void WithBaseAddress(string baseUrl, string duplicateStrategy)
{
_optionsCode.AppendLine();
_optionsCode.Append($" .WithBaseAddress(\"{baseUrl}\", {duplicateStrategy})");
_hasOptions = true;
optionsCode.AppendLine();
optionsCode.Append($" .WithBaseAddress(\"{baseUrl}\", {duplicateStrategy})");
hasOptions = true;
}

public void WithDelegatingHandler(string handlerType)
{
_optionsCode.AppendLine();
_optionsCode.Append($" .WithDelegatingHandler<{handlerType}>()");
_hasOptions = true;
optionsCode.AppendLine();
optionsCode.Append($" .WithDelegatingHandler<{handlerType}>()");
hasOptions = true;
}

public void ConfigureHttpClientBuilder(Action<StringBuilder> configure)
{
_optionsCode.AppendLine();
configure(_optionsCode);
_hasOptions = true;
optionsCode.AppendLine();
configure(optionsCode);
hasOptions = true;
}

public void AppendOptionsCode(string code)
{
_optionsCode.Append(code);
_hasOptions = true;
optionsCode.Append(code);
hasOptions = true;
}

public void AddPackage(ApizrPackages package)
{
_packages.Add(package);
packages.Add(package);
}

public void AddUsing(string usingDirective)
{
_usingsCode.Append(" ");
_usingsCode.AppendLine(usingDirective);
usingsCode.Append(" ");
usingsCode.AppendLine(usingDirective);
}

public string BuildOptionsCode()
{
if (_hasOptions)
_optionsCode.Append(";");
if (hasOptions)
optionsCode.Append(";");
else
_optionsCode.Clear();
optionsCode.Clear();

return _optionsCode.ToString();
return optionsCode.ToString();
}

public string GetUsings() => _usingsCode.ToString();
public string GetUsings() => usingsCode.ToString();

public List<ApizrPackages> GetPackages() => _packages.ToList();
public List<ApizrPackages> GetPackages() => packages.ToList();
}
6 changes: 3 additions & 3 deletions src/Refitter.Core/DocumentMerger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@

internal sealed class DocumentMerger : IDocumentMerger
{
private readonly DocumentEquivalenceComparer _comparer;
private readonly DocumentEquivalenceComparer comparer;

Check failure on line 10 in src/Refitter.Core/DocumentMerger.cs

View workflow job for this annotation

GitHub Actions / 👌 Verify build

Field 'DocumentMerger.comparer' is never assigned to, and will always have its default value null

Check warning on line 10 in src/Refitter.Core/DocumentMerger.cs

View workflow job for this annotation

GitHub Actions / 👌 Verify build

Field 'DocumentMerger.comparer' is never assigned to, and will always have its default value null

Check warning on line 10 in src/Refitter.Core/DocumentMerger.cs

View workflow job for this annotation

GitHub Actions / 👌 Verify build

Field 'DocumentMerger.comparer' is never assigned to, and will always have its default value null

Check failure on line 10 in src/Refitter.Core/DocumentMerger.cs

View workflow job for this annotation

GitHub Actions / 👌 Verify build

Field 'DocumentMerger.comparer' is never assigned to, and will always have its default value null

Check failure on line 10 in src/Refitter.Core/DocumentMerger.cs

View workflow job for this annotation

GitHub Actions / 👌 Verify build

Field 'DocumentMerger.comparer' is never assigned to, and will always have its default value null

Check failure on line 10 in src/Refitter.Core/DocumentMerger.cs

View workflow job for this annotation

GitHub Actions / script

Field 'DocumentMerger.comparer' is never assigned to, and will always have its default value null

Check failure on line 10 in src/Refitter.Core/DocumentMerger.cs

View workflow job for this annotation

GitHub Actions / 👌 Verify build

Field 'DocumentMerger.comparer' is never assigned to, and will always have its default value null

Check warning on line 10 in src/Refitter.Core/DocumentMerger.cs

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Remove unassigned field 'comparer', or set its value.

See more on https://sonarcloud.io/project/issues?id=christianhelle_refitter&issues=AZ7KvWNeMr7d56jNwqGa&open=AZ7KvWNeMr7d56jNwqGa&pullRequest=1149

/// <summary>
/// Initializes a new instance of the DocumentMerger class.
/// </summary>
/// <param name="comparer">The comparer used to detect equivalent document elements during merging.</param>
public DocumentMerger(DocumentEquivalenceComparer comparer)
{
_comparer = comparer;
comparer = comparer;

Check failure on line 18 in src/Refitter.Core/DocumentMerger.cs

View workflow job for this annotation

GitHub Actions / 👌 Verify build

Assignment made to same variable; did you mean to assign something else?

Check warning on line 18 in src/Refitter.Core/DocumentMerger.cs

View workflow job for this annotation

GitHub Actions / 👌 Verify build

Assignment made to same variable; did you mean to assign something else?

Check warning on line 18 in src/Refitter.Core/DocumentMerger.cs

View workflow job for this annotation

GitHub Actions / 👌 Verify build

Assignment made to same variable; did you mean to assign something else?

Check failure on line 18 in src/Refitter.Core/DocumentMerger.cs

View workflow job for this annotation

GitHub Actions / 👌 Verify build

Assignment made to same variable; did you mean to assign something else?

Check failure on line 18 in src/Refitter.Core/DocumentMerger.cs

View workflow job for this annotation

GitHub Actions / 👌 Verify build

Assignment made to same variable; did you mean to assign something else?

Check failure on line 18 in src/Refitter.Core/DocumentMerger.cs

View workflow job for this annotation

GitHub Actions / script

Assignment made to same variable; did you mean to assign something else?

Check failure on line 18 in src/Refitter.Core/DocumentMerger.cs

View workflow job for this annotation

GitHub Actions / 👌 Verify build

Assignment made to same variable; did you mean to assign something else?

Check warning on line 18 in src/Refitter.Core/DocumentMerger.cs

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Remove this useless assignment to local variable 'comparer'.

See more on https://sonarcloud.io/project/issues?id=christianhelle_refitter&issues=AZ7KvWNeMr7d56jNwqGb&open=AZ7KvWNeMr7d56jNwqGb&pullRequest=1149

Check warning on line 18 in src/Refitter.Core/DocumentMerger.cs

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Remove or correct this useless self-assignment.

See more on https://sonarcloud.io/project/issues?id=christianhelle_refitter&issues=AZ7KvWNeMr7d56jNwqGc&open=AZ7KvWNeMr7d56jNwqGc&pullRequest=1149
}
Comment thread
coderabbitai[bot] marked this conversation as resolved.

/// <summary>
Expand Down Expand Up @@ -94,7 +94,7 @@
return;
}

if (!_comparer.AreEquivalent(existingValue, value))
if (!comparer.AreEquivalent(existingValue, value))
throw CreateMergeConflictException(itemType, key);
}

Expand Down
Loading
Loading