Skip to content

Commit

Permalink
Fix typos
Browse files Browse the repository at this point in the history
  • Loading branch information
kdeldycke committed Jan 20, 2024
1 parent 7af3fa5 commit 1a340db
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 5 deletions.
10 changes: 5 additions & 5 deletions click_extra/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -387,23 +387,23 @@ def noop(s: str) -> str:
colored_template = ""

# Apply styles to field and literal segments.
lits_accu = ""
literal_accu = ""
for i, segment in enumerate(segments):
# Is the segment a format field?
is_field = isinstance(segment, BaseFormatField)
# If not, keep accumulating literal strings until the next field.
if not is_field:
# Re-escape literal curly braces to avoid messing up the format.
lits_accu += segment.replace("{", "{{").replace("}", "}}")
literal_accu += segment.replace("{", "{{").replace("}", "}}")

# Dump the accumulated literals before processing the field, or at the end
# of the template.
is_last_segment = i + 1 == len(segments)
if (is_field or is_last_segment) and lits_accu:
if (is_field or is_last_segment) and literal_accu:
# Colorize literals with the default style.
colored_template += default_style(lits_accu)
colored_template += default_style(literal_accu)
# Reset the accumulator.
lits_accu = ""
literal_accu = ""

# Add the field to the template copy, colored with its own style.
if is_field:
Expand Down
31 changes: 31 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,37 @@ regex = true
search = "date-released: \\d{{4}}-\\d{{2}}-\\d{{2}}"
replace = "date-released: {utcnow:%Y-%m-%d}"

[tool.typos]
default.extend-ignore-identifiers-re = [
# error: `PASE` should be `PASS`, `PACE`, `PARSE`
# --> ./click_extra/platforms.py:416:8
# |
# 416 | - `PASE`
# | ^^^^
# |
"PASE",
# error: `Uper` should be `Super`, `Upper`
# --> ./click_extra/tests/test_parameters.py:132:19
# |
# 132 | "sUper",
# | ^^^^
# |
"sUper",
# error: `Als` should be `Also`
# --> ./click_extra/tests/test_parameters.py:198:11
# |
# 198 | "fAlsE": False,
# | ^^^
# |
"fAlsE",
# error: `mey` should be `may`
# --> ./click_extra/tests/test_colorize.py:712:22
# |
# 712 | "H\x1b[32mey\x1b[0m-xx-xxx-\x1b[32mhe\x1b[0mY-xXxXxxxxx-\x1b[32mhey\x1b[0m",
# | ^^^
# |
"mey",
]

[build-system]
requires = ["poetry-core>=1.0.0"]
Expand Down

0 comments on commit 1a340db

Please sign in to comment.