Skip to content

Commit fa3b718

Browse files
committed
BenMorris/NetArchTest#130 - remove number of type parameters (e.g. `1) from the name of generic type
1 parent de5139a commit fa3b718

27 files changed

+1598
-1601
lines changed

src/NetArchTest.Rules/Condition.cs

Lines changed: 3 additions & 243 deletions
Original file line numberDiff line numberDiff line change
@@ -36,141 +36,9 @@ private void AddFunctionCall(Func<IEnumerable<TypeSpec>, IEnumerable<TypeSpec>>
3636
}
3737

3838

39-
/// <summary>
40-
/// Selects types that have a specific name.
41-
/// </summary>
42-
/// <param name="name">The name of the class to match against.</param>
43-
/// <returns>An updated set of conditions that can be applied to a list of types.</returns>
44-
public ConditionList HaveName(string name)
45-
{
46-
AddFunctionCall(x => FunctionDelegates.HaveName(x, name, true));
47-
return CreateConditionList();
48-
}
49-
50-
/// <summary>
51-
/// Selects types that do not have a particular name.
52-
/// </summary>
53-
/// <param name="name">The name of the class to match against.</param>
54-
/// <returns>An updated set of conditions that can be applied to a list of types.</returns>
55-
public ConditionList NotHaveName(string name)
56-
{
57-
AddFunctionCall(x => FunctionDelegates.HaveName(x, name, false));
58-
return CreateConditionList();
59-
}
60-
61-
/// <summary>
62-
/// Selects types according to a regular expression matching their name.
63-
/// </summary>
64-
/// <param name="pattern">The regular expression pattern to match against.</param>
65-
/// <returns>An updated set of conditions that can be applied to a list of types.</returns>
66-
public ConditionList HaveNameMatching(string pattern)
67-
{
68-
AddFunctionCall(x => FunctionDelegates.HaveNameMatching(x, pattern, true));
69-
return CreateConditionList();
70-
}
71-
72-
/// <summary>
73-
/// Selects types according to a regular expression that does not match their name.
74-
/// </summary>
75-
/// <param name="pattern">The regular expression pattern to match against.</param>
76-
/// <returns>An updated set of conditions that can be applied to a list of types.</returns>
77-
public ConditionList NotHaveNameMatching(string pattern)
78-
{
79-
AddFunctionCall(x => FunctionDelegates.HaveNameMatching(x, pattern, false));
80-
return CreateConditionList();
81-
}
82-
83-
/// <summary>
84-
/// Selects types whose names start with the specified text.
85-
/// </summary>
86-
/// <param name="start">The text to match against.</param>
87-
/// <returns>An updated set of conditions that can be applied to a list of types.</returns>
88-
public ConditionList HaveNameStartingWith(string start)
89-
{
90-
AddFunctionCall(x => FunctionDelegates.HaveNameStartingWith(x, start, true));
91-
return CreateConditionList();
92-
}
93-
94-
/// <summary>
95-
/// Selects types whose names start with the specified text.
96-
/// </summary>
97-
/// <param name="start">The text to match against.</param>
98-
/// <param name="comparer">The string comparer.</param>
99-
/// <returns>An updated set of conditions that can be applied to a list of types.</returns>
100-
public ConditionList HaveNameStartingWith(string start, StringComparison comparer)
101-
{
102-
AddFunctionCall(x => FunctionDelegates.HaveNameStartingWith(x, start, true, comparer));
103-
return CreateConditionList();
104-
}
105-
106-
/// <summary>
107-
/// Selects types whose names do not start with the specified text.
108-
/// </summary>
109-
/// <param name="start">The text to match against.</param>
110-
/// <returns>An updated set of conditions that can be applied to a list of types.</returns>
111-
public ConditionList NotHaveNameStartingWith(string start)
112-
{
113-
AddFunctionCall(x => FunctionDelegates.HaveNameStartingWith(x, start, false));
114-
return CreateConditionList();
115-
}
116-
117-
/// <summary>
118-
/// Selects types whose names do not start with the specified text.
119-
/// </summary>
120-
/// <param name="start">The text to match against.</param>
121-
/// <param name="comparer">The string comparer.</param>
122-
/// <returns>An updated set of conditions that can be applied to a list of types.</returns>
123-
public ConditionList NotHaveNameStartingWith(string start, StringComparison comparer)
124-
{
125-
AddFunctionCall(x => FunctionDelegates.HaveNameStartingWith(x, start, false, comparer));
126-
return CreateConditionList();
127-
}
128-
129-
/// <summary>
130-
/// Selects types whose names do not end with the specified text.
131-
/// </summary>
132-
/// <param name="end">The text to match against.</param>
133-
/// <returns>An updated set of conditions that can be applied to a list of types.</returns>
134-
public ConditionList HaveNameEndingWith(string end)
135-
{
136-
AddFunctionCall(x => FunctionDelegates.HaveNameEndingWith(x, end, true));
137-
return CreateConditionList();
138-
}
139-
140-
/// <summary>
141-
/// Selects types whose names do not end with the specified text.
142-
/// </summary>
143-
/// <param name="end">The text to match against.</param>
144-
/// <param name="comparer">The string comparer.</param>
145-
/// <returns>An updated set of conditions that can be applied to a list of types.</returns>
146-
public ConditionList HaveNameEndingWith(string end, StringComparison comparer)
147-
{
148-
AddFunctionCall(x => FunctionDelegates.HaveNameEndingWith(x, end, true, comparer));
149-
return CreateConditionList();
150-
}
151-
152-
/// <summary>
153-
/// Selects types whose names do not end with the specified text.
154-
/// </summary>
155-
/// <param name="end">The text to match against.</param>
156-
/// <returns>An updated set of conditions that can be applied to a list of types.</returns>
157-
public ConditionList NotHaveNameEndingWith(string end)
158-
{
159-
AddFunctionCall(x => FunctionDelegates.HaveNameEndingWith(x, end, false));
160-
return CreateConditionList();
161-
}
39+
16240

