Skip to content

Commit cb1f847

Browse files
committed
Print errors to STDERR
Also forgot to add ".md" suffix for Markdown.
1 parent 8ebda64 commit cb1f847

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

codespell.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ def getMimeType(filepath):
4545
'.java': 'text/x-java-source',
4646
'.txt': 'text/plain',
4747
'.rst': 'text/plain',
48+
'.md': 'text/plain',
4849
}
4950
name, ext = os.path.splitext(filepath)
5051

@@ -89,7 +90,7 @@ def spell_check_file(filename, spell_checker, mimetype='',
8990
try:
9091
clist = comment_parser.extract_comments(filename, mime=mimetype)
9192
except BaseException:
92-
print("Parser failed, skipping file\n")
93+
print("Parser failed, skipping file", filename)
9394
return []
9495

9596
bad_words = []
@@ -290,7 +291,7 @@ def main():
290291
for s in args.suffix:
291292
dir_entries = dir_entries + glob.glob(f + '/**/*' + s, recursive=True)
292293

293-
if output_lvl:
294+
if output_lvl>0:
294295
print(dir_entries)
295296

296297
# spell check the files found in f
@@ -330,9 +331,9 @@ def main():
330331
bc = 0
331332
for x in bad_words:
332333
if x[0] == prev:
333-
sys.stdout.write('.')
334+
sys.stderr.write('.')
334335
continue
335-
print("\n", x[0], ": ", x[1], ", ", x[2], sep='')
336+
print("\n", x[0], ": ", x[1], ", ", x[2], sep='', file=sys.stderr)
336337
prev = x[0]
337338
bc = bc + 1
338339

0 commit comments

Comments
 (0)