Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions codespell_lib/_codespell.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,10 @@
uri_regex_def = (
r"(\b(?:https?|[ts]?ftp|file|git|smb)://[^\s]+(?=$|\s)|\b[\w.%+-]+@[\w.-]+\b)"
)
inline_ignore_regex = re.compile(r"[^\w\s]\s*codespell:ignore\b(\s+(?P<words>[\w,]*))?")
codespell_ignore_tag = "codespell:ignore"
inline_ignore_regex = re.compile(
rf"[^\w\s]\s*{codespell_ignore_tag}\b(\s+(?P<words>[\w,]*))?"
)
USAGE = """
\t%prog [OPTIONS] [file1 file2 ... fileN]
"""
Expand Down Expand Up @@ -951,7 +954,9 @@ def parse_file(
continue

extra_words_to_ignore = set()
match = inline_ignore_regex.search(line)
match = (
inline_ignore_regex.search(line) if codespell_ignore_tag in line else None
)
if match:
extra_words_to_ignore = set(
filter(None, (match.group("words") or "").split(","))
Expand Down
Loading