Skip to content
Open
Show file tree
Hide file tree
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
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ exclude: ^(\.[^/]*cache/.*)$
repos:
- repo: https://github.com/executablebooks/mdformat
# Do this before other tools "fixing" the line endings
rev: 0.7.21
rev: 0.7.22
hooks:
- id: mdformat
name: Format Markdown
Expand Down Expand Up @@ -58,7 +58,7 @@ repos:
- -d
- "{extends: relaxed, rules: {line-length: {max: 90}}}"
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.8.6
rev: v0.9.10
hooks:
- id: ruff
- id: ruff-format
Expand All @@ -72,7 +72,7 @@ repos:
hooks:
- id: validate-pyproject
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.14.1
rev: v1.15.0
hooks:
- id: mypy
args: ["--config-file", "pyproject.toml"]
Expand Down
12 changes: 5 additions & 7 deletions codetypo/_codetypo.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,9 @@
# these may occur unescaped in URIs, and so we are more restrictive on the
# endpoint. Emails are more restrictive, so the endpoint remains flexible.
uri_regex_def = (
"(\\b(?:https?|[ts]?ftp|file|git|smb)://[^\\s]+(?=$|\\s)|"
"\\b[\\w.%+-]+@[\\w.-]+\\b)"
"(\\b(?:https?|[ts]?ftp|file|git|smb)://[^\\s]+(?=$|\\s)|\\b[\\w.%+-]+@[\\w.-]+\\b)"
)
inline_ignore_regex = re.compile(r"[^\w\s]\s?codetypo:ignore\b(\s+(?P<words>[\w,]*))?")
inline_ignore_regex = re.compile(r"[^\w\s]\s*codetypo:ignore\b(\s+(?P<words>[\w,]*))?")
USAGE = """
\t%prog [OPTIONS] [file1 file2 ... fileN]
"""
Expand Down Expand Up @@ -763,9 +762,9 @@ def ask_for_word_fix(
return misspelling.fix, fix_case(wrongword, misspelling.data)

line_ui = (
f"{line[:match.start()]}"
f"{line[: match.start()]}"
f"{colors.WWORD}{wrongword}{colors.DISABLE}"
f"{line[match.end():]}"
f"{line[match.end() :]}"
)

if misspelling.fix and interactivity & 1:
Expand Down Expand Up @@ -1057,8 +1056,7 @@ def parse_file(
print_context(lines, i, context)
if filename != "-":
print(
f"{cfilename}:{cline}: {cwrongword} "
f"==> {crightword}{creason}"
f"{cfilename}:{cline}: {cwrongword} ==> {crightword}{creason}"
)
elif options.stdin_single_line:
print(f"{cline}: {cwrongword} ==> {crightword}{creason}")
Expand Down
Loading
Loading