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

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.23