Coverage for limitys/rule_if.py: 0.00%
16 statements
« prev ^ index » next coverage.py v7.4.1, created at 2024-02-04 20:06:37 +00:00
« prev ^ index » next coverage.py v7.4.1, created at 2024-02-04 20:06:37 +00:00
1MAGIC_PAD = 13
3ENV_KEY_SPLIT_WORDS = ('shall', 'must', 'will', 'should', 'can', 'may', 'has')
4ENV_KEY_STOP_WORDS_LIST = [
5 'a',
6 'after',
7 'and',
8 'be',
9 'before',
10 'by',
11 'exact',
12 'exactly',
13 'in',
14 'may',
15 'on',
16 'of',
17 'off',
18 'only',
19 'or',
20 'select',
21 'selecting',
22 'shall',
23 'the',
24]
25ENV_KEY_STOP_WORDS = tuple(sorted(ENV_KEY_STOP_WORDS_LIST + list(ENV_KEY_SPLIT_WORDS)))
27ENV_KEY_SPECULATION_WORDS = (
28 'familiar',
29 'generally',
30 'normally',
31 'often',
32 'rarely',
33 'sufficiently',
34 'traditional',
35 'typically',
36 'usually',
37)
39ENV_KEY_RE_AMBIGUOUS_WORDS = ('or', 'unless')
41ENV_KEY_LINGUISTIC_AMBIGUOUS_WORDS = ('for',)
43ENV_KEY_PRECEDENCE_AMBIGUOUS_COMBINATION_WORDS = (
44 'a',
45 'all',
46 'each',
47 'every',
48 'most',
49 'several',
50 'some',
51 'the',
52)
54ENV_KEY_ELLIPSIS_AMBIGUOUS_WORDS = ('if,', 'not,')
56ENV_KEY_MULTIPLE_INDICATOR_WORDS = ('also', 'and', 'or', 'with')
58ENV_KEY_VAGUE_WORDS = ( # TODO(sthagen) no stemming so brittle detection expected
59 'adequate',
60 'although',
61 'ancillary',
62 'appropriate',
63 'approximately',
64 'as appropriate',
65 'as possible',
66 'as required',
67 'but',
68 'common',
69 'customary',
70 'effective',
71 'efficient',
72 'except',
73 'expandable',
74 'extent necessary',
75 'extent practical',
76 'fast',
77 'flexible',
78 'flexible',
79 'friendly',
80 'generic',
81 'if necessary',
82 'if needed',
83 'if practicable',
84 'if required',
85 'if so needed',
86 'if so required',
87 'is possible',
88 'it',
89 'possible',
90 'proficient',
91 'prove necessary',
92 'readable',
93 'reasonable',
94 'relevant',
95 'robust',
96 'routine',
97 'significant',
98 'soon',
99 'sufficient',
100 'they',
101 'typical',
102 'unless',
103 'versatile',
104 'when',
105 'where possible',
106)
108ENV_KEY_PROBABILITY_WORDS = (
109 'could',
110 'may',
111 'might',
112 'ought',
113 'perhaps',
114 'probably',
115 'should',
116 'has',
117)
119ENV_KEY_WISHFUL_WORDS = (
120 '0%',
121 '100%',
122 'all',
123 'always',
124 'future',
125 'never',
126 'safe',
127 'secure',
128 'hide',
129 'cover',
130 'consider',
131 'considered',
132 'consideration',
133 'invisible',
134 'entire',
135 'allow', # TODO(shagen) in part wishful and in part soft compliance
136)
138ENV_KEY_USELESS_DILUTION_PHRASES = ('be able to', 'be capable of', 'the capability to')
140ISSUE_KINDS: dict[str, tuple[str, ...]] = {
141 'speculation': ENV_KEY_SPECULATION_WORDS,
142 'requirements engineering specific ambiguity': ENV_KEY_RE_AMBIGUOUS_WORDS,
143 'linguistic ambiguity': ENV_KEY_LINGUISTIC_AMBIGUOUS_WORDS,
144 'precedence ambiguity upon multiple occurrence': ENV_KEY_PRECEDENCE_AMBIGUOUS_COMBINATION_WORDS,
145 'ellipsis ambiguity': ENV_KEY_ELLIPSIS_AMBIGUOUS_WORDS,
146 'multiple requirements': ENV_KEY_MULTIPLE_INDICATOR_WORDS,
147 'vagueness': ENV_KEY_VAGUE_WORDS,
148 'probability': ENV_KEY_PROBABILITY_WORDS,
149 'wishful thinking': ENV_KEY_WISHFUL_WORDS,
150 'useless dilution': ENV_KEY_USELESS_DILUTION_PHRASES,
151}
153MOTIVATION = {
154 'speculation': 'Words like (usually), (generally), (often), (normally), and (typically) indicate speculation.',
155 'requirements engineering specific ambiguity': (
156 'An requirements engineering (RE) specific ambiguity is context dependent and can be observed only by a'
157 ' reader who has knowledge of the particular requirements context or of the other requirements.'
158 ),
159 'linguistic ambiguity': (
160 'Linguistic ambiguity is context independent and can be observed by any reader who has a tone for language.'
161 ),
162 'precedence ambiguity upon multiple occurrence': (
163 'Scope ambiguity occurs when quantifiers, e.g., (every), (each), (all), (some), (several), (a),'
164 ' and negations, e.g., (not), enter into different scope relations with the other scoped parts'
165 ' of the requirements sentence. In other words, the ambiguity lies in the precedence of these operators.'
166 ' Quantifiers are discussed in more detail in references.'
167 ),
168 'ellipsis ambiguity': (
169 'Sample: If the ATM accepts the card, the user enters the PIN. If not, the card is rejected.'
170 ' The word not is here an elliptical expression that refers either to the condition specified in the previous'
171 ' sentence or to something written before.'
172 ),
173 'multiple requirements': (
174 'Conjunctions like (and), (or), (with), and (also) lead to ambiguity on which parts of the requirement apply,'
175 ' especially if the different clauses seem to conflict or if the individual parts apply separately.'
176 ),
177 'vagueness': (
178 'Words and terms like (user-friendly), (wersatile), (flexible), approximately), and (as possible) indicate'
179 ' vagueness. Words like (if), (when), (but), (except), (unless), and (although) may indicate escape routes'
180 ' for implementations not fulfilling the requirement.'
181 ),
182 'probability': (
183 'Words like (may), (might), (should), (ought), (could), (perhaps), and (probably) indicate expression of'
184 ' possibilities (only).'
185 ),
186 'wishful thinking': (
187 'Indicator terms indicating wishful thinking are (100%% reliable), (safe), (handle all unexpected failures),'
188 ' (please all users), (run on all platforms), (never fail), and (upgradeable to all future situations)'
189 ' just to name a few.'
190 ),
191 'useless dilution': (
192 'Indicator phrases best left out as they often block any verification are (be able to) and (be capable of).'
193 ),
194}