/[eiffelstudio]/branches/eth/eve/Src/framework/code_analysis/rule_checkers/ca_all_rules_checker.e
ViewVC logotype

Contents of /branches/eth/eve/Src/framework/code_analysis/rule_checkers/ca_all_rules_checker.e

Parent Directory Parent Directory | Revision Log Revision Log


Revision 93304 - (show annotations)
Mon Nov 11 10:05:03 2013 UTC (6 years, 2 months ago) by zurfluhs
File size: 10646 byte(s)
Code Analysis:

- 'command query separation' rule implementation
- command line: refactoring / localization
1 note
2 description: "Summary description for {CA_ALL_RULES_CHECKER}."
3 author: ""
4 date: "$Date$"
5 revision: "$Revision$"
6
7 class
8 CA_ALL_RULES_CHECKER
9
10 inherit
11 AST_ITERATOR
12 export {NONE}
13 process_none_id_as,
14 process_typed_char_as,
15 process_agent_routine_creation_as,
16 process_inline_agent_creation_as,
17 process_create_creation_as,
18 process_bang_creation_as,
19 process_create_creation_expr_as,
20 process_bang_creation_expr_as,
21 process_keyword_as,
22 process_symbol_as,
23 process_break_as,
24 process_leaf_stub_as,
25 process_symbol_stub_as,
26 process_keyword_stub_as,
27 process_there_exists_as,
28 process_for_all_as
29 redefine
30 process_access_id_as,
31 process_assign_as,
32 process_body_as,
33 process_creation_as,
34 process_do_as,
35 process_eiffel_list,
36 process_feature_as,
37 process_id_as,
38 process_if_as,
39 process_inspect_as,
40 process_instr_call_as,
41 process_loop_as,
42 process_once_as
43 -- ...
44 end
45
46 create
47 make
48
49 feature {NONE} -- Initialization
50 make
51 do
52 last_run_successful := False
53
54 create_action_lists
55 end
56
57 create_action_lists
58 do
59 create access_id_pre_actions.make
60 create access_id_post_actions.make
61 create assign_pre_actions.make
62 create assign_post_actions.make
63 create body_pre_actions.make
64 create body_post_actions.make
65 create class_pre_actions.make
66 create class_post_actions.make
67 create creation_pre_actions.make
68 create creation_post_actions.make
69 create do_pre_actions.make
70 create do_post_actions.make
71 create eiffel_list_pre_actions.make
72 create eiffel_list_post_actions.make
73 create feature_pre_actions.make
74 create feature_post_actions.make
75 create id_pre_actions.make
76 create id_post_actions.make
77 create if_pre_actions.make
78 create if_post_actions.make
79 create inspect_pre_actions.make
80 create inspect_post_actions.make
81 create instruction_call_pre_actions.make
82 create instruction_call_post_actions.make
83 create loop_pre_actions.make
84 create loop_post_actions.make
85 create once_pre_actions.make
86 create once_post_actions.make
87 end
88
89 feature {CA_STANDARD_RULE}
90
91 add_access_id_pre_action (a_action: PROCEDURE[ANY, TUPLE[ACCESS_ID_AS]])
92 do
93 access_id_pre_actions.extend (a_action)
94 end
95
96 add_access_id_post_action (a_action: PROCEDURE[ANY, TUPLE[ACCESS_ID_AS]])
97 do
98 access_id_post_actions.extend (a_action)
99 end
100
101 add_assign_pre_action (a_action: PROCEDURE[ANY, TUPLE[ASSIGN_AS]])
102 do
103 assign_pre_actions.extend (a_action)
104 end
105
106 add_assign_post_action (a_action: PROCEDURE[ANY, TUPLE[ASSIGN_AS]])
107 do
108 assign_post_actions.extend (a_action)
109 end
110
111 add_body_pre_action (a_action: PROCEDURE[ANY, TUPLE[BODY_AS]])
112 do
113 body_pre_actions.extend (a_action)
114 end
115
116 add_body_post_action (a_action: PROCEDURE[ANY, TUPLE[BODY_AS]])
117 do
118 body_post_actions.extend (a_action)
119 end
120
121 add_class_pre_action (a_action: PROCEDURE[ANY, TUPLE[CLASS_AS]])
122 do
123 class_pre_actions.extend (a_action)
124 end
125
126 add_class_post_action (a_action: PROCEDURE[ANY, TUPLE[CLASS_AS]])
127 do
128 class_post_actions.extend (a_action)
129 end
130
131 add_creation_pre_action (a_action: PROCEDURE [ANY, TUPLE [CREATION_AS] ])
132 do
133 creation_pre_actions.extend (a_action)
134 end
135
136 add_creation_post_action (a_action: PROCEDURE [ANY, TUPLE [CREATION_AS] ])
137 do
138 creation_post_actions.extend (a_action)
139 end
140
141 add_do_pre_action (a_action: PROCEDURE[ANY, TUPLE[DO_AS]])
142 do
143 do_pre_actions.extend (a_action)
144 end
145
146 add_do_post_action (a_action: PROCEDURE[ANY, TUPLE[DO_AS]])
147 do
148 do_post_actions.extend (a_action)
149 end
150
151 add_eiffel_list_pre_action (a_action: PROCEDURE[ANY, TUPLE[EIFFEL_LIST[AST_EIFFEL]]])
152 do
153 eiffel_list_pre_actions.extend (a_action)
154 end
155
156 add_eiffel_list_post_action (a_action: PROCEDURE[ANY, TUPLE[EIFFEL_LIST[AST_EIFFEL]]])
157 do
158 eiffel_list_post_actions.extend (a_action)
159 end
160
161 add_feature_pre_action (a_action: PROCEDURE[ANY, TUPLE[FEATURE_AS]])
162 do
163 feature_pre_actions.extend (a_action)
164 end
165
166 add_feature_post_action (a_action: PROCEDURE[ANY, TUPLE[FEATURE_AS]])
167 do
168 feature_post_actions.extend (a_action)
169 end
170
171 add_id_pre_action (a_action: PROCEDURE[ANY, TUPLE[ID_AS]])
172 do
173 id_pre_actions.extend (a_action)
174 end
175
176 add_id_post_action (a_action: PROCEDURE[ANY, TUPLE[ID_AS]])
177 do
178 id_post_actions.extend (a_action)
179 end
180
181 add_if_pre_action (a_action: PROCEDURE[ANY, TUPLE[IF_AS]])
182 do
183 if_pre_actions.extend (a_action)
184 end
185
186 add_if_post_action (a_action: PROCEDURE[ANY, TUPLE[IF_AS]])
187 do
188 if_post_actions.extend (a_action)
189 end
190
191 add_inspect_pre_action (a_action: PROCEDURE[ANY, TUPLE[INSPECT_AS]])
192 do
193 inspect_pre_actions.extend (a_action)
194 end
195
196 add_inspect_post_action (a_action: PROCEDURE[ANY, TUPLE[INSPECT_AS]])
197 do
198 inspect_post_actions.extend (a_action)
199 end
200
201 add_instruction_call_pre_action (a_action: PROCEDURE [ANY, TUPLE [INSTR_CALL_AS] ])
202 do
203 instruction_call_pre_actions.extend (a_action)
204 end
205
206 add_instruction_call_post_action (a_action: PROCEDURE [ANY, TUPLE [INSTR_CALL_AS] ])
207 do
208 instruction_call_post_actions.extend (a_action)
209 end
210
211 add_loop_pre_action (a_action: PROCEDURE[ANY, TUPLE[LOOP_AS]])
212 do
213 loop_pre_actions.extend (a_action)
214 end
215
216 add_loop_post_action (a_action: PROCEDURE[ANY, TUPLE[LOOP_AS]])
217 do
218 loop_post_actions.extend (a_action)
219 end
220
221 add_once_pre_action (a_action: PROCEDURE[ANY, TUPLE[ONCE_AS]])
222 do
223 once_pre_actions.extend (a_action)
224 end
225
226 add_once_post_action (a_action: PROCEDURE[ANY, TUPLE[ONCE_AS]])
227 do
228 once_post_actions.extend (a_action)
229 end
230
231 feature {NONE} -- Agent lists
232
233 access_id_pre_actions, access_id_post_actions: LINKED_LIST[PROCEDURE[ANY, TUPLE[ACCESS_ID_AS]]]
234
235 assign_pre_actions, assign_post_actions: LINKED_LIST[PROCEDURE[ANY, TUPLE[ASSIGN_AS]]]
236
237 body_pre_actions, body_post_actions: LINKED_LIST[PROCEDURE[ANY, TUPLE[BODY_AS]]]
238
239 class_pre_actions, class_post_actions: LINKED_LIST[PROCEDURE[ANY, TUPLE[CLASS_AS]]]
240
241 creation_pre_actions, creation_post_actions: LINKED_LIST [PROCEDURE [ANY, TUPLE[CREATION_AS] ] ]
242
243 do_pre_actions, do_post_actions: LINKED_LIST[PROCEDURE[ANY, TUPLE[DO_AS]]]
244
245 eiffel_list_pre_actions, eiffel_list_post_actions: LINKED_LIST[PROCEDURE[ANY, TUPLE[EIFFEL_LIST [AST_EIFFEL]]]]
246
247 feature_pre_actions, feature_post_actions: LINKED_LIST[PROCEDURE[ANY, TUPLE[FEATURE_AS]]]
248
249 id_pre_actions, id_post_actions: LINKED_LIST[PROCEDURE[ANY, TUPLE[ID_AS]]]
250
251 if_pre_actions, if_post_actions: LINKED_LIST[PROCEDURE[ANY, TUPLE[IF_AS]]]
252
253 inspect_pre_actions, inspect_post_actions: LINKED_LIST[PROCEDURE[ANY, TUPLE[INSPECT_AS]]]
254
255 instruction_call_pre_actions, instruction_call_post_actions: LINKED_LIST [PROCEDURE [ANY, TUPLE [INSTR_CALL_AS] ] ]
256
257 loop_pre_actions, loop_post_actions: LINKED_LIST[PROCEDURE[ANY, TUPLE[LOOP_AS]]]
258
259 once_pre_actions, once_post_actions: LINKED_LIST[PROCEDURE[ANY, TUPLE[ONCE_AS]]]
260
261 feature -- Execution Commands
262
263 run_on_class (a_class_to_check: CLASS_C)
264 -- Check all rules that have been added
265 local
266 l_ast: CLASS_AS
267 do
268 last_run_successful := False
269 l_ast := a_class_to_check.ast
270 across class_pre_actions as l_a loop l_a.item.call ([l_ast]) end
271 process_class_as (l_ast)
272 across class_post_actions as l_a loop l_a.item.call ([l_ast]) end
273 last_run_successful := True
274 end
275
276 feature {NONE} -- Processing
277
278 process_access_id_as (a_id: ACCESS_ID_AS)
279 do
280 across access_id_pre_actions as l_a loop l_a.item.call ([a_id]) end
281
282 Precursor (a_id)
283
284 across access_id_post_actions as l_a loop l_a.item.call ([a_id]) end
285 end
286
287 process_assign_as (a_assign: ASSIGN_AS)
288 do
289 across assign_pre_actions as l_a loop l_a.item.call ([a_assign]) end
290
291 Precursor (a_assign)
292
293 across assign_post_actions as l_a loop l_a.item.call ([a_assign]) end
294 end
295
296 process_body_as (a_body: BODY_AS)
297 do
298 across body_pre_actions as l_a loop l_a.item.call ([a_body]) end
299
300 Precursor (a_body)
301
302 across body_post_actions as l_a loop l_a.item.call ([a_body]) end
303 end
304
305 process_creation_as (a_creation: CREATION_AS)
306 do
307 across creation_pre_actions as l_a loop l_a.item.call ([a_creation]) end
308
309 Precursor (a_creation)
310
311 across creation_post_actions as l_a loop l_a.item.call ([a_creation]) end
312 end
313
314 process_do_as (a_do: DO_AS)
315 do
316 across do_pre_actions as l_a loop l_a.item.call ([a_do]) end
317
318 Precursor (a_do)
319
320 across do_post_actions as l_a loop l_a.item.call ([a_do]) end
321 end
322
323 process_eiffel_list (a_list: EIFFEL_LIST [AST_EIFFEL])
324 do
325 across eiffel_list_pre_actions as l_a loop l_a.item.call ([a_list]) end
326
327 Precursor (a_list)
328
329 across eiffel_list_post_actions as l_a loop l_a.item.call ([a_list]) end
330 end
331
332 process_feature_as (a_feature: FEATURE_AS)
333 do
334 across feature_pre_actions as l_a loop l_a.item.call ([a_feature]) end
335
336 Precursor (a_feature)
337
338 across feature_post_actions as l_a loop l_a.item.call ([a_feature]) end
339 end
340
341 process_id_as (a_id: ID_AS)
342 do
343 across id_pre_actions as l_a loop l_a.item.call ([a_id]) end
344
345 Precursor (a_id)
346
347 across id_post_actions as l_a loop l_a.item.call ([a_id]) end
348 end
349
350 process_if_as (a_if: IF_AS)
351 local
352 l_pre_task, l_post_task: CA_VISIT_NODE_TASK
353 do
354 across if_pre_actions as l_a loop l_a.item.call ([a_if]) end
355 -- create l_pre_task.make (a_if, if_pre_actions)
356 -- rota.run_task (l_pre_task)
357
358 Precursor (a_if)
359
360 across if_post_actions as l_a loop l_a.item.call ([a_if]) end
361 end
362
363 process_inspect_as (a_inspect: INSPECT_AS)
364 do
365 across inspect_pre_actions as l_a loop l_a.item.call ([a_inspect]) end
366
367 Precursor (a_inspect)
368
369 across inspect_post_actions as l_a loop l_a.item.call ([a_inspect]) end
370 end
371
372 process_instr_call_as (a_call: INSTR_CALL_AS)
373 do
374 across instruction_call_pre_actions as l_a loop l_a.item.call ([a_call]) end
375
376 Precursor (a_call)
377
378 across instruction_call_post_actions as l_a loop l_a.item.call ([a_call]) end
379 end
380
381 process_loop_as (a_loop: LOOP_AS)
382 do
383 across loop_pre_actions as l_a loop l_a.item.call ([a_loop]) end
384
385 Precursor (a_loop)
386
387 across loop_post_actions as l_a loop l_a.item.call ([a_loop]) end
388 end
389
390 process_once_as (a_once: ONCE_AS)
391 do
392 across once_pre_actions as l_a loop l_a.item.call ([a_once]) end
393
394 Precursor (a_once)
395
396 across once_post_actions as l_a loop l_a.item.call ([a_once]) end
397 end
398
399 feature -- Results
400
401 last_run_successful: BOOLEAN
402
403 feature {NONE} -- Implementation
404
405 frozen rota: detachable ROTA_S
406 -- Access to rota service
407 local
408 l_service_consumer: SERVICE_CONSUMER [ROTA_S]
409 do
410 create l_service_consumer
411 if l_service_consumer.is_service_available and then l_service_consumer.service.is_interface_usable then
412 Result := l_service_consumer.service
413 end
414 end
415
416 end

Properties

Name Value
svn:eol-style native
svn:keywords Author Date ID Revision

  ViewVC Help
Powered by ViewVC 1.1.23