/[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 93173 - (hide annotations)
Fri Oct 25 16:09:21 2013 UTC (6 years, 2 months ago) by zurfluhs
File size: 6330 byte(s)
Code Analysis:

- framework redesign (to be continued)
- rule violation output now sorted by class and location
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     export
13     {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_feature_as,
35     process_id_as
36     -- ...
37     end
38    
39     create
40     make
41    
42     feature {NONE} -- Initialization
43     make
44     do
45 zurfluhs 93173 -- create rule_checkers.make
46 zurfluhs 93168 last_run_successful := False
47 zurfluhs 93173 -- create last_result.make (100) -- TODO: check initial capacity
48    
49     create_action_lists
50 zurfluhs 93168 end
51    
52 zurfluhs 93173 create_action_lists
53     do
54     create access_id_pre_actions.make
55     create access_id_post_actions.make
56     create assign_pre_actions.make
57     create assign_post_actions.make
58     create body_pre_actions.make
59     create body_post_actions.make
60     create class_pre_actions.make
61     create class_post_actions.make
62     create feature_pre_actions.make
63     create feature_post_actions.make
64     create id_pre_actions.make
65     create id_post_actions.make
66     end
67    
68 zurfluhs 93168 feature -- Options For Execution
69    
70 zurfluhs 93173 -- add_rule_checker (a_rule_checker: CA_RULE_CHECKER)
71     -- do
72     -- rule_checkers.extend (a_rule_checker)
73     -- end
74    
75     -- remove_all_rule_checkers
76     -- do
77     -- rule_checkers.wipe_out
78     -- ensure
79     -- rule_checkers.is_empty
80     -- end
81    
82     feature {CA_RULE}
83    
84     add_access_id_pre_action (a_action: PROCEDURE[ANY, TUPLE[ACCESS_ID_AS]])
85 zurfluhs 93168 do
86 zurfluhs 93173 access_id_pre_actions.extend (a_action)
87 zurfluhs 93168 end
88    
89 zurfluhs 93173 add_access_id_post_action (a_action: PROCEDURE[ANY, TUPLE[ACCESS_ID_AS]])
90 zurfluhs 93168 do
91 zurfluhs 93173 access_id_post_actions.extend (a_action)
92 zurfluhs 93168 end
93    
94 zurfluhs 93173 add_assign_pre_action (a_action: PROCEDURE[ANY, TUPLE[ASSIGN_AS]])
95 zurfluhs 93168 do
96 zurfluhs 93173 assign_pre_actions.extend (a_action)
97 zurfluhs 93168 end
98    
99 zurfluhs 93173 add_assign_post_action (a_action: PROCEDURE[ANY, TUPLE[ASSIGN_AS]])
100     do
101     assign_post_actions.extend (a_action)
102     end
103    
104     add_body_pre_action (a_action: PROCEDURE[ANY, TUPLE[BODY_AS]])
105     do
106     body_pre_actions.extend (a_action)
107     end
108    
109     add_body_post_action (a_action: PROCEDURE[ANY, TUPLE[BODY_AS]])
110     do
111     body_post_actions.extend (a_action)
112     end
113    
114     add_class_pre_action (a_action: PROCEDURE[ANY, TUPLE[CLASS_AS]])
115     do
116     class_pre_actions.extend (a_action)
117     end
118    
119     add_class_post_action (a_action: PROCEDURE[ANY, TUPLE[CLASS_AS]])
120     do
121     class_post_actions.extend (a_action)
122     end
123    
124     add_feature_pre_action (a_action: PROCEDURE[ANY, TUPLE[FEATURE_AS]])
125     do
126     feature_pre_actions.extend (a_action)
127     end
128    
129     add_feature_post_action (a_action: PROCEDURE[ANY, TUPLE[FEATURE_AS]])
130     do
131     feature_post_actions.extend (a_action)
132     end
133    
134     add_id_pre_action (a_action: PROCEDURE[ANY, TUPLE[ID_AS]])
135     do
136     id_pre_actions.extend (a_action)
137     end
138    
139     add_id_post_action (a_action: PROCEDURE[ANY, TUPLE[ID_AS]])
140     do
141     id_post_actions.extend (a_action)
142     end
143    
144     feature {NONE} -- Agent lists
145    
146     access_id_pre_actions, access_id_post_actions: LINKED_LIST[PROCEDURE[ANY, TUPLE[ACCESS_ID_AS]]]
147    
148     assign_pre_actions, assign_post_actions: LINKED_LIST[PROCEDURE[ANY, TUPLE[ASSIGN_AS]]]
149    
150     body_pre_actions, body_post_actions: LINKED_LIST[PROCEDURE[ANY, TUPLE[BODY_AS]]]
151    
152     class_pre_actions, class_post_actions: LINKED_LIST[PROCEDURE[ANY, TUPLE[CLASS_AS]]]
153    
154     feature_pre_actions, feature_post_actions: LINKED_LIST[PROCEDURE[ANY, TUPLE[FEATURE_AS]]]
155    
156     id_pre_actions, id_post_actions: LINKED_LIST[PROCEDURE[ANY, TUPLE[ID_AS]]]
157    
158 zurfluhs 93168 feature -- Execution Commands
159    
160 zurfluhs 93173 run_on_class (a_class_to_check: CLASS_C)
161 zurfluhs 93168 -- Check all rules that have been added
162 zurfluhs 93173 local
163     l_ast: CLASS_AS
164 zurfluhs 93168 do
165 zurfluhs 93173 -- across rule_checkers as l_checkers loop
166     -- l_checkers.item.clear_results
167     -- l_checkers.item.process_class (a_class_to_check)
168     -- end
169     l_ast := a_class_to_check.ast
170     across class_pre_actions as l_a loop l_a.item.call ([l_ast]) end
171     process_class_as (l_ast)
172     across class_post_actions as l_a loop l_a.item.call ([l_ast]) end
173     -- across rule_checkers as l_checkers loop
174     -- across l_checkers.item.results as l_rule_results loop
175     -- last_result.extend (l_rule_results.item)
176     -- end
177     -- end
178 zurfluhs 93168 last_run_successful := True
179     end
180    
181     feature {NONE} -- Processing
182    
183     process_access_id_as (l_as: ACCESS_ID_AS)
184     do
185 zurfluhs 93173 -- across rule_checkers as l_checkers loop
186     -- l_checkers.item.process_access_id (l_as)
187     -- end
188     across access_id_pre_actions as l_a loop l_a.item.call ([l_as]) end
189 zurfluhs 93168
190     Precursor (l_as)
191 zurfluhs 93173
192     across access_id_post_actions as l_a loop l_a.item.call ([l_as]) end
193 zurfluhs 93168 end
194    
195     process_assign_as (l_as: ASSIGN_AS)
196     do
197 zurfluhs 93173 -- across rule_checkers as l_checkers loop
198     -- l_checkers.item.process_assignment (l_as)
199     -- end
200     across assign_pre_actions as l_a loop l_a.item.call ([l_as]) end
201 zurfluhs 93168
202     Precursor (l_as)
203 zurfluhs 93173
204     across assign_post_actions as l_a loop l_a.item.call ([l_as]) end
205 zurfluhs 93168 end
206    
207     process_body_as (l_as: BODY_AS)
208     do
209 zurfluhs 93173 -- across rule_checkers as l_checkers loop
210     -- l_checkers.item.process_body (l_as)
211     -- end
212     across body_pre_actions as l_a loop l_a.item.call ([l_as]) end
213 zurfluhs 93168
214     Precursor (l_as)
215    
216 zurfluhs 93173 across body_post_actions as l_a loop l_a.item.call ([l_as]) end
217     -- across rule_checkers as l_checkers loop
218     -- l_checkers.item.process_body_end
219     -- end
220 zurfluhs 93168 end
221    
222     process_feature_as (l_as: FEATURE_AS)
223     do
224 zurfluhs 93173 -- across rule_checkers as l_checkers loop
225     -- l_checkers.item.process_feature (l_as)
226     -- end
227     across feature_pre_actions as l_a loop l_a.item.call ([l_as]) end
228 zurfluhs 93168
229     Precursor (l_as)
230 zurfluhs 93173
231     across feature_post_actions as l_a loop l_a.item.call ([l_as]) end
232 zurfluhs 93168 end
233    
234     process_id_as (l_as: ID_AS)
235     do
236 zurfluhs 93173 -- across rule_checkers as l_checkers loop
237     -- l_checkers.item.process_id (l_as)
238     -- end
239     across id_pre_actions as l_a loop l_a.item.call ([l_as]) end
240 zurfluhs 93168
241     Precursor (l_as)
242 zurfluhs 93173
243     across id_post_actions as l_a loop l_a.item.call ([l_as]) end
244 zurfluhs 93168 end
245    
246     feature -- Results
247    
248     last_run_successful: BOOLEAN
249    
250 zurfluhs 93173 -- last_result: HASH_TABLE[LINKED_LIST[CA_RULE_VIOLATION], CLASS_C]
251 zurfluhs 93168
252     feature -- Rule Checkers
253    
254 zurfluhs 93173 -- rule_checkers: LINKED_LIST[CA_RULE_CHECKER]
255 zurfluhs 93168
256 zurfluhs 93173 --invariant
257     -- rule_checkers_list_exists: rule_checkers /= Void
258 zurfluhs 93168 end

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.23