Skip to content

Commit 0ef3e63

Browse files
committed
fix code format
Signed-off-by: Fritz Brandhuber <fritz.brandhuber@tngtech.com>
1 parent 6ff10e9 commit 0ef3e63

26 files changed

+171
-279
lines changed

ArchUnitNET/Domain/Extensions/AttributeExtensions.cs

Lines changed: 9 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -11,46 +11,26 @@ namespace ArchUnitNET.Domain.Extensions
1111
{
1212
public static class AttributeExtensions
1313
{
14-
public static bool HasAttribute(
15-
this IHasAttributes a,
16-
string fullName
17-
)
14+
public static bool HasAttribute(this IHasAttributes a, string fullName)
1815
{
19-
return a.Attributes.Any(attribute =>
20-
attribute.FullNameEquals(fullName)
21-
);
16+
return a.Attributes.Any(attribute => attribute.FullNameEquals(fullName));
2217
}
2318

24-
public static bool HasAttributeMatching(
25-
this IHasAttributes a,
26-
string pattern
27-
)
19+
public static bool HasAttributeMatching(this IHasAttributes a, string pattern)
2820
{
29-
return a.Attributes.Any(attribute =>
30-
attribute.FullNameMatches(pattern)
31-
);
21+
return a.Attributes.Any(attribute => attribute.FullNameMatches(pattern));
3222
}
3323

34-
public static bool OnlyHasAttributes(
35-
this IHasAttributes a,
36-
string name
37-
)
24+
public static bool OnlyHasAttributes(this IHasAttributes a, string name)
3825
{
3926
return a.Attributes.IsNullOrEmpty()
40-
|| a.Attributes.All(attribute =>
41-
attribute.FullNameEquals(name)
42-
);
27+
|| a.Attributes.All(attribute => attribute.FullNameEquals(name));
4328
}
4429

45-
public static bool OnlyHasAttributesMatching(
46-
this IHasAttributes a,
47-
string pattern
48-
)
30+
public static bool OnlyHasAttributesMatching(this IHasAttributes a, string pattern)
4931
{
5032
return a.Attributes.IsNullOrEmpty()
51-
|| a.Attributes.All(attribute =>
52-
attribute.FullNameMatches(pattern)
53-
);
33+
|| a.Attributes.All(attribute => attribute.FullNameMatches(pattern));
5434
}
5535
}
56-
}
36+
}

ArchUnitNET/Domain/Extensions/DependencyExtensions.cs

