/[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 93304 - (hide 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 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     AST_ITERATOR
12 zurfluhs 93176 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 zurfluhs 93168 redefine
30     process_access_id_as,
31     process_assign_as,
32     process_body_as,
33 zurfluhs 93304 process_creation_as,
34 zurfluhs 93216 process_do_as,
35 zurfluhs 93194 process_eiffel_list,
36 zurfluhs 93168 process_feature_as,
37 zurfluhs 93216 process_id_as,
38     process_if_as,
39     process_inspect_as,
40 zurfluhs 93304 process_instr_call_as,
41 zurfluhs 93216 process_loop_as,
42     process_once_as
43 zurfluhs 93168 -- ...
44     end
45    
46     create
47     make
48    
49     feature {NONE} -- Initialization
50     make
51     do
52     last_run_successful := False
53 zurfluhs 93173
54     create_action_lists
55 zurfluhs 93168 end
56    
57 zurfluhs 93173 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 zurfluhs 93304 create creation_pre_actions.make
68     create creation_post_actions.make
69 zurfluhs 93216 create do_pre_actions.make
70     create do_post_actions.make
71 zurfluhs 93194 create eiffel_list_pre_actions.make
72     create eiffel_list_post_actions.make
73 zurfluhs 93173 create feature_pre_actions.make
74     create feature_post_actions.make
75     create id_pre_actions.make
76     create id_post_actions.make
77 zurfluhs 93304 create if_pre_actions.make
78     create if_post_actions.make
79 zurfluhs 93216 create inspect_pre_actions.make
80     create inspect_post_actions.make
81 zurfluhs 93304 create instruction_call_pre_actions.make
82     create instruction_call_post_actions.make
83 zurfluhs 93216 create loop_pre_actions.make
84     create loop_post_actions.make
85     create once_pre_actions.make
86     create once_post_actions.make
87 zurfluhs 93173 end
88    
89 zurfluhs 93181 feature {CA_STANDARD_RULE}
90 zurfluhs 93168
91 zurfluhs 93173 add_access_id_pre_action (a_action: PROCEDURE[ANY, TUPLE[ACCESS_ID_AS]])
92 zurfluhs 93168 do
93 zurfluhs 93173 access_id_pre_actions.extend (a_action)
94 zurfluhs 93168 end
95    
96 zurfluhs 93173 add_access_id_post_action (a_action: PROCEDURE[ANY, TUPLE[ACCESS_ID_AS]])
97 zurfluhs 93168 do
98 zurfluhs 93173 access_id_post_actions.extend (a_action)
99 zurfluhs 93168 end
100    
101 zurfluhs 93173 add_assign_pre_action (a_action: PROCEDURE[ANY, TUPLE[ASSIGN_AS]])
102 zurfluhs 93168 do
103 zurfluhs 93173 assign_pre_actions.extend (a_action)
104 zurfluhs 93168 end
105    
106 zurfluhs 93173 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 zurfluhs 93304 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 zurfluhs 93216 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 zurfluhs 93194 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 zurfluhs 93173 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 zurfluhs 93216 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 zurfluhs 93304 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 zurfluhs 93216 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 zurfluhs 93173 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 zurfluhs 93304 creation_pre_actions, creation_post_actions: LINKED_LIST [PROCEDURE [ANY, TUPLE[CREATION_AS] ] ]
242    
243 zurfluhs 93216 do_pre_actions, do_post_actions: LINKED_LIST[PROCEDURE[ANY, TUPLE[DO_AS]]]
244    
245 zurfluhs 93194 eiffel_list_pre_actions, eiffel_list_post_actions: LINKED_LIST[PROCEDURE[ANY, TUPLE[EIFFEL_LIST [AST_EIFFEL]]]]
246    
247 zurfluhs 93173 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 zurfluhs 93216 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 zurfluhs 93304 instruction_call_pre_actions, instruction_call_post_actions: LINKED_LIST [PROCEDURE [ANY, TUPLE [INSTR_CALL_AS] ] ]
256    
257 zurfluhs 93216 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 zurfluhs 93168 feature -- Execution Commands
262    
263 zurfluhs 93173 run_on_class (a_class_to_check: CLASS_C)
264 zurfluhs 93168 -- Check all rules that have been added
265 zurfluhs 93173 local
266     l_ast: CLASS_AS
267 zurfluhs 93168 do
268 zurfluhs 93304 last_run_successful := False
269 zurfluhs 93173 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 zurfluhs 93168 last_run_successful := True
274     end
275    
276     feature {NONE} -- Processing
277    
278 zurfluhs 93216 process_access_id_as (a_id: ACCESS_ID_AS)
279 zurfluhs 93168 do
280 zurfluhs 93216 across access_id_pre_actions as l_a loop l_a.item.call ([a_id]) end
281 zurfluhs 93168
282 zurfluhs 93216 Precursor (a_id)
283 zurfluhs 93173
284 zurfluhs 93216 across access_id_post_actions as l_a loop l_a.item.call ([a_id]) end
285 zurfluhs 93168 end
286    
287 zurfluhs 93216 process_assign_as (a_assign: ASSIGN_AS)
288 zurfluhs 93168 do
289 zurfluhs 93216 across assign_pre_actions as l_a loop l_a.item.call ([a_assign]) end
290 zurfluhs 93168
291 zurfluhs 93216 Precursor (a_assign)
292 zurfluhs 93173
293 zurfluhs 93216 across assign_post_actions as l_a loop l_a.item.call ([a_assign]) end
294 zurfluhs 93168 end
295    
296 zurfluhs 93216 process_body_as (a_body: BODY_AS)
297 zurfluhs 93168 do
298 zurfluhs 93216 across body_pre_actions as l_a loop l_a.item.call ([a_body]) end
299 zurfluhs 93168
300 zurfluhs 93216 Precursor (a_body)
301 zurfluhs 93168
302 zurfluhs 93216 across body_post_actions as l_a loop l_a.item.call ([a_body]) end
303 zurfluhs 93168 end
304    
305 zurfluhs 93304 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 zurfluhs 93216 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 zurfluhs 93194 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 zurfluhs 93216 process_feature_as (a_feature: FEATURE_AS)
333 zurfluhs 93168 do
334 zurfluhs 93216 across feature_pre_actions as l_a loop l_a.item.call ([a_feature]) end
335 zurfluhs 93168
336 zurfluhs 93216 Precursor (a_feature)
337 zurfluhs 93173
338 zurfluhs 93216 across feature_post_actions as l_a loop l_a.item.call ([a_feature]) end
339 zurfluhs 93168 end
340    
341 zurfluhs 93216 process_id_as (a_id: ID_AS)
342 zurfluhs 93168 do
343 zurfluhs 93216 across id_pre_actions as l_a loop l_a.item.call ([a_id]) end
344 zurfluhs 93168
345 zurfluhs 93216 Precursor (a_id)
346 zurfluhs 93173
347 zurfluhs 93216 across id_post_actions as l_a loop l_a.item.call ([a_id]) end
348 zurfluhs 93168 end
349    
350 zurfluhs 93216 process_if_as (a_if: IF_AS)
351 zurfluhs 93298 local
352     l_pre_task, l_post_task: CA_VISIT_NODE_TASK
353 zurfluhs 93216 do
354     across if_pre_actions as l_a loop l_a.item.call ([a_if]) end
355 zurfluhs 93298 -- create l_pre_task.make (a_if, if_pre_actions)
356     -- rota.run_task (l_pre_task)
357 zurfluhs 93216
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 zurfluhs 93304 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 zurfluhs 93216 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 zurfluhs 93168 feature -- Results
400    
401     last_run_successful: BOOLEAN
402    
403 zurfluhs 93298 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 zurfluhs 93168 end

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.23