Skip to content

Commit 0ef3541

Browse files
committed
Style and spelling
1 parent 1867fb3 commit 0ef3541

1 file changed

Lines changed: 13 additions & 10 deletions

File tree

codespell.py

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#! /usr/bin/env
1+
#!/usr/bin/env python3
22

33
import sys
44
import os
@@ -104,7 +104,7 @@ def spell_check_file(filename, spell_checker, mimetype='',
104104
if ok_flag:
105105
continue
106106

107-
# Check for possesive words
107+
# Check for possessive words
108108

109109
if error.word.endswith("'s"):
110110
wrd = error.word[:-2]
@@ -191,8 +191,7 @@ def add_dict(enchant_dict, filename):
191191
enchant_dict.add_to_pwl(wrd)
192192

193193

194-
if __name__ == '__main__':
195-
194+
def main():
196195
args = parse_args()
197196
# print(args)
198197

@@ -236,7 +235,7 @@ def add_dict(enchant_dict, filename):
236235
if os.path.isdir(f):
237236

238237
# f is a directory, so search for files inside
239-
dir_entries = glob.glob(f+'/**/*'+args.suffix, recursive=True)
238+
dir_entries = glob.glob(f + '/**/*' + args.suffix, recursive=True)
240239

241240
# spell check the files found in f
242241
for x in dir_entries:
@@ -250,7 +249,7 @@ def add_dict(enchant_dict, filename):
250249
result = spell_check_file(x, spell_checker,
251250
output_lvl=output_lvl,
252251
prefixes=prefixes)
253-
bad_words = sorted(bad_words+result)
252+
bad_words = sorted(bad_words + result)
254253
else:
255254

256255
if exclude_check(f, args.exclude):
@@ -261,7 +260,7 @@ def add_dict(enchant_dict, filename):
261260
result = spell_check_file(f, spell_checker,
262261
output_lvl=output_lvl, prefixes=prefixes)
263262

264-
bad_words = sorted(bad_words+result)
263+
bad_words = sorted(bad_words + result)
265264

266265
if not args.miss:
267266
print("\nBad words\n")
@@ -271,12 +270,16 @@ def add_dict(enchant_dict, filename):
271270
if x[0] == prev:
272271
sys.stdout.write('.')
273272
continue
274-
print("\n", x[0],": ",x[1], ", ", x[2], sep='')
273+
print("\n", x[0], ": ", x[1], ", ", x[2], sep='')
275274
prev = x[0]
276275

277276
if not args.miss:
278277
print("")
279278

280-
print (len(bad_words), "misspellings found")
281-
279+
print(len(bad_words), "misspellings found")
280+
282281
sys.exit(len(bad_words))
282+
283+
284+
if __name__ == '__main__':
285+
main()

0 commit comments

Comments
 (0)