file_is_ascii
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.
Options
Section titled “Options”| Option | Type | Required | Default | Description |
|---|---|---|---|---|
allow | list 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, and when fields. This table is generated from the JSON Schema; option types and defaults are authoritative.
Example
Section titled “Example”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.rssrc/unicode.rspub fn ok() {}// The ☃ is herepub fn cold() {}With this .alint.yml:
version: 1rules: - id: ascii-only kind: file_is_ascii paths: "src/**/*.rs" level: erroralint check reports:
--- src/unicode.rs ------------------------------------------------------------- x error ascii-only non-ASCII byte 0xE2 at offset 7
Summary (1 violation): x 1 error 0 passing * 1 failingEvery source file is pure ASCII
Section titled “Every source file is pure ASCII”This repository is compliant:
src/src/a.rssrc/b.rspub fn a() {}pub fn b() { let _ = 42; }With this .alint.yml:
version: 1rules: - id: ascii-only kind: file_is_ascii paths: "src/**/*.rs" level: erroralint check reports:
v All 1 rule(s) passed.