/[eiffelstudio]/branches/eth/eve/Src/framework/code_analysis/rules/ca_cq_separation_rule.e
ViewVC logotype

Annotation of /branches/eth/eve/Src/framework/code_analysis/rules/ca_cq_separation_rule.e

Parent Directory Parent Directory | Revision Log Revision Log


Revision 93426 - (hide annotations)
Tue Nov 19 08:45:14 2013 UTC (6 years, 2 months ago) by zurfluhs
File size: 3248 byte(s)
Code Analysis: GUI:

- analysis options in class indexing clauses
  - rules that ignore class
  - library / nonlibrary classes
1 zurfluhs 93194 note
2     description: "Summary description for {CA_CQ_SEPARATION_RULE}."
3     author: ""
4     date: "$Date$"
5     revision: "$Revision$"
6    
7     class
8     CA_CQ_SEPARATION_RULE
9    
10     inherit
11     CA_STANDARD_RULE
12 zurfluhs 93426 redefine
13     id
14     end
15 zurfluhs 93194
16     create
17     make
18    
19     feature {NONE} -- Initialization
20    
21     make
22     do
23     is_enabled := True
24     create {CA_WARNING} severity
25     create violations.make
26     end
27    
28     feature {NONE} -- Activation
29    
30     register_actions (a_checker: CA_ALL_RULES_CHECKER)
31     do
32 zurfluhs 93304 a_checker.add_feature_pre_action (agent pre_process_feature)
33     a_checker.add_feature_post_action (agent post_process_feature)
34 zurfluhs 93300
35 zurfluhs 93304 a_checker.add_assign_pre_action (agent process_assign)
36     a_checker.add_creation_pre_action (agent process_creation)
37     a_checker.add_instruction_call_pre_action (agent process_instruction_call)
38 zurfluhs 93300 end
39    
40     feature {NONE} -- AST Visits
41    
42 zurfluhs 93304 pre_process_feature (a_feature: FEATURE_AS)
43 zurfluhs 93300 do
44     is_function := a_feature.is_function
45 zurfluhs 93304 rule_violated := False
46 zurfluhs 93300 end
47    
48 zurfluhs 93304 post_process_feature (a_feature: FEATURE_AS)
49     local
50     l_violation: CA_RULE_VIOLATION
51     do
52     if rule_violated then
53     create l_violation.make_with_rule (Current)
54     l_violation.set_location (a_feature.start_location)
55     l_violation.long_description_info.extend (a_feature.feature_name.name_32)
56     violations.extend (l_violation)
57     end
58     end
59 zurfluhs 93300
60 zurfluhs 93304 is_function, rule_violated: BOOLEAN
61    
62 zurfluhs 93300 process_assign (a_assign: ASSIGN_AS)
63     do
64     -- Skip the checks if we are not within a function.
65     if is_function then
66     if attached {ACCESS_ID_AS} a_assign.target as l_access_id then
67     if checking_class.feature_with_id (l_access_id.feature_name) /= Void then
68     -- We have an assignment to an attribute.
69 zurfluhs 93304 rule_violated := True
70 zurfluhs 93300 end
71     end
72 zurfluhs 93194 end
73 zurfluhs 93300 end
74 zurfluhs 93194
75 zurfluhs 93300 process_creation (a_creation: CREATION_AS)
76     do
77     -- Skip the checks if we are not within a function.
78     if is_function then
79     if attached {ACCESS_ID_AS} a_creation.target as l_access_id then
80     if checking_class.feature_with_id (l_access_id.feature_name) /= Void then
81     -- We have a creation of an attribute.
82 zurfluhs 93304 rule_violated := True
83 zurfluhs 93300 end
84     end
85     end
86     end
87 zurfluhs 93194
88 zurfluhs 93300 process_instruction_call (a_call: INSTR_CALL_AS)
89     do
90     -- Skip the checks if we are not within a function.
91     if is_function then
92     if attached {ACCESS_ID_AS} a_call.call as l_access_id then
93     if attached checking_class.feature_with_id (l_access_id.feature_name) as l_feat then
94     if l_feat.is_procedure then
95     -- There is a procedure call within this function.
96 zurfluhs 93304 rule_violated := True
97 zurfluhs 93300 end
98     end
99     end
100     end
101     end
102    
103 zurfluhs 93194 feature -- Properties
104    
105     title: STRING
106 zurfluhs 93299 do
107 zurfluhs 93300 Result := ca_names.cq_separation_title
108 zurfluhs 93194 end
109    
110 zurfluhs 93426 id: STRING = "CA004T"
111     -- "T" stands for 'under test'.
112    
113 zurfluhs 93194 description: STRING
114 zurfluhs 93299 do
115 zurfluhs 93194 Result := "---"
116     end
117    
118 zurfluhs 93216 options: LINKED_LIST[CA_RULE_OPTION[ANY]]
119 zurfluhs 93194 once
120     create Result.make
121     end
122    
123 zurfluhs 93300 is_system_wide: BOOLEAN = False
124 zurfluhs 93194
125     format_violation_description (a_violation: CA_RULE_VIOLATION; a_formatter: TEXT_FORMATTER)
126     do
127 zurfluhs 93304 a_formatter.add_string (ca_messages.cq_separation_violation_1)
128     if attached {STRING_32} a_violation.long_description_info.first as l_feature_name then
129     a_formatter.add_feature_name (l_feature_name, a_violation.affected_class)
130     end
131     a_formatter.add_string (ca_messages.cq_separation_violation_2)
132 zurfluhs 93194 end
133     end

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.23