Skip to content

Commit f80c9b9

Browse files
authored
Merge branch 'main' into PythonBackend
2 parents 0713ac9 + dab4e11 commit f80c9b9

File tree

3 files changed

+15
-0
lines changed

3 files changed

+15
-0
lines changed

comment_spell_check/comment_spell_check.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020

2121
"""spell check the comments in code."""
2222

23+
2324
import sys
2425
import os
2526
import fnmatch
@@ -45,6 +46,7 @@
4546
from comment_spell_check.utils import create_checker # noqa: E402
4647
from comment_spell_check.utils import url_remove # noqa: E402
4748

49+
4850
__version__ = "unknown"
4951

5052
try:
@@ -238,6 +240,7 @@ def spell_check_comment(
238240
continue
239241

240242
msg = f"'{error_word}', " + f"suggestions: {spell.candidates(error_word)}"
243+
241244
mistakes.append(msg)
242245

243246
return mistakes
@@ -248,6 +251,7 @@ def spell_check_file(
248251
spell_checker: SpellChecker,
249252
mime_type: str = "",
250253
prefixes=None,
254+
251255
):
252256
"""Check spelling in ``filename``."""
253257

@@ -265,6 +269,7 @@ def spell_check_file(
265269
clist = comment_parser.extract_comments(filename, mime=mime_type)
266270
except TypeError:
267271
logger.error("Parser failed, skipping file %s", filename)
272+
268273
return []
269274

270275
bad_words = []
@@ -275,6 +280,7 @@ def spell_check_file(
275280
if len(mistakes) > 0:
276281
logger.info("\nLine number %s", c.line_number())
277282
logger.info(c.text())
283+
278284
for m in mistakes:
279285
logger.info(" %s", m)
280286
bad_words.append([m, filename, c.line_number()])
@@ -365,6 +371,7 @@ def output_results(args, bad_words):
365371
if args.vim:
366372
print(f"vim +{line_num} {found_file}", file=sys.stderr)
367373
else:
374+
368375
print(
369376
f"file: {found_file:30} line: {line_num:3d} word: {misspelled_word}",
370377
file=sys.stderr,
@@ -393,6 +400,7 @@ def setup_logger(args):
393400
if level in (logging.INFO, logging.DEBUG):
394401
# info and debug messages will be printed to the console
395402

403+
396404
# Create a console handler
397405
ch = logging.StreamHandler()
398406
ch.setLevel(level)
@@ -411,6 +419,7 @@ def setup_logger(args):
411419
return logger
412420

413421

422+
414423
def comment_spell_check(args):
415424
"""comment_spell_check main function."""
416425
logger = setup_logger(args)

comment_spell_check/lib/bibtex_loader.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
""" Load Bibtex files into a spell checking dictionary. """
2+
13
import bibtexparser
24

35

tests/test_comment_spell_check.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ def test_basic(self):
3737
sys.executable,
3838
"comment_spell_check.py",
3939
"--miss",
40+
4041
"--dict",
4142
"../tests/dict.txt",
4243
"--prefix",
@@ -53,6 +54,7 @@ def test_codebase(self):
5354
runresult = subprocess.run(
5455
[
5556
sys.executable,
57+
5658
"comment_spell_check.py",
5759
"--verbose",
5860
"--prefix",
@@ -73,6 +75,7 @@ def test_version(self):
7375
runresult = subprocess.run(
7476
[
7577
sys.executable,
78+
7679
"comment_spell_check.py",
7780
"--version",
7881
],
@@ -92,6 +95,7 @@ def test_bibtex(self):
9295
[
9396
sys.executable,
9497
"comment_spell_check.py",
98+
9599
"--bibtex",
96100
"../tests/itk.bib",
97101
"../tests/bibtest.py",

0 commit comments

Comments
 (0)