Skip to content

feat: add HasDependenciesOutside family to find types with dependencies outside an allowed set#333

Merged
vbreuss merged 2 commits into
mainfrom
feature/has-dependencies-outside
Jun 6, 2026
Merged

feat: add HasDependenciesOutside family to find types with dependencies outside an allowed set#333
vbreuss merged 2 commits into
mainfrom
feature/has-dependencies-outside

Conversation

@vbreuss

@vbreuss vbreuss commented Jun 6, 2026

Copy link
Copy Markdown
Member

Implements the positive counterpart of the DependOnlyOn family:

  • ThatType.HasDependenciesOutside(...) (namespaces and Filtered.Types targets)
  • ThatTypes.HaveDependenciesOutside(...) (sync and async enumerables)
  • TypeFilters.WhichHaveDependenciesOutside(...)

The allowed set follows the same rules as DependsOnlyOn: sub-namespaces are
included, the own namespace and framework assemblies never count as outside,
and the results are chainable with .OrOn(...), .ExcludingSubNamespaces()
and .ExcludingOwnSubNamespaces(). Negated assertions report the offending
dependencies via the shared DependencyViolationRenderer.


vbreuss added 2 commits June 6, 2026 05:20
…cies outside an allowed set

Implements the positive counterpart of the `DependOnlyOn` family (closes #328):

- `ThatType.HasDependenciesOutside(...)` (namespaces and `Filtered.Types` targets)
- `ThatTypes.HaveDependenciesOutside(...)` (sync and async enumerables)
- `TypeFilters.WhichHaveDependenciesOutside(...)`

The allowed set follows the same rules as `DependsOnlyOn`: sub-namespaces are
included, the own namespace and framework assemblies never count as outside,
and the results are chainable with `.OrOn(...)`, `.ExcludingSubNamespaces()`
and `.ExcludingOwnSubNamespaces()`. Negated assertions report the offending
dependencies via the shared `DependencyViolationRenderer`.
- Fix the README example asserting a legacy module: the plural assertion is
  all-quantified, so demonstrate the single-type assertion instead.
- Extend the stale (for depends-only-on) remarks in the shared dependency
  options to mention the has-dependencies-outside family.
- Mirror two only-on edge tests: a subject in the global namespace and the
  namespace-qualification of same-named violators in the negated message.
@vbreuss vbreuss self-assigned this Jun 6, 2026
@vbreuss vbreuss added the enhancement New feature or request label Jun 6, 2026
@sonarqubecloud

sonarqubecloud Bot commented Jun 6, 2026

Copy link
Copy Markdown

@github-actions

github-actions Bot commented Jun 6, 2026

Copy link
Copy Markdown

Test Results

    13 files  ±  0      13 suites  ±0   8m 56s ⏱️ + 1m 35s
 6 460 tests + 60   6 457 ✅ + 60   3 💤 ±0  0 ❌ ±0 
38 605 runs  +360  38 592 ✅ +360  13 💤 ±0  0 ❌ ±0 

Results for commit 9b077d0. ± Comparison against base commit 9a8f4d6.

@github-actions

github-actions Bot commented Jun 6, 2026

Copy link
Copy Markdown

🚀 Benchmark Results

Details

BenchmarkDotNet v0.15.8, Linux Ubuntu 24.04.4 LTS (Noble Numbat)
AMD EPYC 7763 2.69GHz, 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 205.9 ns 3.62 ns 3.38 ns 0.0386 648 B

@github-actions

github-actions Bot commented Jun 6, 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/Filtered.Types.cs 88.89% 38 2 2 3 24 8 40 5 77
Filters/TypeFilters.WhichHaveDependenciesOutside.cs 100.00% 3 0 0 0 0 0 3 0 3
Helpers/DependencyViolationRenderer.cs 94.12% 16 1 0 0 4 16 16 1 37
Options/NamespaceDependencyOptions.cs 100.00% 35 0 0 0 10 2 35 0 47
Options/TypeSetDependencyOptions.cs 82.76% 21 3 3 2 11 3 24 5 43
Results/NamespaceDependencyOutsideResult.cs 100.00% 3 0 0 0 3 0 3 0 6
Results/TypeSetDependencyOutsideResult.cs 100.00% 2 0 0 0 2 0 2 0 4
ThatType.HasDependenciesOutside.cs 92.86% 26 2 0 0 4 18 26 2 50
ThatTypes.HaveDependenciesOutside.cs 94.12% 32 2 0 0 6 16 32 2 56

The final mutation score is 92.35%

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

@vbreuss vbreuss merged commit 2defc14 into main Jun 6, 2026
12 checks passed
@vbreuss vbreuss deleted the feature/has-dependencies-outside branch June 6, 2026 07:49
@github-actions

github-actions Bot commented Jun 7, 2026

Copy link
Copy Markdown

This is addressed in release v2.0.0.

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

Labels

enhancement New feature or request state: released The issue is released

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add support for finding types with dependencies outside an allowed set

1 participant