Skip to content

Every byte in the file must be < 0x80 (pure ASCII), except codepoints listed in allow:. Strict variant of is_text for configs that must round-trip through strictly-ASCII tools. allow: exempts specific non-ASCII codepoints — each entry a single character ("ö"), a U+XXXX codepoint, or a U+XXXX-U+YYYY inclusive range (curl keeps its source ASCII but allows ö in "Björn"; the recurring need across llvm / vscode / elixir). With allow: the file is decoded as UTF-8 and checked per character; without it, the strict byte-level fast path is used.

OptionTypeRequiredDefaultDescription
allowlist of string[]Permitted non-ASCII codepoints - each a single character (e.g. "o-umlaut"), a U+XXXX codepoint, or a U+XXXX-U+YYYY inclusive range.

Plus the common paths, level, id, when, scope_filter, and expect_matches fields. This table is generated from the JSON Schema; option types and defaults are authoritative.

A source file with a non-ASCII byte

Section titled "A source file with a non-ASCII byte"

The rule fires on this repository:

  • src/
  • src/ascii.rs✓
  • src/unicode.rs

    ✗ error ascii-only

    non-ASCII byte 0xE2 at offset 7

src/ascii.rs
pub fn ok() {}
src/unicode.rs
// The ☃ is here
pub fn cold() {}

With this .alint.yml:

version: 1
rules:
- id: ascii-only
kind: file_is_ascii
paths: "src/**/*.rs"
level: error

alint check reports:

Terminal window
--- src/unicode.rs -------------------------------------------------------------
x error ascii-only
non-ASCII byte 0xE2 at offset 7
Summary (1 violation):
x 1 error
0 passing * 1 failing

This repository is compliant:

  • src/
  • src/a.rs✓
  • src/b.rs✓
src/a.rs
pub fn a() {}
src/b.rs
pub fn b() { let _ = 42; }

With this .alint.yml:

version: 1
rules:
- id: ascii-only
kind: file_is_ascii
paths: "src/**/*.rs"
level: error

alint check reports:

Terminal window
v All 1 rule(s) passed.