163-
/// <summary>
164-
/// Selects types whose names do not end with the specified text.
165-
/// </summary>
166-
/// <param name="end">The text to match against.</param>
167-
/// <param name="comparer">The string comparer.</param>
168-
/// <returns>An updated set of conditions that can be applied to a list of types.</returns>
169-
public ConditionList NotHaveNameEndingWith(string end, StringComparison comparer)
170-
{
171-
AddFunctionCall(x => FunctionDelegates.HaveNameEndingWith(x, end, false, comparer));
172-
return CreateConditionList();
173-
}
41+
17442

17543
/// <summary>
17644
/// Selects types are decorated with a specific custom attribut.
@@ -260,115 +128,7 @@ public ConditionList NotImplementInterface(Type interfaceType)
260128
return CreateConditionList();
261129
}
262130

263-
/// <summary>
264-
/// Selects types that reside in a particular namespace.
265-
/// </summary>
266-
/// <param name="name">The namespace to match against.</param>
267-
/// <returns>An updated set of conditions that can be applied to a list of types.</returns>
268-
public ConditionList ResideInNamespace(string name)
269-
{
270-
AddFunctionCall(x => FunctionDelegates.ResideInNamespace(x, name, true));
271-
return CreateConditionList();
272-
}
273-
274-
/// <summary>
275-
/// Selects types that do not reside in a particular namespace.
276-
/// </summary>
277-
/// <param name="name">The namespace to match against.</param>
278-
/// <returns>An updated set of conditions that can be applied to a list of types.</returns>
279-
public ConditionList NotResideInNamespace(string name)
280-
{
281-
AddFunctionCall(x => FunctionDelegates.ResideInNamespace(x, name, false));
282-
return CreateConditionList();
283-
}
284-
285-
/// <summary>
286-
/// Selects types that reside in a namespace matching a regular expression.
287-
/// </summary>
288-
/// <param name="pattern">The regular expression pattern to match against.</param>
289-
/// <returns>An updated set of conditions that can be applied to a list of types.</returns>
290-
public ConditionList ResideInNamespaceMatching(string pattern)
291-
{
292-
AddFunctionCall(x => FunctionDelegates.ResideInNamespaceMatching(x, pattern, true));
293-
return CreateConditionList();
294-
}
295-
296-
/// <summary>
297-
/// Selects types that do not reside in a namespace matching a regular expression.
298-
/// </summary>
299-
/// <param name="pattern">The regular expression pattern to match against.</param>
300-
/// <returns>An updated set of conditions that can be applied to a list of types.</returns>
301-
public ConditionList NotResideInNamespaceMatching(string pattern)
302-
{
303-
AddFunctionCall(x => FunctionDelegates.ResideInNamespaceMatching(x, pattern, false));
304-
return CreateConditionList();
305-
}
306-
307-
/// <summary>
308-
/// Selects types whose namespaces start with a particular name part.
309-
/// </summary>
310-
/// <param name="name">The namespace part to match against.</param>
311-
/// <returns>An updated set of predicates that can be applied to a list of types.</returns>
312-
public ConditionList ResideInNamespaceStartingWith(string name)
313-
{
314-
AddFunctionCall(x => FunctionDelegates.ResideInNamespaceMatching(x, $"^{name}", true));
315-
return CreateConditionList();
316-
}
317-
318-
/// <summary>
319-
/// Selects types whose namespaces start with a particular name part.
320-
/// </summary>
321-
/// <param name="name">The namespace part to match against.</param>
322-
/// <returns>An updated set of predicates that can be applied to a list of types.</returns>
323-
public ConditionList NotResideInNamespaceStartingWith(string name)
324-
{
325-
AddFunctionCall(x => FunctionDelegates.ResideInNamespaceMatching(x, $"^{name}", false));
326-
return CreateConditionList();
327-
}
328-
329-
/// <summary>
330-
/// Selects types whose namespaces end with a particular name part.
331-
/// </summary>
332-
/// <param name="name">The namespace part to match against.</param>
333-
/// <returns>An updated set of predicates that can be applied to a list of types.</returns>
334-
public ConditionList ResideInNamespaceEndingWith(string name)
335-
{
336-
AddFunctionCall(x => FunctionDelegates.ResideInNamespaceMatching(x, $"{name}$", true));
337-
return CreateConditionList();
338-
}
339-
340-
/// <summary>
341-
/// Selects types whose namespaces end with a particular name part.
342-
/// </summary>
343-
/// <param name="name">The namespace part to match against.</param>
344-
/// <returns>An updated set of predicates that can be applied to a list of types.</returns>
345-
public ConditionList NotResideInNamespaceEndingWith(string name)
346-
{
347-
AddFunctionCall(x => FunctionDelegates.ResideInNamespaceMatching(x, $"{name}$", false));
348-
return CreateConditionList();
349-
}
350-
351-
/// <summary>
352-
/// Selects types whose namespaces contain a particular name part.
353-
/// </summary>
354-
/// <param name="name">The namespace part to match against.</param>
355-
/// <returns>An updated set of predicates that can be applied to a list of types.</returns>
356-
public ConditionList ResideInNamespaceContaining(string name)
357-
{
358-
AddFunctionCall(x => FunctionDelegates.ResideInNamespaceMatching(x, $"^.*{name}.*$", true));
359-
return CreateConditionList();
360-
}
361-
362-
/// <summary>
363-
/// Selects types whose namespaces contain a particular name part.
364-
/// </summary>
365-
/// <param name="name">The namespace part to match against.</param>
366-
/// <returns>An updated set of predicates that can be applied to a list of types.</returns>
367-
public ConditionList NotResideInNamespaceContaining(string name)
368-
{
369-
AddFunctionCall(x => FunctionDelegates.ResideInNamespaceMatching(x, $"^.*{name}.*$", false));
370-
return CreateConditionList();
371-
}
131+
372132

373133
/// <summary>
374134
/// Selects types that meet a custom rule.

0 commit comments

Comments
 (0)