Skip to content

Commit 9a63b55

Browse files
authored
Merge branch 'main' into fix/filter-compiler-attributes
2 parents acf1f20 + 717deb0 commit 9a63b55

33 files changed

+288
-90
lines changed

ArchUnitNET.MSTestV2/ArchUnitNET.MSTestV2.csproj

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
<IncludeSymbols>true</IncludeSymbols>
1717
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
1818
<PackageReadmeFile>README.md</PackageReadmeFile>
19+
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
1920
</PropertyGroup>
2021

2122
<ItemGroup>

ArchUnitNET.MSTestV2Tests/ArchUnitNET.MSTestV2Tests.csproj

+1-2
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,9 @@
22

33
<PropertyGroup>
44
<TargetFramework>net8.0</TargetFramework>
5-
65
<IsPackable>false</IsPackable>
7-
86
<Company>TNG Technology Consulting GmbH</Company>
7+
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
98
</PropertyGroup>
109

1110
<ItemGroup>

ArchUnitNET.NUnit/ArchUnitNET.NUnit.csproj

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
<IncludeSymbols>true</IncludeSymbols>
1717
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
1818
<PackageReadmeFile>README.md</PackageReadmeFile>
19+
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
1920
</PropertyGroup>
2021

2122
<ItemGroup>

ArchUnitNET.NUnitTests/ArchUnitNET.NUnitTests.csproj

+1-2
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,9 @@
22

33
<PropertyGroup>
44
<TargetFramework>net8.0</TargetFramework>
5-
65
<IsPackable>false</IsPackable>
7-
86
<Company>TNG Technology Consulting GmbH</Company>
7+
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
98
</PropertyGroup>
109

1110
<ItemGroup>

ArchUnitNET.xUnit/ArchUnitNET.xUnit.csproj

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
<IncludeSymbols>true</IncludeSymbols>
1717
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
1818
<PackageReadmeFile>README.md</PackageReadmeFile>
19+
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
1920
</PropertyGroup>
2021

2122
<ItemGroup>

ArchUnitNET/ArchUnitNET.csproj

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
<IncludeSymbols>true</IncludeSymbols>
1717
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
1818
<PackageReadmeFile>README.md</PackageReadmeFile>
19+
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
1920
</PropertyGroup>
2021

2122
<ItemGroup>

ArchUnitNET/Domain/FunctionPointer.cs

+93
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
// Copyright 2019 Florian Gather <[email protected]>
2+
// Copyright 2019 Fritz Brandhuber <[email protected]>
3+
// Copyright 2020 Pavel Fischer <[email protected]>
4+
//
5+
// SPDX-License-Identifier: Apache-2.0
6+
7+
using System.Collections.Generic;
8+
using System.Linq;
9+
using ArchUnitNET.Domain.Dependencies;
10+
11+
namespace ArchUnitNET.Domain
12+
{
13+
public class FunctionPointer : IType
14+
{
15+
private readonly IType _type;
16+
17+
public FunctionPointer(
18+
IType type,
19+
ITypeInstance<IType> returnTypeInstance,
20+
List<ITypeInstance<IType>> parameterTypeInstances
21+
)
22+
{
23+
_type = type;
24+
ReturnTypeInstance = returnTypeInstance;
25+
ParameterTypeInstances = parameterTypeInstances;
26+
}
27+
28+
public Namespace Namespace => _type.Namespace;
29+
public Assembly Assembly => _type.Assembly;
30+
public MemberList Members => _type.Members;
31+
public IEnumerable<IType> ImplementedInterfaces => _type.ImplementedInterfaces;
32+
public bool IsNested => _type.IsNested;
33+
public bool IsStub => _type.IsStub;
34+
public bool IsGenericParameter => _type.IsGenericParameter;
35+
public string Name => _type.Name;
36+
public string FullName => _type.FullName;
37+
public Visibility Visibility => _type.Visibility;
38+
public bool IsGeneric => _type.IsGeneric;
39+
public List<GenericParameter> GenericParameters => _type.GenericParameters;
40+
public bool IsCompilerGenerated => _type.IsCompilerGenerated;
41+
public List<ITypeDependency> Dependencies => _type.Dependencies;
42+
public List<ITypeDependency> BackwardsDependencies => _type.BackwardsDependencies;
43+
public IEnumerable<Attribute> Attributes => _type.Attributes;
44+
public List<AttributeInstance> AttributeInstances => _type.AttributeInstances;
45+
public ITypeInstance<IType> ReturnTypeInstance { get; }
46+
public List<ITypeInstance<IType>> ParameterTypeInstances { get; }
47+
48+
public bool Equals(FunctionPointer other)
49+
{
50+
if (ReferenceEquals(null, other))
51+
{
52+
return false;
53+
}
54+
if (ReferenceEquals(this, other))
55+
{
56+
return true;
57+
}
58+
return Equals(_type, other._type)
59+
&& Equals(ReturnTypeInstance, other.ReturnTypeInstance)
60+
&& ParameterTypeInstances.SequenceEqual(other.ParameterTypeInstances);
61+
}
62+
63+
public override bool Equals(object obj)
64+
{
65+
if (ReferenceEquals(null, obj))
66+
{
67+
return false;
68+
}
69+
if (ReferenceEquals(this, obj))
70+
{
71+
return true;
72+
}
73+
return obj.GetType() == GetType() && Equals((FunctionPointer)obj);
74+
}
75+
76+
public override int GetHashCode()
77+
{
78+
unchecked
79+
{
80+
var hashCode = _type.GetHashCode();
81+
hashCode =
82+
(hashCode * 397)
83+
^ (ReturnTypeInstance != null ? ReturnTypeInstance.GetHashCode() : 0);
84+
hashCode = ParameterTypeInstances.Aggregate(
85+
hashCode,
86+
(current, typeInstance) =>
87+
(current * 397) ^ (typeInstance != null ? typeInstance.GetHashCode() : 0)
88+
);
89+
return hashCode;
90+
}
91+
}
92+
}
93+
}

