Skip to content

Commit

Permalink
refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
NeVeSpl committed Nov 19, 2023
1 parent 1f95218 commit 71e51bf
Show file tree
Hide file tree
Showing 7 changed files with 146 additions and 131 deletions.
11 changes: 6 additions & 5 deletions src/NetArchTest.Rules/Assemblies/TypeWrapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,15 @@ internal TypeWrapper(TypeDefinition monoTypeDefinition, string explanation)
{
_monoTypeDefinition = monoTypeDefinition;
_type = new Lazy<Type>(() =>
{
Type type = null;
{
try
{
type = _monoTypeDefinition.ToType();
return _monoTypeDefinition.ToType();
}
catch { }
return type;
catch
{
}
return null;
});
Explanation = explanation;
}
Expand Down
116 changes: 61 additions & 55 deletions src/NetArchTest.Rules/Condition.cs

Large diffs are not rendered by default.

26 changes: 13 additions & 13 deletions src/NetArchTest.Rules/Functions/FunctionDelegates.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ namespace NetArchTest.Functions
{
internal static partial class FunctionDelegates
{
public static IEnumerable<TypeSpec> HaveName(IEnumerable<TypeSpec> input, string name, bool condition)
internal static IEnumerable<TypeSpec> HaveName(IEnumerable<TypeSpec> input, string name, bool condition)
{
if (condition)
{
Expand Down Expand Up @@ -140,7 +140,7 @@ internal static IEnumerable<TypeSpec> ImplementsInterface(IEnumerable<TypeSpec>
}

/// <summary> Function for finding abstract classes. </summary>
internal static IEnumerable<TypeSpec> BeAbstract(IEnumerable<TypeSpec> input, bool dummy, bool condition)
internal static IEnumerable<TypeSpec> BeAbstract(IEnumerable<TypeSpec> input, bool condition)
{
if (condition)
{
Expand All @@ -153,7 +153,7 @@ internal static IEnumerable<TypeSpec> BeAbstract(IEnumerable<TypeSpec> input, bo
}

/// <summary> Function for finding classes. </summary>
internal static IEnumerable<TypeSpec> BeClass(IEnumerable<TypeSpec> input, bool dummy, bool condition)
internal static IEnumerable<TypeSpec> BeClass(IEnumerable<TypeSpec> input, bool condition)
{
if (condition)
{
Expand All @@ -166,7 +166,7 @@ internal static IEnumerable<TypeSpec> BeClass(IEnumerable<TypeSpec> input, bool
}

/// <summary> Function for finding interfaces. </summary>
internal static IEnumerable<TypeSpec> BeInterface(IEnumerable<TypeSpec> input, bool dummy, bool condition)
internal static IEnumerable<TypeSpec> BeInterface(IEnumerable<TypeSpec> input, bool condition)
{
if (condition)
{
Expand All @@ -179,7 +179,7 @@ internal static IEnumerable<TypeSpec> BeInterface(IEnumerable<TypeSpec> input, b
}

/// <summary> Function for finding static classes. </summary>
internal static IEnumerable<TypeSpec> BeStatic(IEnumerable<TypeSpec> input, bool dummy, bool condition)
internal static IEnumerable<TypeSpec> BeStatic(IEnumerable<TypeSpec> input, bool condition)
{
if (condition)
{
Expand All @@ -194,7 +194,7 @@ internal static IEnumerable<TypeSpec> BeStatic(IEnumerable<TypeSpec> input, bool
}

/// <summary> Function for finding types with generic parameters. </summary>
internal static IEnumerable<TypeSpec> BeGeneric(IEnumerable<TypeSpec> input, bool dummy, bool condition)
internal static IEnumerable<TypeSpec> BeGeneric(IEnumerable<TypeSpec> input, bool condition)
{
if (condition)
{
Expand All @@ -208,7 +208,7 @@ internal static IEnumerable<TypeSpec> BeGeneric(IEnumerable<TypeSpec> input, boo


/// <summary> Function for finding nested classes. </summary>
internal static IEnumerable<TypeSpec> BeNested(IEnumerable<TypeSpec> input, bool dummy, bool condition)
internal static IEnumerable<TypeSpec> BeNested(IEnumerable<TypeSpec> input, bool condition)
{
if (condition)
{
Expand All @@ -221,7 +221,7 @@ internal static IEnumerable<TypeSpec> BeNested(IEnumerable<TypeSpec> input, bool
}

/// <summary> Function for finding nested public classes. </summary>
internal static IEnumerable<TypeSpec> BeNestedPublic(IEnumerable<TypeSpec> input, bool dummy, bool condition)
internal static IEnumerable<TypeSpec> BeNestedPublic(IEnumerable<TypeSpec> input, bool condition)
{
if (condition)
{
Expand All @@ -234,7 +234,7 @@ internal static IEnumerable<TypeSpec> BeNestedPublic(IEnumerable<TypeSpec> input
}

/// <summary> Function for finding nested private classes. </summary>
internal static IEnumerable<TypeSpec> BeNestedPrivate(IEnumerable<TypeSpec> input, bool dummy, bool condition)
internal static IEnumerable<TypeSpec> BeNestedPrivate(IEnumerable<TypeSpec> input, bool condition)
{
if (condition)
{
Expand All @@ -248,7 +248,7 @@ internal static IEnumerable<TypeSpec> BeNestedPrivate(IEnumerable<TypeSpec> inpu


/// <summary> Function for finding public classes. </summary>
internal static IEnumerable<TypeSpec> BePublic(IEnumerable<TypeSpec> input, bool dummy, bool condition)
internal static IEnumerable<TypeSpec> BePublic(IEnumerable<TypeSpec> input, bool condition)
{
if (condition)
{
Expand All @@ -261,7 +261,7 @@ internal static IEnumerable<TypeSpec> BePublic(IEnumerable<TypeSpec> input, bool
}

/// <summary> Function for finding sealed classes. </summary>
internal static IEnumerable<TypeSpec> BeSealed(IEnumerable<TypeSpec> input, bool dummmy, bool condition)
internal static IEnumerable<TypeSpec> BeSealed(IEnumerable<TypeSpec> input, bool condition)
{
if (condition)
{
Expand All @@ -274,7 +274,7 @@ internal static IEnumerable<TypeSpec> BeSealed(IEnumerable<TypeSpec> input, bool
}

/// <summary> Function for finding immutable classes. </summary>
internal static IEnumerable<TypeSpec> BeImmutable(IEnumerable<TypeSpec> input, bool dummmy, bool condition)
internal static IEnumerable<TypeSpec> BeImmutable(IEnumerable<TypeSpec> input, bool condition)
{
if (condition)
{
Expand All @@ -287,7 +287,7 @@ internal static IEnumerable<TypeSpec> BeImmutable(IEnumerable<TypeSpec> input, b
}

/// <summary> Function for finding nullable classes. </summary>
internal static IEnumerable<TypeSpec> HasNullableMembers(IEnumerable<TypeSpec> input, bool dummmy, bool condition)
internal static IEnumerable<TypeSpec> HasNullableMembers(IEnumerable<TypeSpec> input, bool condition)
{
if (condition)
{
Expand Down
4 changes: 3 additions & 1 deletion src/NetArchTest.Rules/IType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ public interface IType
/// </summary>
string Name { get; }


/// <summary>
/// It contains explanation why this Type has failed dependecy search.
/// </summary>
string Explanation { get; }
}
}
Loading

0 comments on commit 71e51bf

Please sign in to comment.