Skip to content
This repository was archived by the owner on Nov 10, 2026. It is now read-only.

refactor: execute code cleanup - #219

Merged
vbreuss merged 1 commit into
mainfrom
topic/refactor-code
May 30, 2026
Merged

vbreuss merged 1 commit into
mainfrom
topic/refactor-code

Conversation

@vbreuss

@vbreuss vbreuss commented May 30, 2026 •

Copy link
Copy Markdown
Member

Summary

Runs ReSharper code cleanup across the solution, then fixes the compilation and test regressions the cleanup introduced in multi-targeted code. The cleanup itself is the intent of this PR; the remaining changes restore correctness where automated cleanup was too aggressive for a library that multi-targets netstandard2.0, net8.0, and net10.0.

Code cleanup

  • Applied ReSharper code cleanup (formatting, member reordering, redundancy removal) across Source and Tests.

Compilation fixes

The cleanup analyzed the code against a single target framework (netstandard2.0), where the #if NET8_0_OR_GREATER async paths are inactive. That caused two categories of breakage on net8.0/net10.0:

  • Restored guarded using directives (35 files). using System.Threading; / using System.Threading.Tasks; were removed as "unused" because the async
    overloads that consume Task<>/CancellationToken are compiled out under netstandard2.0. They are now wrapped in #if NET8_0_OR_GREATER … #endif, so
    they exist only in the compilation context that uses them.
  • Restored explicit generic type arguments on AddConstraint<…> (89 call sites). The cleanup stripped AddConstraint<IEnumerable<…>>(…) to AddConstraint(…). Under net8.0+ both the sync (IValueConstraint<T>) and async (IAsyncConstraint<T>) overloads exist, so without the explicit argument the calls became ambiguous (CS0121) or non-inferable (CS0411).

Test fixes

  • ShouldChainSealedBeforeMethods — the cleanup removed the sealed keyword from the sealed override members of the SealedMemberClass test fixture (redundant for the compiler, since the class is already sealed). But sealed override emits the IL final flag while a plain override does not, so IsReallySealed() ({ IsVirtual: true, IsFinal: true }) matched nothing and the filter returned empty. Restored sealed override.

Analyzer suppressions

  • CA2263 ("Prefer generic overload when type is known") — added file-scoped suppressions to the Return/ReturnExactly/ReturnsExactly test files. These tests intentionally exercise the non-generic Type overloads of the public API (mirroring the existing convention already used in the …OfType test files); converting them to the generic form would drop coverage of those overloads.

Tooling

  • aweXpect.Reflection.sln.DotSettings — set the "Redundant type arguments of a method" inspection (RedundantTypeArgumentsOfMethod) to DO_NOT_SHOW, so future code cleanups no longer strip the AddConstraint<…> type arguments that are required under net8.0+.

@vbreuss vbreuss self-assigned this May 30, 2026
@vbreuss
vbreuss enabled auto-merge (squash) May 30, 2026 17:08
@github-actions

github-actions Bot commented May 30, 2026 •

Copy link
Copy Markdown

Test Results

    13 files  ±0      13 suites  ±0   2m 59s ⏱️ -34s
 3 279 tests ±0   3 276 ✅ ±0   3 💤 ±0  0 ❌ ±0 
19 654 runs  ±0  19 641 ✅ ±0  13 💤 ±0  0 ❌ ±0 

Results for commit 21ca489. ± Comparison against base commit f2c40dc.

♻️ This comment has been updated with latest results.

@vbreuss
vbreuss force-pushed the topic/refactor-code branch from 22d89df to 21ca489 Compare May 30, 2026 17:18
@github-actions

github-actions Bot commented May 30, 2026 •

Copy link
Copy Markdown

🚀 Benchmark Results

Details

BenchmarkDotNet v0.15.8, Linux Ubuntu 24.04.4 LTS (Noble Numbat)
AMD EPYC 7763 2.94GHz, 1 CPU, 4 logical and 2 physical cores
.NET SDK 10.0.300
[Host] : .NET 10.0.8 (10.0.8, 10.0.826.23019), X64 RyuJIT x86-64-v3
DefaultJob : .NET 10.0.8 (10.0.8, 10.0.826.23019), X64 RyuJIT x86-64-v3