ArchUnitNET/Fluent/Syntax/Elements/Members/MemberConditionsDefinition.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ Architecture architecture
176176
var archUnitType = architecture.GetITypeOfType(type);
177177
archUnitTypeList.Add(archUnitType);
178178
}
179-
catch (TypeDoesNotExistInArchitecture e)
179+
catch (TypeDoesNotExistInArchitecture)
180180
{
181181
//ignore, can't have a dependency anyways
182182
}
@@ -422,7 +422,7 @@ Architecture architecture
422422
var archUnitType = architecture.GetITypeOfType(type);
423423
archUnitTypeList.Add(archUnitType);
424424
}
425-
catch (TypeDoesNotExistInArchitecture e)
425+
catch (TypeDoesNotExistInArchitecture)
426426
{
427427
//ignore, can't have a dependency anyways
428428
}

ArchUnitNET/Fluent/Syntax/Elements/Members/MemberPredicatesDefinition.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ IEnumerable<T> Condition(IEnumerable<T> members, Architecture architecture)
139139
var archUnitType = architecture.GetITypeOfType(type);
140140
archUnitTypeList.Add(archUnitType);
141141
}
142-
catch (TypeDoesNotExistInArchitecture e)
142+
catch (TypeDoesNotExistInArchitecture)
143143
{
144144
//ignore, can't have a dependency anyways
145145
}
@@ -318,7 +318,7 @@ IEnumerable<T> Condition(IEnumerable<T> members, Architecture architecture)
318318
var archUnitType = architecture.GetITypeOfType(type);
319319
archUnitTypeList.Add(archUnitType);
320320
}
321-
catch (TypeDoesNotExistInArchitecture e)
321+
catch (TypeDoesNotExistInArchitecture)
322322
{
323323
//ignore, can't have a dependency anyways
324324
}

ArchUnitNET/Fluent/Syntax/Elements/Members/MethodMembers/MethodMemberConditionsDefinition.cs

+4-4
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ Architecture architecture
222222
var archUnitType = architecture.GetITypeOfType(type);
223223
archUnitTypeList.Add(archUnitType);
224224
}
225-
catch (TypeDoesNotExistInArchitecture e)
225+
catch (TypeDoesNotExistInArchitecture)
226226
{
227227
//ignore, can't have a dependency anyways
228228
}
@@ -494,7 +494,7 @@ Architecture architecture
494494
var archUnitType = architecture.GetITypeOfType(type);
495495
archUnitTypeList.Add(archUnitType);
496496
}
497-
catch (TypeDoesNotExistInArchitecture e)
497+
catch (TypeDoesNotExistInArchitecture)
498498
{
499499
//ignore, can't have a dependency anyways
500500
}
@@ -936,7 +936,7 @@ Architecture architecture
936936
var archUnitType = architecture.GetITypeOfType(type);
937937
archUnitTypeList.Add(archUnitType);
938938
}
939-
catch (TypeDoesNotExistInArchitecture e)
939+
catch (TypeDoesNotExistInArchitecture)
940940
{
941941
//ignore, can't have a dependency anyways
942942
}
@@ -1228,7 +1228,7 @@ Architecture architecture
12281228
var archUnitType = architecture.GetITypeOfType(type);
12291229
archUnitTypeList.Add(archUnitType);
12301230
}
1231-
catch (TypeDoesNotExistInArchitecture e)
1231+
catch (TypeDoesNotExistInArchitecture)
12321232
{
12331233
//ignore, can't have a dependency anyways
12341234
}

ArchUnitNET/Fluent/Syntax/Elements/Members/MethodMembers/MethodMemberPredicatesDefinition.cs

