Skip to content

Commit 9c3e100

Browse files
committed
added possessive check; cleaned up repeated word output
1 parent c5e4105 commit 9c3e100

1 file changed

Lines changed: 16 additions & 1 deletion

File tree

codespell.py

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#! /usr/bin/env
22

3+
import sys
34
import os
45
import glob
56
import argparse
@@ -91,6 +92,13 @@ def spell_check_file(filename, spell_checker, mimetype='',
9192
if ok_flag:
9293
continue
9394

95+
# Check for possesive words
96+
97+
if error.word.endswith("'s"):
98+
wrd = error.word[:-2]
99+
if spell_checker.check(wrd):
100+
continue
101+
94102
if output_lvl > 1:
95103
msg = 'error: ' + '\'' + error.word + '\', ' \
96104
+ 'suggestions: ' + str(spell_checker.suggest())
@@ -241,7 +249,14 @@ def add_dict(enchant_dict, filename):
241249

242250
if not args.miss:
243251
print("\nBad words\n")
252+
253+
prev = ""
244254
for x in bad_words:
245-
print(x[0],": ",x[1], ", ", x[2], sep='')
255+
if x[0] == prev:
256+
sys.stdout.write('.')
257+
continue
258+
print("\n", x[0],": ",x[1], ", ", x[2], sep='')
259+
prev = x[0]
260+
246261
if not args.miss:
247262
print("")

0 commit comments

Comments
 (0)