Lines changed: 15 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -13,22 +13,14 @@ namespace ArchUnitNET.Domain.Extensions
1313
{
1414
public static class DependencyExtensions
1515
{
16-
public static bool CallsMethod(
17-
this IHasDependencies type,
18-
string fullName
19-
)
16+
public static bool CallsMethod(this IHasDependencies type, string fullName)
2017
{
21-
return type.GetCalledMethods()
22-
.Any(member => member.FullNameEquals(fullName));
18+
return type.GetCalledMethods().Any(member => member.FullNameEquals(fullName));
2319
}
24-
25-
public static bool CallsMethodMatching(
26-
this IHasDependencies type,
27-
string pattern
28-
)
20+
21+
public static bool CallsMethodMatching(this IHasDependencies type, string pattern)
2922
{
30-
return type.GetCalledMethods()
31-
.Any(member => member.FullNameMatches(pattern));
23+
return type.GetCalledMethods().Any(member => member.FullNameMatches(pattern));
3224
}
3325

3426
public static IEnumerable<MethodMember> GetCalledMethods(this IHasDependencies type)
@@ -45,40 +37,24 @@ public static IEnumerable<FieldMember> GetAccessedFieldMembers(this IHasDependen
4537
.Select(dependency => (FieldMember)dependency.TargetMember);
4638
}
4739

48-
public static bool DependsOnType(
49-
this IHasDependencies c,
50-
string fullName
51-
)
40+
public static bool DependsOnType(this IHasDependencies c, string fullName)
5241
{
53-
return c.GetTypeDependencies()
54-
.Any(d => d.FullNameEquals(fullName));
42+
return c.GetTypeDependencies().Any(d => d.FullNameEquals(fullName));
5543
}
56-
57-
public static bool DependsOnTypeMatching(
58-
this IHasDependencies c,
59-
string pattern
60-
)
44+
45+
public static bool DependsOnTypeMatching(this IHasDependencies c, string pattern)
6146
{
62-
return c.GetTypeDependencies()
63-
.Any(d => d.FullNameMatches(pattern));
47+
return c.GetTypeDependencies().Any(d => d.FullNameMatches(pattern));
6448
}
6549

66-
67-
public static bool OnlyDependsOnType(
68-
this IHasDependencies c,
69-
string fullName
70-
)
50+
public static bool OnlyDependsOnType(this IHasDependencies c, string fullName)
7151
{
72-
return c.GetTypeDependencies()
73-
.All(d => d.FullNameEquals(fullName));
52+
return c.GetTypeDependencies().All(d => d.FullNameEquals(fullName));
7453
}
75-
public static bool OnlyDependsOnTypesMatching(
76-
this IHasDependencies c,
77-
string pattern
78-
)
54+
55+
public static bool OnlyDependsOnTypesMatching(this IHasDependencies c, string pattern)
7956
{
80-
return c.GetTypeDependencies()
81-
.All(d => d.FullNameMatches(pattern));
57+
return c.GetTypeDependencies().All(d => d.FullNameMatches(pattern));
8258
}
8359

8460
public static IEnumerable<IType> GetTypeDependencies(this IHasDependencies c)

ArchUnitNET/Domain/Extensions/MemberExtensions.cs

Lines changed: 11 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,12 @@ namespace ArchUnitNET.Domain.Extensions
1212
{
1313
public static class MemberExtensions
1414
{
15-
public static bool IsDeclaredIn(
16-
this IMember member,
17-
string fullName
18-
)
15+
public static bool IsDeclaredIn(this IMember member, string fullName)
1916
{
2017
return member.DeclaringType.FullNameEquals(fullName);
2118
}
22-
23-
public static bool IsDeclaredInTypeMatching(
24-
this IMember member,
25-
string pattern
26-
)
19+
20+
public static bool IsDeclaredInTypeMatching(this IMember member, string pattern)
2721
{
2822
return member.DeclaringType.FullNameMatches(pattern);
2923
}
@@ -69,28 +63,18 @@ public static bool HasMethodCallDependencies(
6963
return member.GetMethodCallDependencies(getBackwardsDependencies).Any();
7064
}
7165

72-
public static bool IsCalledByType(
73-
this MethodMember member,
74-
string fullName
75-
)
66+
public static bool IsCalledByType(this MethodMember member, string fullName)
7667
{
7768
return member
7869
.GetMethodCallDependencies(true)
79-
.Any(dependency =>
80-
dependency.Origin.FullNameEquals(fullName)
81-
);
70+
.Any(dependency => dependency.Origin.FullNameEquals(fullName));
8271
}
83-
84-
public static bool IsCalledByTypeMatching(
85-
this MethodMember member,
86-
string pattern
87-
)
72+
73+
public static bool IsCalledByTypeMatching(this MethodMember member, string pattern)
8874
{
8975
return member
9076
.GetMethodCallDependencies(true)
91-
.Any(dependency =>
92-
dependency.Origin.FullNameMatches(pattern)
93-
);
77+
.Any(dependency => dependency.Origin.FullNameMatches(pattern));
9478
}
9579

9680
public static IEnumerable<IType> GetCallingTypes(this MethodMember member)
@@ -108,21 +92,17 @@ string fullName
10892
{
10993
return member
11094
.GetBodyTypeMemberDependencies()
111-
.Any(dependency =>
112-
dependency.Target.FullNameEquals(fullName)
113-
);
95+
.Any(dependency => dependency.Target.FullNameEquals(fullName));
11496
}
115-
97+
11698
public static bool HasDependencyInMethodBodyToTypeMatching(
11799
this MethodMember member,
118100
string pattern
119101
)
120102
{
121103
return member
122104
.GetBodyTypeMemberDependencies()
123-
.Any(dependency =>
124-
dependency.Target.FullNameMatches(pattern)
125-
);
105+
.Any(dependency => dependency.Target.FullNameMatches(pattern));
126106
}
127107

128108
public static bool HasFieldTypeDependencies(

ArchUnitNET/Domain/Extensions/NamingExtensions.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public static bool FullNameEquals(this IHasName cls, string fullName)
5757
{
5858
return string.Equals(cls.FullName, fullName, StringComparison.OrdinalIgnoreCase);
5959
}
60-
60+
6161
public static bool FullNameMatches(this IHasName cls, string pattern)
6262
{
6363
return pattern != null && Regex.IsMatch(cls.FullName, pattern);
@@ -88,7 +88,7 @@ public static TType WhereFullNameIs<TType>(this IEnumerable<TType> source, strin
8888
{
8989
throw new MultipleOccurrencesInSequenceException(
9090
$"Full name {fullName} found multiple times in provided types. Please use extern "
91-
+ "alias to reference assemblies that have the same fully-qualified type names."
91+
+ "alias to reference assemblies that have the same fully-qualified type names."
9292
);
9393
}
9494

@@ -107,4 +107,4 @@ string assemblyQualifiedName
107107
);
108108
}
109109
}
110-
}
110+
}

ArchUnitNET/Domain/Extensions/TypeExtensions.cs

Lines changed: 21 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,7 @@ public static bool ImplementsInterface(this IType type, Interface intf)
2525
);
2626
}
2727

