Skip to content

file_is_text

CategoriesContentEncoding

Content is detected as text (magic bytes + UTF-8 validity check) — fails on binary files matched by paths.

This rule takes no kind-specific options.

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

The rule fires on this repository:

src/
src/accidental_blob.rs
src/clean.rs
src/accidental_blob.rs
(binary content, 11 bytes)
src/clean.rs
pub fn ok() {}

With this .alint.yml:

version: 1
rules:
- id: src-is-text
kind: file_is_text
paths: "src/**"
level: error

alint check reports:

Terminal window
--- src/accidental_blob.rs -----------------------------------------------------
x error src-is-text
file is detected as binary; text is required here
Summary (1 violation):
x 1 error
0 passing * 1 failing

This repository is compliant:

src/
src/lib.rs
src/main.rs
src/lib.rs
pub fn ok() {}
src/main.rs
fn main() {}

With this .alint.yml:

version: 1
rules:
- id: src-is-text
kind: file_is_text
paths: "src/**"
level: error

alint check reports:

Terminal window
v All 1 rule(s) passed.