Skip to content
Merged
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
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
# Changelog

## Unreleased

### Docs

- Document per-file `[[tool.check-unicode.overrides]]` in README and man page
- Update man page version to 0.4.0 and fix stale pre-commit `rev`
- Add man page to `bump-my-version` files list

### Fixed

- Exclude `tests/fixtures/` from mypy (intentionally malformed Trojan Source
files)

## 0.4.0 - 2026-02-28

### Added
Expand Down
25 changes: 25 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,31 @@ check-confusables = true
severity = "error"
```

### Per-file overrides

Use `[[tool.check-unicode.overrides]]` to apply different settings per file
pattern. Each entry requires a `files` key with a list of glob patterns and can
set any of the options above.

Allow-lists (`allow-codepoints`, `allow-ranges`, `allow-categories`,
`allow-printable`, `allow-scripts`) are **additive** -- they merge with the
global config. `severity` and `check-confusables` **replace** the global value
for matching files.

```toml
# Relax rules for documentation
[[tool.check-unicode.overrides]]
files = ["docs/*.md", "*.rst"]
allow-printable = true
severity = "warning"

# Allow non-Latin scripts in i18n files
[[tool.check-unicode.overrides]]
files = ["i18n/**"]
allow-scripts = ["Cyrillic", "Han"]
check-confusables = false
```

## Output

```text
Expand Down
45 changes: 40 additions & 5 deletions docs/check-unicode.1
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.\" Man page for check-unicode
.\" Generate with: man ./docs/check-unicode.1
.TH CHECK\-UNICODE 1 "2026-02-20" "check-unicode 0.2.0" "User Commands"
.TH CHECK\-UNICODE 1 "2026-02-28" "check-unicode 0.4.0" "User Commands"
.
.SH NAME
check\-unicode \- detect and fix non\-ASCII Unicode characters in text files
Expand Down Expand Up @@ -199,13 +199,48 @@ severity = "error"
exclude\-patterns = ["*.min.js", "vendor/*"]
.RE
.fi
.PP
Per\-file overrides can be added with
.B [[tool.check\-unicode.overrides]]
sections.
Each entry requires a
.B files
key containing a list of glob patterns.
Allow\-list options
.RB ( allow\-codepoints ", " allow\-ranges ", " allow\-categories ", "
.BR allow\-printable ", " allow\-scripts )
are
.B additive
\(em they merge with the global config.
.B severity
and
.B check\-confusables
.B replace
the global value for matching files.
.PP
.nf
.RS
[[tool.check\-unicode.overrides]]
files = ["docs/*.md", "*.rst"]
allow\-printable = true
severity = "warning"

[[tool.check\-unicode.overrides]]
files = ["i18n/**"]
allow\-scripts = ["Cyrillic", "Han"]
check\-confusables = false
.RE
.fi
.
.SH EXIT CODES
.TP
.B 0
No findings were detected, or
.B \-\-severity=warning
was used.
No findings were detected, or all findings came from files whose effective
severity is
.BR warning
(set globally via
.B \-\-severity
or per\-file via overrides).
.TP
.B 1
Non\-ASCII findings were detected, or files were modified in
Expand Down Expand Up @@ -331,7 +366,7 @@ Use with pre\-commit:
.RS
repos:
\- repo: https://github.com/mit\-d/check\-unicode
rev: v0.2.0
rev: v0.4.0
hooks:
\- id: check\-unicode
# or for auto\-fix:
Expand Down
3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,11 @@ files = [
{ filename = "src/check_unicode/__init__.py" },
{ filename = "CHANGELOG.md", search = "## Unreleased", replace = "## {new_version} - {now:%Y-%m-%d}" },
{ filename = "README.md", search = "rev: v{current_version}", replace = "rev: v{new_version}" },
{ filename = "docs/check-unicode.1", search = "check-unicode {current_version}", replace = "check-unicode {new_version}" },
{ filename = "docs/check-unicode.1", search = "rev: v{current_version}", replace = "rev: v{new_version}" },
]

[tool.mypy]
python_version = "3.11"
strict = true
exclude = [ "tests/fixtures/" ]