forked from github/codeql
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTSizeOfAPI.ql
More file actions
25 lines (23 loc) · 802 Bytes
/
Copy pathTSizeOfAPI.ql
File metadata and controls
25 lines (23 loc) · 802 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
/**
* @name Size of type APIs
* @description Types with a large public API might be difficult to use and might have too many responsibilities.
* @kind treemap
* @treemap.warnOn highValues
* @metricType reftype
* @metricAggregate avg sum max
* @tags testability
* modularity
* @id cs/public-functions-per-type
*/
import csharp
from ValueOrRefType t, int n
where
t.isSourceDeclaration() and
t.isPublic() and
n =
count(Method m | m.getDeclaringType() = t and m.isPublic()) +
count(Operator o | o.getDeclaringType() = t and o.isPublic()) +
count(Property p | p.getDeclaringType() = t and p.isPublic()) +
count(Indexer i | i.getDeclaringType() = t and i.isPublic()) +
count(Event e | e.getDeclaringType() = t and e.isPublic())
select t, n order by n desc