+4-4
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ Architecture architecture
160160
var archUnitType = architecture.GetITypeOfType(type);
161161
archUnitTypeList.Add(archUnitType);
162162
}
163-
catch (TypeDoesNotExistInArchitecture e)
163+
catch (TypeDoesNotExistInArchitecture)
164164
{
165165
//ignore, can't have a dependency anyways
166166
}
@@ -338,7 +338,7 @@ Architecture architecture
338338
var archUnitType = architecture.GetITypeOfType(type);
339339
archUnitTypeList.Add(archUnitType);
340340
}
341-
catch (TypeDoesNotExistInArchitecture e)
341+
catch (TypeDoesNotExistInArchitecture)
342342
{
343343
//ignore, can't have a dependency anyways
344344
}
@@ -625,7 +625,7 @@ Architecture architecture
625625
var archUnitType = architecture.GetITypeOfType(type);
626626
archUnitTypeList.Add(archUnitType);
627627
}
628-
catch (TypeDoesNotExistInArchitecture e)
628+
catch (TypeDoesNotExistInArchitecture)
629629
{
630630
//ignore, can't have a dependency anyways
631631
}
@@ -808,7 +808,7 @@ Architecture architecture
808808
var archUnitType = architecture.GetITypeOfType(type);
809809
archUnitTypeList.Add(archUnitType);
810810
}
811-
catch (TypeDoesNotExistInArchitecture e)
811+
catch (TypeDoesNotExistInArchitecture)
812812
{
813813
//ignore, can't have a dependency anyways
814814
}

ArchUnitNET/Fluent/Syntax/Elements/ObjectConditionsDefinition.cs

+9-9
Original file line numberDiff line numberDiff line change
@@ -542,7 +542,7 @@ Architecture architecture
542542
var archUnitType = architecture.GetITypeOfType(type);
543543
archUnitTypeList.Add(archUnitType);
544544
}
545-
catch (TypeDoesNotExistInArchitecture e)
545+
catch (TypeDoesNotExistInArchitecture)
546546
{
547547
//ignore, can't have a dependency anyways
548548
}
@@ -820,7 +820,7 @@ Architecture architecture
820820
var archUnitType = architecture.GetITypeOfType(type);
821821
archUnitTypeList.Add(archUnitType);
822822
}
823-
catch (TypeDoesNotExistInArchitecture e)
823+
catch (TypeDoesNotExistInArchitecture)
824824
{
825825
//ignore, can't have a dependency anyways
826826
}
@@ -1308,7 +1308,7 @@ Architecture architecture
13081308
var archUnitAttribute = architecture.GetAttributeOfType(type);
13091309
archUnitAttributeList.Add(archUnitAttribute);
13101310
}
1311-
catch (TypeDoesNotExistInArchitecture e)
1311+
catch (TypeDoesNotExistInArchitecture)
13121312
{
13131313
//ignore, can't have a dependency anyways
13141314
}
@@ -1730,7 +1730,7 @@ bool Condition(TRuleType obj, Architecture architecture)
17301730
{
17311731
archUnitAttribute = architecture.GetAttributeOfType(attribute);
17321732
}
1733-
catch (TypeDoesNotExistInArchitecture e)
1733+
catch (TypeDoesNotExistInArchitecture)
17341734
{
17351735
//can't have a dependency
17361736
return false;
@@ -2099,7 +2099,7 @@ bool Condition(TRuleType obj, Architecture architecture)
20992099
{
21002100
archUnitAttribute = architecture.GetAttributeOfType(attribute);
21012101
}
2102-
catch (TypeDoesNotExistInArchitecture e)
2102+
catch (TypeDoesNotExistInArchitecture)
21032103
{
21042104
//can't have a dependency
21052105
return false;
@@ -2851,7 +2851,7 @@ Architecture architecture
28512851
var archUnitType = architecture.GetITypeOfType(type);
28522852
archUnitTypeList.Add(archUnitType);
28532853
}
2854-
catch (TypeDoesNotExistInArchitecture e)
2854+
catch (TypeDoesNotExistInArchitecture)
28552855
{
28562856
//ignore, can't have a dependency anyways
28572857
}
@@ -3103,7 +3103,7 @@ Architecture architecture
31033103
var archUnitAttribute = architecture.GetAttributeOfType(type);
31043104
archUnitAttributeList.Add(archUnitAttribute);
31053105
}
3106-
catch (TypeDoesNotExistInArchitecture e)
3106+
catch (TypeDoesNotExistInArchitecture)
31073107
{
31083108
//ignore, can't have a dependency anyways
31093109
}
@@ -3527,7 +3527,7 @@ bool Condition(TRuleType obj, Architecture architecture)
35273527
{
35283528
archUnitAttribute = architecture.GetAttributeOfType(attribute);
35293529
}
3530-
catch (TypeDoesNotExistInArchitecture e)
3530+
catch (TypeDoesNotExistInArchitecture)
35313531
{
35323532
//can't have a dependency
35333533
return true;
@@ -3898,7 +3898,7 @@ bool Condition(TRuleType obj, Architecture architecture)
38983898
{
38993899
archUnitAttribute = architecture.GetAttributeOfType(attribute);
39003900
}
3901-
catch (TypeDoesNotExistInArchitecture e)
3901+
catch (TypeDoesNotExistInArchitecture)
39023902
{
39033903
//can't have a dependency
39043904
return true;

0 commit comments

Comments
 (0)