refactor: align Refit with rxui coding standards and modernize - #2149
Merged
Conversation
Bring the repository in line with the documentation, styling, and structural standards used across the other rxui projects, plus supporting modernization. - docs/style: enforce StyleSharp/Roslynator/Sonar analyzers as a gate (no NoWarn); add XML documentation throughout, single top-level type per file, consistent layout and naming. - structure: move tests to src/tests and benchmarks to src/benchmarks; replace AssemblyInfo with csproj-based metadata; move shared internal helpers to src/Shared (linked source) and drop InternalsVisibleTo from production assemblies; remove the per-project refit.props/refit.targets imports. - test: migrate the suite to TUnit native async assertions (delete the xUnit shim and file-based GlobalUsings); make Refit.Tests/Refit.GeneratorTests AOT/trim compatible, annotating reflection sites and adding an AOT-safe collection assert. - fix(serializer): restore the reflection fallback in SystemTextJsonContentSerializer (GetTypeInfo threw for resolver-less options) and rework CamelCaseStringEnumConverter into strongly-typed converters so .NET 11 dictionary-key enum serialization works, preserving lenient empty-string->null for nullable enums.
- Add sonarcloud.yml and codeql.yml calling the shared reactiveui/actions-common reusable workflows (project key reactiveui_refit; randomised CodeQL cron). - Drop the deprecated productNamespacePrefix input from ci-build.yml (coverage filtering is driven by testconfig.json under MTP) and normalise srcFolder/version floor. - Consolidate all workflow files under the Solution Items/workflows folder in Refit.slnx and remove the duplicated/backslash entries.
The repo versions via MinVer/git tags; version.json no longer exists.
|
You are seeing this message because GitHub Code Scanning has recently been set up for this repository, or this pull request contains the workflow file for the Code Scanning tool. What Enabling Code Scanning Means:
For more information about GitHub Code Scanning, check out the documentation. |
Delete the checked-in Benchmarks/{netcoreapp3.1,net5.0,net6.0}/*.bat
launchers. They target EOL frameworks and are superseded by
BenchmarkSwitcher + --filter (already wired in Program.cs). The
benchmark classes themselves already follow modern BenchmarkDotNet
conventions ([MemoryDiagnoser], [ShortRunJob], [EventPipeProfiler]).
GetEmbeddedResourceStream in RestServiceIntegrationTests and MultipartTests used if (x is null) throw blocks; collapse them into null-coalescing throw expressions to satisfy IDE0270 under the SonarCloud build's code-style enforcement.
- S6444: pass a 1s match timeout to the legacy (pre-net7) parameter Regex to bound execution time (ReDoS hardening). - S5332: the placeholder BaseUri used only for relative-path combining now uses https; its scheme/host are discarded before the request is sent. - S5766: drop the dead [Serializable] marker from the ApiException family. These types have no serialization constructor and hold non-serializable members (HttpRequestMessage, response headers, RefitSettings), so BinaryFormatter already throws on them; the attribute was non-functional and BinaryFormatter is obsolete in modern .NET. Hotspots cannot be cleared by in-code suppression, so each is resolved by removing the triggering pattern.
Drop the PublicApiGenerator + Verify snapshot approval test (Refit core
only, net8-11) in favour of Microsoft.CodeAnalysis.PublicApiAnalyzers,
matching the other rxui repos.
- Track the public surface of every shipped library (Refit,
Refit.HttpClientFactory, Refit.Newtonsoft.Json, Refit.Xml) across all
10 TFMs via per-TFM PublicAPI/<tfm>/PublicAPI.{Shipped,Unshipped}.txt
baselines; the analyzer (RS0016/RS0017/RS0037) now fails the build on any
unbaselined public API change.
- Gate tracking in Directory.Build.props: tests, benchmarks, examples, the
InterfaceStubGenerator projects, and the AOT smoke app opt out.
- Add tools/generate-publicapi.{sh,ps1} + README to regenerate baselines.
Refit ships only cross-platform libraries, so every TFM builds on any OS.
- Remove the now-unused PublicApiGenerator package.
The MTP code-coverage config used a non-standard `extensions[].settings`
shape with an unanchored module filter ("Refit(\..+)?"), which matched
nothing against the full module paths on the Windows CI runner — every
*.cobertura.xml came back with empty <packages>, so SonarCloud showed 0%.
- Rewrite src/testconfig.json to the rxui-standard `codeCoverage.Configuration`
schema. Anchor the module include to the assembly filename
(".*[\\/]Refit(\..+)?\.dll$") so it matches the shipped Refit libraries on
any OS while excluding third-party dependencies sitting in the same bin dir
(verified locally: only Refit, Refit.Newtonsoft.Json, Refit.Xml are scored).
- Exclude generated sources (*.g.cs) and the usual coverage-exempt attributes.
- Add a repo-root codecov.yml matching the other rxui repos.
- Track codecov.yml and testconfig.json under Solution Items.
ChrisPulman
approved these changes
Jun 19, 2026
|
|
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


What kind of change does this PR introduce?
Refactor / modernization. Brings Refit in line with the documentation, styling, and structural standards used across the other rxui projects, with supporting modernization and a couple of serializer fixes surfaced along the way.
What is the new behavior?
NoWarn); XML documentation added throughout; one top-level type per file; consistent layout and naming.src/tests, benchmarks insrc/benchmarks;AssemblyInforeplaced with csproj-based metadata; shared internal helpers moved tosrc/Shared(linked source) so production assemblies no longer exposeInternalsVisibleTo; per-projectrefit.props/refit.targetsimports removed.GlobalUsingsare gone).Refit.TestsandRefit.GeneratorTestsare now AOT/trim-compatible (IsAotCompatible), with reflection sites annotated and an AOT-safe collection-equality assertion helper.SystemTextJsonContentSerializerrestores its reflection fallback (it had begun callingGetTypeInfo()unconditionally, which throws for resolver-less options even with reflection enabled).CamelCaseStringEnumConverteris reworked into strongly-typed converters so .NET 11 dictionary-key enum serialization works, while preserving lenient empty-string→null handling for nullable enums.All tests pass on net8/9/10/11 for both test projects; the full solution builds clean with the analyzers on.
What is the current behavior?
The pre-PR
mainlacked the rxui-standard analyzer/documentation enforcement and structure, used an xUnit-style assertion shim, was not AOT/trim-clean in the test projects, and shipped aSystemTextJsonContentSerializerthat threwNotSupportedExceptionfor the default (reflection) serializer path and could not serialize enum dictionary keys on .NET 11.What might this PR break?
InternalsVisibleTo(helpers are now per-assembly linked source). The generated public-API surface changed accordingly (snapshots updated).Checklist
mainbranchAdditional information