Method Mean Error StdDev Gen0 Allocated
TypeIsNotStatic_aweXpect 224.9 ns 4.36 ns 5.19 ns 0.0386 648 B

@github-actions

github-actions Bot commented May 30, 2026 •

Copy link
Copy Markdown

👽 Mutation Results

Mutation testing badge

aweXpect.Reflection

Details
File Score Killed Survived Timeout No Coverage Ignored Compile Errors Total Detected Total Undetected Total Mutants
Collections/AssembliesTypeBuilder.cs 94.44% 51 3 0 0 9 12 51 3 75
Collections/Filtered.Assemblies.cs 88.89% 16 2 0 0 11 0 16 2 29
Collections/Filtered.cs 100.00% 6 0 0 0 4 0 6 0 10
Collections/Filtered.Types.cs 95.83% 22 1 1 0 12 6 23 1 42
Collections/TypesMemberBuilder.cs 95.24% 20 1 0 0 5 0 20 1 26
Filters/ConstructorFilters.WithParameter.cs 83.33% 30 0 0 6 21 1 30 6 58
Filters/MethodFilters.WithParameter.cs 83.33% 30 0 0 6 21 1 30 6 58
Formatting/FieldFormatter.cs 100.00% 7 0 0 0 2 4 7 0 13
Formatting/FormatterRegistration.cs 85.71% 6 1 0 0 4 0 6 1 11
Formatting/PropertyFormatter.cs 100.00% 24 0 0 0 6 11 24 0 41
Helpers/CollectionConstraintResult.cs 85.71% 24 2 0 2 15 3 24 4 46
Helpers/MemberInfoHelpers.cs 100.00% 13 0 0 0 1 1 13 0 15
Helpers/MethodInfoHelpers.cs 96.88% 30 0 1 1 12 2 31 1 46
Helpers/TypeHelpers.cs 98.22% 166 1 0 2 51 12 166 3 232
Options/AttributeFilterOptions.cs 100.00% 36 0 0 0 13 8 36 0 57
Options/GenericArgumentFilterOptions.cs 70.00% 7 0 0 3 6 2 7 3 18
Options/GenericArgumentsFilterOptions.cs 90.91% 30 2 0 1 13 7 30 3 53
Options/ParameterFilterOptions.cs 90.00% 9 0 0 1 6 2 9 1 18
Options/TypeFilterOptions.cs 100.00% 34 0 0 0 9 6 34 0 49
ThatAssemblies.Have.cs 75.00% 15 1 0 4 8 6 15 5 34
ThatAssemblies.HaveADependencyOn.cs 78.57% 10 0 1 3 2 8 11 3 24
ThatAssemblies.HaveNoDependencyOn.cs 75.00% 11 0 1 4 2 8 12 4 26
ThatAssembly.HasName.cs 100.00% 4 0 0 0 1 3 4 0 8
ThatConstructors.Have.cs 80.00% 16 0 0 4 8 6 16 4 34
ThatConstructors.HaveParameter.cs 59.26% 32 4 0 18 20 16 32 22 90
ThatConstructors.HaveParameterCount.cs 69.23% 9 2 0 2 2 10 9 4 25
ThatEvents.AreAbstract.cs 94.44% 17 0 0 1 4 12 17 1 34
ThatEvents.AreSealed.cs 94.44% 17 0 0 1 4 12 17 1 34
ThatEvents.Have.cs 80.00% 16 0 0 4 8 6 16 4 34
ThatFields.AreOfType.cs 80.00% 16 1 0 3 7 6 16 4 33
ThatFields.AreStatic.cs 83.33% 20 0 0 4 4 12 20 4 40
ThatFields.Have.cs 80.00% 16 0 0 4 8 6 16 4 34
ThatMember.HasName.cs 100.00% 4 0 0 0 1 3 4 0 8
ThatMembers.AreInternal.cs 92.86% 13 0 0 1 2 10 13 1 26
ThatMembers.ArePrivate.cs 92.86% 13 0 0 1 2 10 13 1 26
ThatMembers.ArePrivateProtected.cs 92.86% 13 0 0 1 2 10 13 1 26
ThatMembers.AreProtected.cs 92.86% 13 0 0 1 2 10 13 1 26
ThatMembers.AreProtectedInternal.cs 92.86% 13 0 0 1 2 10 13 1 26
ThatMembers.ArePublic.cs 92.86% 13 0 0 1 2 10 13 1 26
ThatMembers.HaveName.cs 82.14% 23 2 0 3 6 26 23 5 60
ThatMethod.HasExactParameter.cs 50.00% 4 1 0 3 2 0 4 4 10
ThatMethods.AreAbstract.cs 83.33% 20 0 0 4 4 12 20 4 40
ThatMethods.AreGeneric.cs 87.50% 21 0 0 3 5 13 21 3 42
ThatMethods.AreSealed.cs 94.44% 17 0 0 1 4 12 17 1 34
ThatMethods.AreStatic.cs 83.33% 20 0 0 4 4 12 20 4 40
ThatMethods.Have.cs 80.00% 16 0 0 4 8 6 16 4 34
ThatMethods.HaveParameterCount.cs 69.23% 9 2 0 2 2 10 9 4 25
ThatMethods.Return.cs 85.00% 17 0 0 3 7 6 17 3 33
ThatMethods.ReturnExactly.cs 62.50% 5 0 0 3 3 0 5 3 11
ThatProperties.AreAbstract.cs 94.44% 17 0 0 1 4 12 17 1 34
ThatProperties.AreOfType.cs 80.00% 16 1 0 3 7 6 16 4 33
ThatProperties.AreSealed.cs 94.44% 17 0 0 1 4 12 17 1 34
ThatProperties.AreStatic.cs 94.44% 17 0 0 1 4 12 17 1 34
ThatProperties.Have.cs 80.00% 16 0 0 4 8 6 16 4 34
ThatProperty.IsStatic.cs 100.00% 12 0 0 0 3 6 12 0 21
ThatType.HasNamespace.cs 100.00% 5 0 0 0 1 5 5 0 11
ThatTypes.AreAbstract.cs 94.44% 17 0 0 1 4 12 17 1 34
ThatTypes.AreClasses.cs 94.44% 17 0 0 1 4 12 17 1 34
ThatTypes.AreEnums.cs 83.33% 20 0 0 4 4 12 20 4 40
ThatTypes.AreInterfaces.cs 83.33% 20 0 0 4 4 12 20 4 40
ThatTypes.AreNested.cs 83.33% 20 0 0 4 4 12 20 4 40
ThatTypes.AreRecords.cs 94.44% 17 0 0 1 4 12 17 1 34
ThatTypes.AreRecordStructs.cs 94.44% 17 0 0 1 4 12 17 1 34
ThatTypes.AreSealed.cs 94.44% 17 0 0 1 4 12 17 1 34
ThatTypes.AreStatic.cs 94.44% 17 0 0 1 4 12 17 1 34
ThatTypes.AreStructs.cs 94.44% 17 0 0 1 4 12 17 1 34
ThatTypes.Have.cs 100.00% 20 0 0 0 8 6 20 0 34
ThatTypes.InheritFrom.cs 90.32% 56 4 0 2 12 20 56 6 94

The final mutation score is 88.72%

Coverage Thresholds: high:80 low:60 break:0

@sonarqubecloud

Copy link
Copy Markdown

@vbreuss
vbreuss disabled auto-merge May 30, 2026 17:22
@vbreuss
vbreuss merged commit 956fef0 into main May 30, 2026
11 checks passed
@vbreuss
vbreuss deleted the topic/refactor-code branch May 30, 2026 17:25
@github-actions

Copy link
Copy Markdown

This is addressed in release v1.4.0.

@github-actions github-actions Bot added the state: released The issue is released label May 30, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

state: released The issue is released

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant