forked from TEAMMATES/teammates
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathteammates-macker.xml
603 lines (591 loc) · 28.1 KB
/
teammates-macker.xml
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
<?xml version="1.0"?>
<macker>
<ruleset name="Architectural rules for TEAMMATES">
<var name="ui" value="teammates.ui" />
<var name="logic" value="teammates.logic" />
<var name="storage" value="teammates.storage" />
<var name="common" value="teammates.common" />
<var name="test" value="teammates.test" />
<var name="testCases" value="teammates.test.cases" />
<var name="e2e" value="teammates.e2e" />
<var name="e2eCases" value="teammates.e2e.cases" />
<var name="client" value="teammates.client" />
<ruleset name="Architectural rules for production code">
<ruleset name="PackageDiagram: UI should not touch Storage">
<access-rule>
<deny>
<from class="${ui}.**" />
<to class="${storage}.**" />
</deny>
</access-rule>
</ruleset>
<ruleset name="PackageDiagram: Logic should not touch UI">
<access-rule>
<deny>
<from class="${logic}.**" />
<to class="${ui}.**" />
</deny>
</access-rule>
</ruleset>
<ruleset name="PackageDiagram: Storage should not touch Logic">
<access-rule>
<deny>
<from class="${storage}.**" />
<to class="${logic}.**" />
</deny>
</access-rule>
</ruleset>
<ruleset name="PackageDiagram: Storage should not touch UI">
<access-rule>
<deny>
<from class="${storage}.**" />
<to class="${ui}.**" />
</deny>
</access-rule>
</ruleset>
<ruleset name="PackageDiagram: Common should not have dependencies to any packages except storage::entity">
<access-rule>
<deny>
<from class="${common}.**" />
<to class="teammates.**" >
<exclude class="${common}.**" /> <!-- allow dependency within the package -->
</to>
<allow>
<from class="${common}.datatransfer.**" />
<to class="${storage}.entity.**" />
</allow>
<allow>
<from>
<!-- violations that need fixing -->
<include class="${common}.datatransfer.questions.FeedbackConstantSumQuestionDetails" />
<include class="${common}.datatransfer.questions.FeedbackMcqQuestionDetails" />
<include class="${common}.datatransfer.questions.FeedbackMsqQuestionDetails" />
<include class="${common}.datatransfer.questions.FeedbackRankOptionsQuestionDetails" />
<include class="${common}.datatransfer.questions.FeedbackRankRecipientsQuestionDetails" />
<include class="${common}.datatransfer.questions.FeedbackRankRecipientsQuestionDetails**$**" />
</from>
</allow>
</deny>
</access-rule>
</ruleset>
<ruleset name="UiComponent: Only *Action can touch Logic API">
<access-rule>
<deny>
<from class="${ui}.**" />
<to class="${logic}.**" />
<allow>
<from>
<include class="${ui}.controller.**" />
<include class="${ui}.webapi.action.**" />
<include class="${ui}.automated.**" />
</from>
<to class="${logic}.api.**" />
</allow>
</deny>
</access-rule>
</ruleset>
<ruleset name="UiComponent: API output is only used in Web API package">
<access-rule>
<deny>
<from class="${ui}.**" >
<exclude class="${ui}.webapi.output.**" /> <!-- allow dependency within the package -->
<exclude class="${ui}.webapi.request.**" />
</from>
<to class="${ui}.webapi.output.**" />
<allow>
<from>
<include class="${ui}.webapi.action.**" />
<include class="${e2e}.util.BackDoor" />
</from>
</allow>
</deny>
</access-rule>
</ruleset>
<ruleset name="UiComponent: API request DTO is only used in Web API package">
<access-rule>
<deny>
<from class="${ui}.**" >
<exclude class="${ui}.webapi.request.**" /> <!-- allow dependency within the package -->
</from>
<to class="${ui}.webapi.request.**" />
<allow>
<from>
<include class="${ui}.webapi.action.**" />
</from>
</allow>
</deny>
</access-rule>
</ruleset>
<ruleset name="UiComponent: API output should not have dependencies to anything within the UI component">
<access-rule>
<deny>
<from class="${ui}.webapi.output.**" />
<to class="${ui}.**" />
<allow>
<to class="${ui}.webapi.output.**" /> <!-- allow dependency within the package -->
</allow>
</deny>
</access-rule>
</ruleset>
<ruleset name="UiComponent: Controller should be self-contained">
<access-rule>
<deny>
<from class="${ui}.**" />
<to class="${ui}.webapi.action.**" />
<allow>
<from class="${ui}.webapi.action.**" /> <!-- allow dependency within the package -->
</allow>
</deny>
</access-rule>
</ruleset>
<ruleset name="UiComponent: Automated actions should be self-contained">
<access-rule>
<deny>
<from class="${ui}.**" />
<to class="${ui}.automated.**" />
<allow>
<from class="${ui}.automated.**" /> <!-- allow dependency within the package -->
</allow>
</deny>
</access-rule>
</ruleset>
<ruleset name="UiComponent: Automated actions should not have dependencies to anything within the UI component">
<access-rule>
<deny>
<from class="${ui}.automated.**" />
<to class="${ui}.**" />
<allow>
<to class="${ui}.automated.**" /> <!-- allow dependency within the package -->
</allow>
</deny>
</access-rule>
</ruleset>
<ruleset name="LogicComponent: Logic classes can only access storage::api">
<access-rule>
<deny>
<from class="${logic}.**" />
<to class="${storage}.**" />
<allow>
<from>
<include class="${logic}.core.**" />
</from>
<to class="${storage}.api.**" />
</allow>
</deny>
</access-rule>
</ruleset>
<ruleset name="LogicComponent: Each logic can only access its corresponding DB (e.g. AccountsLogic -> AccountsDb)">
<foreach var="logicModule" class="${logic}.core.(*)Logic">
<pattern name="DbModule" class="${storage}.api.${logicModule}Db" />
<access-rule>
<message>${logicModule} can only access ${logicModule}Db</message>
<deny>
<from class="${logic}.core.${logicModule}Logic" />
<to class="${storage}.api.**" />
<allow>
<!-- Allow access from DataBundleLogic -->
<from class="${logic}.core.DataBundleLogic" />
</allow>
<allow>
<to pattern="DbModule" />
</allow>
</deny>
</access-rule>
</foreach>
</ruleset>
<ruleset name="LogicComponent: logic::core should not access logic::api">
<access-rule>
<deny>
<from class="${logic}.core.**" />
<to class="${logic}.api.**" />
</deny>
</access-rule>
</ruleset>
<ruleset name="StorageComponent: storage::search should not touch storage::entity">
<access-rule>
<deny>
<from class="${storage}.search.**" />
<to class="${storage}.entity.**" />
</deny>
</access-rule>
</ruleset>
<ruleset name="StorageComponent: storage::entity should not depend on anything within the storage component">
<access-rule>
<deny>
<from class="${storage}.entity.**" />
<to class="${storage}.**" />
<allow>
<to class="${storage}.entity.**" /> <!-- allow dependency within the package -->
</allow>
</deny>
</access-rule>
</ruleset>
<ruleset name="CommonComponent: Assumption class can only be used by production code; non-production code should use JUnit instead">
<access-rule>
<deny>
<to>
<include class="teammates.common.util.Assumption" />
</to>
<from>
<include class="${test}.**" />
<include class="${e2e}.**" />
<include class="${client}.**" />
</from>
</deny>
</access-rule>
</ruleset>
</ruleset>
<ruleset name="Architectural rules for test code">
<ruleset name="TestDriverComponent: Test cases should not be dependent on each other">
<access-rule>
<deny>
<from class="${testCases}.**" />
<to class="${testCases}.**" />
<allow>
<!-- allow dependency from inner class -->
<from class="${testCases}.**$**" />
</allow>
<allow>
<to>
<!-- allow dependency to inner class -->
<include class="${testCases}.**$**" />
<!-- allow dependency to base class -->
<include class="${testCases}.**Base**" />
</to>
</allow>
<allow>
<!-- allow dependency from Feedback*QuestionUiTest to FeedbackQuestionUiTest -->
<from class="${testCases}.browsertests.Feedback*QuestionUiTest" />
<to class="${testCases}.browsertests.FeedbackQuestionUiTest" />
</allow>
</deny>
</access-rule>
</ruleset>
<ruleset name="TestDriverComponent: Only certain test cases can test storage:entity">
<access-rule>
<deny>
<from class="${test}.**" />
<to class="${storage}.entity.**" />
<allow>
<from>
<include class="${testCases}.datatransfer.**" />
<include class="${testCases}.storage.**" />
</from>
</allow>
</deny>
</access-rule>
</ruleset>
<ruleset name="TestDriverComponent: Only certain test cases can access GaeSimulation/Logic">
<access-rule>
<deny>
<from class="${test}.**" />
<to>
<include class="${test}.driver.GaeSimulation" />
<include class="${logic}.api.Logic" />
</to>
<allow>
<from>
<include class="${testCases}.storage.**" />
<include class="${testCases}.logic.**" />
<include class="${testCases}.action.**" />
<include class="${testCases}.webapi.**" />
<include class="${testCases}.automated.**" />
<include class="${testCases}.search.**" />
<include class="${testCases}.BaseComponentTestCase" />
<include class="${testCases}.BaseTestCaseWithMinimalGaeEnvironment" />
</from>
</allow>
</deny>
</access-rule>
</ruleset>
</ruleset>
<ruleset name="Architectural rules for E2E code">
<ruleset name="PackageDiagram: E2E component should be self-contained">
<access-rule>
<deny>
<to class="${e2e}.**" />
<allow>
<from class="${e2e}.**" />
</allow>
<!-- to remove after front-end migration is done -->
<allow>
<from class="${test}.pageobjects.**" />
<to class="${e2e}.**" />
</allow>
<allow>
<from class="${testCases}.browsertests.**" />
<to class="${e2e}.**" />
</allow>
</deny>
</access-rule>
</ruleset>
<ruleset name="PackageDiagram: E2E cannot touch production code except for common components">
<access-rule>
<deny>
<from class="${e2e}.**" />
<to>
<include class="${ui}.**" />
<include class="${logic}.**" />
<include class="${storage}.**" />
</to>
<allow>
<to class="${ui}.webapi.output.**" />
</allow>
</deny>
</access-rule>
</ruleset>
<ruleset name="E2EComponent: E2E test cases should not be dependent on each other">
<access-rule>
<deny>
<from class="${e2eCases}.**" />
<to class="${e2eCases}.**" />
<allow>
<!-- allow dependency from inner class -->
<from class="${e2eCases}.**$**" />
</allow>
<allow>
<to>
<!-- allow dependency to inner class -->
<include class="${e2eCases}.**$**" />
<!-- allow dependency to base class -->
<include class="${e2eCases}.**Base**" />
</to>
</allow>
</deny>
</access-rule>
</ruleset>
<ruleset name="E2EComponent: Only E2E tests can access page object classes">
<access-rule>
<deny>
<from class="${e2e}.**" >
<exclude class="${e2e}.pageobjects.**" /> <!-- allow dependency within the package -->
</from>
<to class="${e2e}.pageobjects.**" />
<allow>
<from>
<include class="${e2eCases}.e2e.**" />
</from>
</allow>
</deny>
</access-rule>
</ruleset>
<ruleset name="E2EComponent: e2e::util should not have dependencies to anything within the e2e package">
<access-rule>
<deny>
<from class="${e2e}.util.**" />
<to class="${e2e}.**" />
<allow>
<to class="${e2e}.util.**" /> <!-- allow dependency within the package -->
</allow>
</deny>
</access-rule>
</ruleset>
</ruleset>
<ruleset name="Architectural rules for client code">
<ruleset name="PackageDiagram: Client scripts should be self-contained">
<access-rule>
<deny>
<to class="${client}.**" />
<allow>
<from class="${client}.**" />
</allow>
</deny>
</access-rule>
</ruleset>
<ruleset name="PackageDiagram: Client should not touch UI">
<access-rule>
<deny>
<from class="${client}.**" />
<to class="${ui}.**" />
</deny>
</access-rule>
</ruleset>
<ruleset name="PackageDiagram: client::remoteapi should not depend on client::scripts">
<access-rule>
<deny>
<from class="${client}.remoteapi.**" />
<to class="${client}.scripts.**" />
</deny>
</access-rule>
</ruleset>
<ruleset name="PackageDiagram: client::util should not have dependencies to anything within the client package">
<access-rule>
<deny>
<from class="${client}.util.**" />
<to class="${client}.**" />
<allow>
<to class="${client}.util.**" /> <!-- allow dependency within the package -->
</allow>
</deny>
</access-rule>
</ruleset>
</ruleset>
<ruleset name="Architectural rules for external API calls">
<ruleset name="Java Logging API can only be accessed via Logger">
<access-rule>
<deny>
<to class="java.util.logging.**" />
<allow>
<from class="${common}.util.Logger" />
</allow>
</deny>
</access-rule>
</ruleset>
<ruleset name="Search API can only be accessed via storage::api, storage::search and client scripts">
<access-rule>
<deny>
<to class="com.google.appengine.api.search.**" />
<allow>
<from>
<include class="${storage}.api.**" />
<include class="${storage}.search.**" />
<include class="${client}.scripts.**" />
</from>
</allow>
</deny>
</access-rule>
</ruleset>
<ruleset name="Google Cloud Storage API can only be accessed via GoogleCloudStorageHelper">
<access-rule>
<deny>
<to class="com.google.appengine.tools.cloudstorage.**" />
<allow>
<from>
<include class="${common}.util.GoogleCloudStorageHelper" />
<include class="${client}.**" />
</from>
</allow>
</deny>
</access-rule>
</ruleset>
<ruleset name="Blobstore API and data types can only be accessed via GoogleCloudStorageHelper and entity classes">
<access-rule>
<deny>
<to class="com.google.appengine.api.blobstore.**" />
<allow>
<from class="${common}.util.GoogleCloudStorageHelper" />
</allow>
<allow>
<from class="${storage}.entity.**" />
<to class="com.google.appengine.api.blobstore.BlobKey" />
</allow>
</deny>
</access-rule>
</ruleset>
<ruleset name="Task Queue API can only be accessed via TaskQueuesLogic">
<access-rule>
<deny>
<to class="com.google.appengine.api.taskqueue.**" />
<allow>
<from class="${logic}.core.TaskQueuesLogic" />
</allow>
</deny>
</access-rule>
</ruleset>
<ruleset name="Remote API can only be accessed via RemoteApiClient">
<access-rule>
<deny>
<to class="com.google.appengine.tools.remoteapi.**" />
<allow>
<from class="${client}.remoteapi.RemoteApiClient" />
</allow>
</deny>
</access-rule>
</ruleset>
<ruleset name="Objectify API can only be accessed via storage::api, Objectify base test case and client scripts">
<access-rule>
<deny>
<to>
<include class="com.googlecode.objectify.**" />
</to>
<allow>
<from>
<include class="${storage}.api.**" />
<include class="${storage}.entity.**" />
<include class="${testCases}.BaseTestCaseWithObjectifyAccess" />
<include class="${client}.remoteapi.**" />
<include class="${client}.scripts.**" />
</from>
</allow>
</deny>
</access-rule>
</ruleset>
<ruleset name="Google Cloud Datastore specific data type can only be accessed in storage::entity">
<!-- Remove the rule after Objectify V6 as V6 does not have Text data type anymore -->
<access-rule>
<deny>
<to class="com.google.appengine.api.datastore.Text" />
<allow>
<from class="${storage}.entity.**" />
</allow>
</deny>
</access-rule>
</ruleset>
<ruleset name="Servlet API can only be accessed via Servlet classes, GaeSimulation, and selected utility classes">
<access-rule>
<deny>
<to class="javax.servlet.**" />
<allow>
<from>
<include class="${common}.util.ActivityLogEntry" />
<include class="${common}.util.GoogleCloudStorageHelper" />
<include class="${common}.util.HttpRequestHelper" />
<include class="${storage}.api.OfyHelper" />
<include class="${ui}.automated.**" />
<include class="${ui}.controller.**" />
<include class="${ui}.webapi.action.**" />
<include class="${test}.driver.GaeSimulation" />
<include class="${test}.driver.MockFilterChain" />
<include class="${test}.driver.MockHttpServletRequest" />
<include class="${test}.driver.MockHttpServletRequest$**" />
<include class="${test}.driver.MockHttpServletResponse" />
<include class="${test}.driver.MockPart" />
</from>
</allow>
</deny>
</access-rule>
</ruleset>
<ruleset name="java.util.Date/java.util.Calendar should not be used">
<access-rule>
<deny>
<to>
<include class="java.util.Date" />
<include class="java.util.Calendar" />
</to>
<allow>
<!-- allow data type translator in BaseEntity -->
<!-- this exception can be removed after upgrading to Objectify V6 -->
<from class="${storage}.entity.BaseEntity$InstantTranslatorFactory**" />
</allow>
</deny>
</access-rule>
</ruleset>
<ruleset name="Assertion API can only be accessed via BaseTestCase and few selected classes">
<access-rule>
<deny>
<to>
<include class="org.junit.Assert" />
</to>
<allow>
<from>
<include class="${testCases}.BaseTestCase" />
<include class="${test}.driver.AssertHelper" />
<include class="${test}.driver.CsvChecker" />
<include class="${test}.driver.EmailChecker" />
<include class="${e2e}.pageobjects.**" />
<include class="${e2e}.util.HtmlHelper" />
</from>
</allow>
<!-- to remove after front-end migration is done -->
<allow>
<from>
<include class="${test}.pageobjects.**" />
<include class="${test}.driver.GaeSimulation" />
</from>
</allow>
</deny>
</access-rule>
</ruleset>
</ruleset>
</ruleset>
</macker>