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

Contents of /branches/eth/eve/Src/framework/code_analysis/rules/ca_feature_never_called_rule.e

Parent Directory Parent Directory | Revision Log Revision Log


Revision 93426 - (show annotations)
Tue Nov 19 08:45:14 2013 UTC (6 years ago) by zurfluhs
File size: 2305 byte(s)
Code Analysis: GUI:

- analysis options in class indexing clauses
  - rules that ignore class
  - library / nonlibrary classes
1 note
2 description: "Summary description for {CA_FEATURE_NEVER_CALLED_RULE}."
3 author: ""
4 date: "$Date$"
5 revision: "$Revision$"
6
7 class
8 CA_FEATURE_NEVER_CALLED_RULE
9
10 inherit
11 CA_STANDARD_RULE
12 redefine
13 checks_library_classes, id
14 end
15
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 a_checker.add_class_pre_action (agent class_check)
33 end
34
35 feature {NONE} -- Feature Visitor for Violation Check
36
37 class_check (a_class: CLASS_AS)
38 local
39 l_feat: LIST [E_FEATURE]
40 l_clients: ARRAYED_LIST [CLASS_C]
41 has_callers: BOOLEAN
42 do
43 l_feat := checking_class.written_in_features
44 l_clients := checking_class.clients
45
46 from
47 l_feat.start
48 until
49 l_feat.after
50 loop
51 from
52 has_callers := False
53 l_clients.start
54 until
55 has_callers or l_clients.after
56 loop
57 if l_feat.item.callers_32 (l_clients.item, 0) /= Void then
58 has_callers := True
59 end
60 l_clients.forth
61 end
62
63 if not has_callers then
64 create_violation (l_feat.item)
65 end
66
67 l_feat.forth
68 end
69 end
70
71 create_violation (a_feature: E_FEATURE)
72 local
73 l_violation: CA_RULE_VIOLATION
74 do
75 create l_violation.make_with_rule (Current)
76 l_violation.set_location (a_feature.ast.start_location)
77 l_violation.long_description_info.extend (a_feature.name_32)
78 violations.extend (l_violation)
79 end
80
81 feature -- Properties
82
83 title: STRING
84 do
85 Result := ca_names.feature_never_called_title
86 end
87
88 id: STRING = "CA003T"
89 -- "T" stands for 'under test'.
90
91 description: STRING
92 do
93 Result := "---"
94 end
95
96 options: LINKED_LIST[CA_RULE_OPTION[ANY]]
97 once
98 create Result.make
99 end
100
101
102 is_system_wide: BOOLEAN = True
103
104 checks_library_classes: BOOLEAN = False
105
106 format_violation_description (a_violation: CA_RULE_VIOLATION; a_formatter: TEXT_FORMATTER)
107 do
108 a_formatter.add_string (ca_messages.feature_never_called_violation_1)
109 if attached {STRING_32} a_violation.long_description_info.first as l_feat_name then
110 a_formatter.add_feature_name (l_feat_name, a_violation.affected_class)
111 end
112 a_formatter.add_string (ca_messages.feature_never_called_violation_2)
113 end
114
115 end

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.23