28-
public static bool ImplementsInterface(
29-
this IType type,
30-
string fullName
31-
)
28+
public static bool ImplementsInterface(this IType type, string fullName)
3229
{
3330
if (type is GenericParameter)
3431
{
@@ -39,11 +36,8 @@ string fullName
3936
implementedInterface.FullNameEquals(fullName)
4037
);
4138
}
42-
43-
public static bool ImplementsInterfaceMatching(
44-
this IType type,
45-
string pattern
46-
)
39+
40+
public static bool ImplementsInterfaceMatching(this IType type, string pattern)
4741
{
4842
if (type is GenericParameter)
4943
{
@@ -67,36 +61,24 @@ public static bool IsAssignableTo(this IType type, IType assignableToType)
6761
return type.GetAssignableTypes().Contains(assignableToType);
6862
}
6963

70-
public static bool IsAssignableTo(
71-
this IType type,
72-
string fullName
73-
)
64+
public static bool IsAssignableTo(this IType type, string fullName)
7465
{
7566
if (type is GenericParameter genericParameter)
7667
{
77-
return genericParameter.TypeConstraints.All(t =>
78-
t.IsAssignableTo(fullName)
79-
);
68+
return genericParameter.TypeConstraints.All(t => t.IsAssignableTo(fullName));
8069
}
8170

82-
return type.GetAssignableTypes()
83-
.Any(t => t.FullNameEquals(fullName));
71+
return type.GetAssignableTypes().Any(t => t.FullNameEquals(fullName));
8472
}
85-
86-
public static bool IsAssignableToTypeMatching(
87-
this IType type,
88-
string pattern
89-
)
73+
74+
public static bool IsAssignableToTypeMatching(this IType type, string pattern)
9075
{
9176
if (type is GenericParameter genericParameter)
9277
{
93-
return genericParameter.TypeConstraints.All(t =>
94-
t.IsAssignableTo(pattern)
95-
);
78+
return genericParameter.TypeConstraints.All(t => t.IsAssignableTo(pattern));
9679
}
9780

98-
return type.GetAssignableTypes()
99-
.Any(t => t.FullNameMatches(pattern));
81+
return type.GetAssignableTypes().Any(t => t.FullNameMatches(pattern));
10082
}
10183

10284
public static bool IsNestedIn(this IType type, IType assignableToType)
@@ -262,58 +244,37 @@ public static Attribute GetAttributeOfType(this IType type, Class attributeClass
262244
attribute.FullName.Equals(attributeClass.FullName)
263245
);
264246
}
265-
266-
public static bool ResidesInNamespace(
267-
this IType e,
268-
string fullName
269-
)
247+
248+
public static bool ResidesInNamespace(this IType e, string fullName)
270249
{
271250
return e.Namespace.FullNameEquals(fullName);
272251
}
273252

274-
public static bool ResidesInNamespaceMatching(
275-
this IType e,
276-
string pattern
277-
)
253+
public static bool ResidesInNamespaceMatching(this IType e, string pattern)
278254
{
279255
return e.Namespace.FullNameMatches(pattern);
280256
}
281257

282-
public static bool ResidesInAssembly(
283-
this IType e,
284-
string fullName
285-
)
258+
public static bool ResidesInAssembly(this IType e, string fullName)
286259
{
287260
return e.Assembly.FullNameEquals(fullName);
288261
}
289-
public static bool ResidesInAssemblyMatching(
290-
this IType e,
291-
string pattern
292-
)
262+
263+
public static bool ResidesInAssemblyMatching(this IType e, string pattern)
293264
{
294265
return e.Assembly.FullNameMatches(pattern);
295266
}
296267

297-
public static bool IsDeclaredAsFieldIn(
298-
this IType type,
299-
string fullName
300-
)
268+
public static bool IsDeclaredAsFieldIn(this IType type, string fullName)
301269
{
302270
return type.GetFieldTypeDependencies(true)
303-
.Any(dependency =>
304-
dependency.Target.FullNameEquals(fullName)
305-
);
271+
.Any(dependency => dependency.Target.FullNameEquals(fullName));
306272
}
307-
308-
public static bool IsDeclaredAsFieldInTypeMatching(
309-
this IType type,
310-
string pattern
311-
)
273+
274+
public static bool IsDeclaredAsFieldInTypeMatching(this IType type, string pattern)
312275
{
313276
return type.GetFieldTypeDependencies(true)
314-
.Any(dependency =>
315-
dependency.Target.FullNameMatches(pattern)
316-
);
277+
.Any(dependency => dependency.Target.FullNameMatches(pattern));
317278
}
318279

319280
public static bool HasDependency(this IType type, ITypeDependency dependency)

0 commit comments

Comments
 (0)