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

Annotation 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 - (hide annotations)
Tue Nov 19 10:39:06 2013 UTC (6 years, 2 months ago) by zurfluhs
File size: 11253 byte(s)
Code Analyzer: added rule 'unneeded object test local'.
1 zurfluhs 93168 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 zurfluhs 93389
12 zurfluhs 93168 AST_ITERATOR
13 zurfluhs 93176 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 zurfluhs 93168 redefine
31     process_access_id_as,
32     process_assign_as,
33     process_body_as,
34 zurfluhs 93304 process_creation_as,
35 zurfluhs 93216 process_do_as,
36 zurfluhs 93194 process_eiffel_list,
37 zurfluhs 93168 process_feature_as,
38 zurfluhs 93216 process_id_as,
39     process_if_as,
40     process_inspect_as,
41 zurfluhs 93304 process_instr_call_as,
42 zurfluhs 93216 process_loop_as,
43 zurfluhs 93427 process_object_test_as,
44 zurfluhs 93216 process_once_as
45 zurfluhs 93168 -- ...
46     end
47    
48     create
49     make
50    
51     feature {NONE} -- Initialization
52     make
53     do
54     last_run_successful := False
55 zurfluhs 93173
56     create_action_lists
57 zurfluhs 93168 end
58    
59 zurfluhs 93173 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 zurfluhs 93304 create creation_pre_actions.make
70     create creation_post_actions.make
71 zurfluhs 93216 create do_pre_actions.make
72     create do_post_actions.make
73 zurfluhs 93194 create eiffel_list_pre_actions.make
74     create eiffel_list_post_actions.make
75 zurfluhs 93173 create feature_pre_actions.make
76     create feature_post_actions.make
77     create id_pre_actions.make
78     create id_post_actions.make
79 zurfluhs 93304 create if_pre_actions.make
80     create if_post_actions.make
81 zurfluhs 93216 create inspect_pre_actions.make
82     create inspect_post_actions.make
83 zurfluhs 93304 create instruction_call_pre_actions.make
84     create instruction_call_post_actions.make
85 zurfluhs 93216 create loop_pre_actions.make
86     create loop_post_actions.make
87 zurfluhs 93427 create object_test_pre_actions.make
88     create object_test_post_actions.make
89 zurfluhs 93216 create once_pre_actions.make
90     create once_post_actions.make
91 zurfluhs 93173 end
92    
93 zurfluhs 93181 feature {CA_STANDARD_RULE}
94 zurfluhs 93168
95 zurfluhs 93173 add_access_id_pre_action (a_action: PROCEDURE[ANY, TUPLE[ACCESS_ID_AS]])
96 zurfluhs 93168 do
97 zurfluhs 93173 access_id_pre_actions.extend (a_action)
98 zurfluhs 93168 end
99    
100 zurfluhs 93173 add_access_id_post_action (a_action: PROCEDURE[ANY, TUPLE[ACCESS_ID_AS]])
101 zurfluhs 93168 do
102 zurfluhs 93173 access_id_post_actions.extend (a_action)
103 zurfluhs 93168 end
104    
105 zurfluhs 93173 add_assign_pre_action (a_action: PROCEDURE[ANY, TUPLE[ASSIGN_AS]])
106 zurfluhs 93168 do
107 zurfluhs 93173 assign_pre_actions.extend (a_action)
108 zurfluhs 93168 end
109    
110 zurfluhs 93173 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 zurfluhs 93304 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 zurfluhs 93216 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 zurfluhs 93194 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 zurfluhs 93173 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 zurfluhs 93216 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 zurfluhs 93304 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 zurfluhs 93427 add_loop_pre_action (a_action: PROCEDURE [ANY, TUPLE [LOOP_AS]])
216 zurfluhs 93216 do
217     loop_pre_actions.extend (a_action)
218     end
219    
220 zurfluhs 93427 add_loop_post_action (a_action: PROCEDURE [ANY, TUPLE [LOOP_AS]])
221 zurfluhs 93216 do
222     loop_post_actions.extend (a_action)
223     end
224    
225 zurfluhs 93427 add_object_test_pre_action (a_action: PROCEDURE [ANY, TUPLE [OBJECT_TEST_AS]])
226 zurfluhs 93216 do
227 zurfluhs 93427 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 zurfluhs 93216 once_pre_actions.extend (a_action)
238     end
239    
240 zurfluhs 93427 add_once_post_action (a_action: PROCEDURE [ANY, TUPLE [ONCE_AS]])
241 zurfluhs 93216 do
242     once_post_actions.extend (a_action)
243     end
244    
245 zurfluhs 93173 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 zurfluhs 93304 creation_pre_actions, creation_post_actions: LINKED_LIST [PROCEDURE [ANY, TUPLE[CREATION_AS] ] ]
256    
257 zurfluhs 93216 do_pre_actions, do_post_actions: LINKED_LIST[PROCEDURE[ANY, TUPLE[DO_AS]]]
258    
259 zurfluhs 93194 eiffel_list_pre_actions, eiffel_list_post_actions: LINKED_LIST[PROCEDURE[ANY, TUPLE[EIFFEL_LIST [AST_EIFFEL]]]]
260    
261 zurfluhs 93173 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 zurfluhs 93216 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 zurfluhs 93304 instruction_call_pre_actions, instruction_call_post_actions: LINKED_LIST [PROCEDURE [ANY, TUPLE [INSTR_CALL_AS] ] ]
270    
271 zurfluhs 93216 loop_pre_actions, loop_post_actions: LINKED_LIST[PROCEDURE[ANY, TUPLE[LOOP_AS]]]
272    
273 zurfluhs 93427 object_test_pre_actions, object_test_post_actions: LINKED_LIST [PROCEDURE [ANY, TUPLE [OBJECT_TEST_AS]]]
274    
275 zurfluhs 93216 once_pre_actions, once_post_actions: LINKED_LIST[PROCEDURE[ANY, TUPLE[ONCE_AS]]]
276    
277 zurfluhs 93168 feature -- Execution Commands
278    
279 zurfluhs 93173 run_on_class (a_class_to_check: CLASS_C)
280 zurfluhs 93168 -- Check all rules that have been added
281 zurfluhs 93173 local
282     l_ast: CLASS_AS
283 zurfluhs 93168 do
284 zurfluhs 93304 last_run_successful := False
285 zurfluhs 93173 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 zurfluhs 93168 last_run_successful := True
290     end
291    
292     feature {NONE} -- Processing
293    
294 zurfluhs 93216 process_access_id_as (a_id: ACCESS_ID_AS)
295 zurfluhs 93168 do
296 zurfluhs 93216 across access_id_pre_actions as l_a loop l_a.item.call ([a_id]) end
297 zurfluhs 93168
298 zurfluhs 93216 Precursor (a_id)
299 zurfluhs 93173
300 zurfluhs 93216 across access_id_post_actions as l_a loop l_a.item.call ([a_id]) end
301 zurfluhs 93168 end
302    
303 zurfluhs 93216 process_assign_as (a_assign: ASSIGN_AS)
304 zurfluhs 93168 do
305 zurfluhs 93216 across assign_pre_actions as l_a loop l_a.item.call ([a_assign]) end
306 zurfluhs 93168
307 zurfluhs 93216 Precursor (a_assign)
308 zurfluhs 93173
309 zurfluhs 93216 across assign_post_actions as l_a loop l_a.item.call ([a_assign]) end
310 zurfluhs 93168 end
311    
312 zurfluhs 93216 process_body_as (a_body: BODY_AS)
313 zurfluhs 93168 do
314 zurfluhs 93216 across body_pre_actions as l_a loop l_a.item.call ([a_body]) end
315 zurfluhs 93168
316 zurfluhs 93216 Precursor (a_body)
317 zurfluhs 93168
318 zurfluhs 93216 across body_post_actions as l_a loop l_a.item.call ([a_body]) end
319 zurfluhs 93168 end
320    
321 zurfluhs 93304 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 zurfluhs 93216 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 zurfluhs 93194 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 zurfluhs 93216 process_feature_as (a_feature: FEATURE_AS)
349 zurfluhs 93305 local
350     l_b: BOOLEAN
351 zurfluhs 93168 do
352 zurfluhs 93373 across feature_pre_actions as l_a loop l_a.item.call ([a_feature]) end
353 zurfluhs 93216 Precursor (a_feature)
354 zurfluhs 93373 across feature_post_actions as l_a loop l_a.item.call ([a_feature]) end
355 zurfluhs 93168 end
356    
357 zurfluhs 93216 process_id_as (a_id: ID_AS)
358 zurfluhs 93168 do
359 zurfluhs 93216 across id_pre_actions as l_a loop l_a.item.call ([a_id]) end
360 zurfluhs 93168
361 zurfluhs 93216 Precursor (a_id)
362 zurfluhs 93173
363 zurfluhs 93216 across id_post_actions as l_a loop l_a.item.call ([a_id]) end
364 zurfluhs 93168 end
365    
366 zurfluhs 93216 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 zurfluhs 93304 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 zurfluhs 93216 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 zurfluhs 93427 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 zurfluhs 93216 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 zurfluhs 93168 feature -- Results
419    
420     last_run_successful: BOOLEAN
421    
422 zurfluhs 93298 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 zurfluhs 93168 end

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.23