mirror of
https://github.com/codespell-project/codespell.git
synced 2025-08-06 09:40:56 +08:00
Addressing comments
This commit is contained in:
@ -671,7 +671,7 @@ def main(*args):
|
||||
try:
|
||||
word_regex = re.compile(word_regex)
|
||||
except re.error as err:
|
||||
print("ERROR: invalid regular expression \"%s\" (%s)" %
|
||||
print("ERROR: invalid --regex \"%s\" (%s)" %
|
||||
(word_regex, err), file=sys.stderr)
|
||||
parser.print_help()
|
||||
return EX_USAGE
|
||||
@ -680,7 +680,7 @@ def main(*args):
|
||||
try:
|
||||
ignore_word_regex = re.compile(options.ignore_regex)
|
||||
except re.error as err:
|
||||
print("ERROR: invalid regular expression \"%s\" (%s)" %
|
||||
print("ERROR: invalid --ignore-regex \"%s\" (%s)" %
|
||||
(options.ignore_regex, err), file=sys.stderr)
|
||||
parser.print_help()
|
||||
return EX_USAGE
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
from __future__ import print_function
|
||||
|
||||
import argparse
|
||||
import contextlib
|
||||
import inspect
|
||||
import os
|
||||
@ -466,6 +467,8 @@ def test_ignore_regex_flag(tmpdir, capsys):
|
||||
|
||||
with open(op.join(d, 'flag.txt'), 'w') as f:
|
||||
f.write('# Please see http://example.com/abandonned for info\n')
|
||||
# Test file has 1 invalid entry, and it's not ignored by default.
|
||||
assert cs.main(f.name) == 1
|
||||
# Non-matching regex results in nothing being ignored.
|
||||
assert cs.main(f.name, '--ignore-regex=^$') == 1
|
||||
# A word can be ignored.
|
||||
|
Reference in New Issue
Block a user