diff options
Diffstat (limited to 'Metrics/Metrics-Calculation/RealisticRunner/queries/github.vql')
-rw-r--r-- | Metrics/Metrics-Calculation/RealisticRunner/queries/github.vql | 121 |
1 files changed, 121 insertions, 0 deletions
diff --git a/Metrics/Metrics-Calculation/RealisticRunner/queries/github.vql b/Metrics/Metrics-Calculation/RealisticRunner/queries/github.vql new file mode 100644 index 00000000..eda5f0f1 --- /dev/null +++ b/Metrics/Metrics-Calculation/RealisticRunner/queries/github.vql | |||
@@ -0,0 +1,121 @@ | |||
1 | package queries | ||
2 | import epackage "sure.ghtorrent.github" | ||
3 | |||
4 | pattern directParent(a : Commit, b: Commit) { | ||
5 | Commit.parents(a,b); | ||
6 | } | ||
7 | |||
8 | @Constraint(key={a}, severity="error", message="error") | ||
9 | pattern loopInParent(a: Commit){ | ||
10 | find directParent+(a,a); | ||
11 | } | ||
12 | |||
13 | pattern checkAction(i: Issue, e: IssueEvent, t: Action) { | ||
14 | Issue.issueevent(i, e); | ||
15 | IssueEvent.action(e, a); | ||
16 | a == t; | ||
17 | } | ||
18 | |||
19 | pattern checkUserAction(i: Issue, u: User, e: IssueEvent, t: Action) { | ||
20 | Issue.issueevent(i, e); | ||
21 | IssueEvent.user(e, u); | ||
22 | IssueEvent.action(e, a); | ||
23 | a == t; | ||
24 | } | ||
25 | |||
26 | pattern isReopen(i: Issue, e: IssueEvent) { | ||
27 | Issue.issueevent(i, e); | ||
28 | IssueEvent.action(e, a); | ||
29 | a == Action::REOPENED; | ||
30 | } | ||
31 | |||
32 | pattern isClose(i: Issue, e: IssueEvent) { | ||
33 | Issue.issueevent(i, e); | ||
34 | IssueEvent.action(e, a); | ||
35 | a == Action::CLOSED; | ||
36 | } | ||
37 | |||
38 | pattern isUnSubscribe(i: Issue, u: User, e: IssueEvent) { | ||
39 | Issue.issueevent(i, e); | ||
40 | IssueEvent.user(e, u); | ||
41 | IssueEvent.action(e, a); | ||
42 | a == Action::UNSUBSCRIBED; | ||
43 | } | ||
44 | |||
45 | pattern isSubscribe(i: Issue, u: User, e: IssueEvent) { | ||
46 | Issue.issueevent(i, e); | ||
47 | IssueEvent.user(e, u); | ||
48 | IssueEvent.action(e, a); | ||
49 | a == Action::SUBSCRIBED; | ||
50 | } | ||
51 | |||
52 | |||
53 | pattern pullRequestOfIssue(i: Issue, pr: PullRequest) { | ||
54 | Issue.pullrequest(i, pr); | ||
55 | } | ||
56 | |||
57 | //@Constraint(key={i}, severity="error", message="error") | ||
58 | //pattern mergedIssueWithoutPr(i: Issue){ | ||
59 | // find checkAction(i, _, Action::MERGED); | ||
60 | // neg find pullRequestOfIssue(i, _); | ||
61 | //} | ||
62 | |||
63 | @Constraint(key={i}, severity="error", message="error") | ||
64 | pattern consecutiveClosesWithoutReopen(i: Issue) { | ||
65 | find checkAction(i, a1, Action::CLOSED); | ||
66 | find checkAction(i, a2, Action::CLOSED); | ||
67 | a1 != a2; | ||
68 | neg find isReopen(i, _); | ||
69 | } | ||
70 | |||
71 | |||
72 | @Constraint(key={i}, severity="error", message="error") | ||
73 | pattern consecutiveReopensWithoutClose(i: Issue) { | ||
74 | find checkAction(i, a1, Action::REOPENED); | ||
75 | find checkAction(i, a2, Action::REOPENED); | ||
76 | a1 != a2; | ||
77 | neg find isClose(i, _); | ||
78 | } | ||
79 | |||
80 | //@Constraint(key={i, u}, severity="error", message="error") | ||
81 | //pattern consecutiveSubWithoutUnSub(i: Issue, u: User) { | ||
82 | // find checkUserAction(i, u, a1, Action::SUBSCRIBED); | ||
83 | // find checkUserAction(i, u, a2, Action::SUBSCRIBED); | ||
84 | // a1 != a2; | ||
85 | // neg find isUnSubscribe(i, u, _); | ||
86 | //} | ||
87 | |||
88 | @Constraint(key={i, u}, severity="error", message="error") | ||
89 | pattern consecutiveUnSubWithoutSub(i: Issue, u: User) { | ||
90 | find checkUserAction(i, u, a1, Action::UNSUBSCRIBED); | ||
91 | find checkUserAction(i, u, a2, Action::UNSUBSCRIBED); | ||
92 | a1 != a2; | ||
93 | neg find isSubscribe(i, u, _); | ||
94 | } | ||
95 | |||
96 | //pattern committer(c: Commit, u:User) { | ||
97 | // Commit.committer(c, u); | ||
98 | //} | ||
99 | // | ||
100 | //pattern eventUser(e: IssueEvent, u:User){ | ||
101 | // IssueEvent.user(e, u); | ||
102 | //} | ||
103 | // | ||
104 | //@Constraint(key={c}, severity="error", message="error") | ||
105 | //pattern noCommitter(c: Commit) { | ||
106 | // neg find committer(c, _); | ||
107 | //} | ||
108 | // | ||
109 | //@Constraint(key={e}, severity="error", message="error") | ||
110 | //pattern noUser(e: IssueEvent) { | ||
111 | // neg find eventUser(e, _); | ||
112 | //} | ||
113 | |||
114 | |||
115 | |||
116 | //1. issue with MERGED but no PullRequest | ||
117 | //2. issue with 2 CLOSED events without a REOPENED event | ||
118 | //3. issue with 2 REOPENED events without a CLOSED event | ||
119 | //4. user-issue pair with 2 SUBSCRIBED events without an UNSUBSCRIBED event | ||
120 | //5. user-issue pair with 2 UNSUBSCRIBED events without a SUBSCRIBED event | ||
121 | //6. User MERGED/CLOSED/REOPENED issue without being a projectMember of the Project (Not possible under this condition) \ No newline at end of file | ||