Print this page
10057 Man page misspellings ouput particuliar overriden
Reviewed by: Gergő Mihály Doma <domag02@gmail.com>
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/tools/onbld/Checks/SpellCheck.py
+++ new/usr/src/tools/onbld/Checks/SpellCheck.py
1 1 #
2 2 # CDDL HEADER START
3 3 #
4 4 # The contents of this file are subject to the terms of the
5 5 # Common Development and Distribution License (the "License").
6 6 # You may not use this file except in compliance with the License.
7 7 #
8 8 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 9 # or http://www.opensolaris.org/os/licensing.
10 10 # See the License for the specific language governing permissions
11 11 # and limitations under the License.
12 12 #
13 13 # When distributing Covered Code, include this CDDL HEADER in each
14 14 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 15 # If applicable, add the following below this CDDL HEADER, with the
16 16 # fields enclosed by brackets "[]" replaced with your own identifying
17 17 # information: Portions Copyright [yyyy] [name of copyright owner]
18 18 #
19 19 # CDDL HEADER END
20 20 #
21 21
22 22 #
23 23 # Copyright 2016 Joyent, Inc.
24 24 #
25 25
26 26 import re, sys
27 27
28 28 spellMsg = '%s: Line %d contains "%s", a common misspelling of "%s"\n'
29 29 altMsg = '%s: Line %d contains "%s"; please use "%s" instead for consistency with other documentation\n'
30 30
31 31 misspellings = {
32 32 'absense': 'absence',
33 33 'accessable': 'accessible',
34 34 'accomodate': 'accommodate',
35 35 'accomodation': 'accommodation',
36 36 'accross': 'across',
37 37 'acheive': 'achieve',
38 38 'addional': 'additional',
39 39 'addres': 'address',
40 40 'admininistrative': 'administrative',
41 41 'adminstered': 'administered',
42 42 'adminstrate': 'administrate',
43 43 'adminstration': 'administration',
44 44 'adminstrative': 'administrative',
45 45 'adminstrator': 'administrator',
46 46 'admissability': 'admissibility',
47 47 'adress': 'address',
48 48 'adressable': 'addressable',
49 49 'adressed': 'addressed',
50 50 'adressing': 'addressing, dressing',
51 51 'aginst': 'against',
52 52 'agression': 'aggression',
53 53 'agressive': 'aggressive',
54 54 'alot': 'a lot, allot',
55 55 'and and': 'and',
56 56 'apparantly': 'apparently',
57 57 'appearence': 'appearance',
58 58 'arguement': 'argument',
59 59 'assasination': 'assassination',
60 60 'auxilliary': 'auxiliary',
61 61 'basicly': 'basically',
62 62 'begining': 'beginning',
63 63 'belive': 'believe',
64 64 'beteen': 'between',
65 65 'betwen': 'between',
66 66 'beween': 'between',
67 67 'bewteen': 'between',
68 68 'bizzare': 'bizarre',
69 69 'buisness': 'business',
70 70 'calender': 'calendar',
71 71 'cemetary': 'cemetery',
72 72 'chauffer': 'chauffeur',
73 73 'collegue': 'colleague',
74 74 'comming': 'coming',
75 75 'commited': 'committed',
76 76 'commitee': 'committee',
77 77 'commiting': 'committing',
78 78 'comparision': 'comparison',
79 79 'comparisions': 'comparisons',
80 80 'compatability': 'compatibility',
81 81 'compatable': 'compatible',
82 82 'compatablity': 'compatibility',
83 83 'compatiable': 'compatible',
84 84 'compatiblity': 'compatibility',
85 85 'completly': 'completely',
86 86 'concious': 'conscious',
87 87 'condidtion': 'condition',
88 88 'conected': 'connected',
89 89 'conjuction': 'conjunction',
90 90 'continous': 'continuous',
91 91 'curiousity': 'curiosity',
92 92 'deamon': 'daemon',
93 93 'definately': 'definitely',
94 94 'desireable': 'desirable',
95 95 'diffrent': 'different',
96 96 'dilemna': 'dilemma',
97 97 'dissapear': 'disappear',
98 98 'dissapoint': 'disappoint',
99 99 'ecstacy': 'ecstasy',
100 100 'embarass': 'embarrass',
101 101 'enviroment': 'environment',
102 102 'exept': 'except',
103 103 'existance': 'existence',
104 104 'familar': 'familiar',
105 105 'finaly': 'finally',
106 106 'folowing': 'following',
107 107 'foriegn': 'foreign',
108 108 'forseeable': 'foreseeable',
109 109 'fourty': 'forty',
110 110 'foward': 'forward',
111 111 'freind': 'friend',
112 112 'futher': 'further',
113 113 'gaurd': 'guard',
114 114 'glamourous': 'glamorous',
115 115 'goverment': 'government',
116 116 'happend': 'happened',
117 117 'harrassment': 'harassment',
118 118 'hierachical': 'hierarchical',
119 119 'hierachies': 'hierarchies',
120 120 'hierachy': 'hierarchy',
121 121 'hierarcical': 'hierarchical',
122 122 'hierarcy': 'hierarchy',
123 123 'honourary': 'honorary',
124 124 'humourous': 'humorous',
125 125 'idiosyncracy': 'idiosyncrasy',
126 126 'immediatly': 'immediately',
127 127 'inaccessable': 'inaccessible',
128 128 'inbetween': 'between',
129 129 'incidently': 'incidentally',
130 130 'independant': 'independent',
131 131 'infomation': 'information',
132 132 'interupt': 'interrupt',
133 133 'intial': 'initial',
134 134 'intially': 'initially',
135 135 'irresistable': 'irresistible',
136 136 'jist': 'gist',
137 137 'knowlege': 'knowledge',
138 138 'lenght': 'length',
139 139 'liase': 'liaise',
140 140 'liason': 'liaison',
141 141 'libary': 'library',
142 142 'maching': 'machine, marching, matching',
143 143 'millenia': 'millennia',
144 144 'millenium': 'millennium',
145 145 'neccessary': 'necessary',
146 146 'negotation': 'negotiation',
147 147 'nontheless': 'nonetheless',
148 148 'noticable': 'noticeable',
↓ open down ↓ |
148 lines elided |
↑ open up ↑ |
149 149 'occassion': 'occasion',
150 150 'occassional': 'occasional',
151 151 'occassionally': 'occasionally',
152 152 'occurance': 'occurrence',
153 153 'occured': 'occurred',
154 154 'occurence': 'occurrence',
155 155 'occuring': 'occurring',
156 156 'ommision': 'omission',
157 157 'orginal': 'original',
158 158 'orginally': 'originally',
159 + 'ouput': 'output',
160 + 'overriden': 'overridden',
161 + 'particuliar': 'particular',
159 162 'pavillion': 'pavilion',
160 163 'peice': 'piece',
161 164 'persistant': 'persistent',
162 165 'politican': 'politician',
163 166 'posession': 'possession',
164 167 'possiblity': 'possibility',
165 168 'preceed': 'precede',
166 169 'preceeded': 'preceded',
167 170 'preceeding': 'preceding',
168 171 'preceeds': 'precedes',
169 172 'prefered': 'preferred',
170 173 'prefering': 'preferring',
171 174 'presense': 'presence',
172 175 'proces': 'process',
173 176 'propoganda': 'propaganda',
174 177 'psuedo': 'pseudo',
175 178 'publically': 'publicly',
176 179 'realy': 'really',
177 180 'reciept': 'receipt',
178 181 'recieve': 'receive',
179 182 'recieved': 'received',
180 183 'reciever': 'receiver',
181 184 'recievers': 'receivers',
182 185 'recieves': 'receives',
183 186 'recieving': 'receiving',
184 187 'recomend': 'recommend',
185 188 'recomended': 'recommended',
186 189 'recomending': 'recommending',
187 190 'recomends': 'recommends',
188 191 'recurse': 'recur',
189 192 'recurses': 'recurs',
190 193 'recursing': 'recurring',
191 194 'refered': 'referred',
192 195 'refering': 'referring',
193 196 'religous': 'religious',
194 197 'rember': 'remember',
195 198 'remeber': 'remember',
196 199 'repetion': 'repetition',
197 200 'reponsible': 'responsible',
198 201 'resistence': 'resistance',
199 202 'retreive': 'retrieve',
200 203 'seige': 'siege',
201 204 'sence': 'since',
202 205 'seperate': 'separate',
203 206 'seperated': 'separated',
204 207 'seperately': 'separately',
205 208 'seperates': 'separates',
206 209 'similiar': 'similar',
207 210 'somwhere': 'somewhere',
208 211 'sould': 'could, should, sold, soul',
209 212 'sturcture': 'structure',
210 213 'succesful': 'successful',
211 214 'succesfully': 'successfully',
212 215 'successfull': 'successful',
213 216 'sucessful': 'successful',
214 217 'supercede': 'supersede',
215 218 'supress': 'suppress',
216 219 'supressed': 'suppressed',
217 220 'suprise': 'surprise',
218 221 'suprisingly': 'surprisingly',
219 222 'sytem': 'system',
220 223 'tendancy': 'tendency',
221 224 'the the': 'the',
222 225 'the these': 'these',
223 226 'therefor': 'therefore',
224 227 'threshhold': 'threshold',
225 228 'tolerence': 'tolerance',
226 229 'tommorow': 'tomorrow',
227 230 'tommorrow': 'tomorrow',
228 231 'tounge': 'tongue',
229 232 'tranformed': 'transformed',
230 233 'transfered': 'transferred',
231 234 'truely': 'truly',
232 235 'trustworthyness': 'trustworthiness',
233 236 'uncommited': 'uncommitted',
234 237 'unforseen': 'unforeseen',
235 238 'unfortunatly': 'unfortunately',
236 239 'unsuccessfull': 'unsuccessful',
237 240 'untill': 'until',
238 241 'upto': 'up to',
239 242 'whereever': 'wherever',
240 243 'wich': 'which',
241 244 'wierd': 'weird',
242 245 'wtih': 'with',
243 246 }
244 247
245 248 alternates = {
246 249 'parseable': 'parsable',
247 250 'sub-command': 'subcommand',
248 251 'sub-commands': 'subcommands',
249 252 'writeable': 'writable'
250 253 }
251 254
252 255 misspellingREs = []
253 256 alternateREs = []
254 257
255 258 for misspelling, correct in misspellings.iteritems():
256 259 regex = re.compile(r'\b%s\b' % (misspelling), re.IGNORECASE)
257 260 entry = (regex, misspelling, correct)
258 261 misspellingREs.append(entry)
259 262
260 263 for alternate, correct in alternates.iteritems():
261 264 regex = re.compile(r'\b%s\b' % (alternate), re.IGNORECASE)
262 265 entry = (regex, alternate, correct)
263 266 alternateREs.append(entry)
264 267
265 268 def check(errmsg, output, filename, line, lineno, entry):
266 269 if entry[0].search(line):
267 270 output.write(errmsg % (filename, lineno, entry[1], entry[2]))
268 271 return 1
269 272 else:
270 273 return 0
271 274
272 275 def spellcheck(fh, filename=None, output=sys.stderr, **opts):
273 276 lineno = 1
274 277 ret = 0
275 278
276 279 if not filename:
277 280 filename = fh.name
278 281
279 282 fh.seek(0)
280 283 for line in fh:
281 284 for entry in misspellingREs:
282 285 ret |= check(spellMsg, output, filename, line,
283 286 lineno, entry)
284 287 for entry in alternateREs:
285 288 ret |= check(altMsg, output, filename, line,
286 289 lineno, entry)
287 290 lineno += 1
288 291
289 292 return ret
↓ open down ↓ |
121 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX