Skip to content

line_endings

Every line ending matches target: lf or crlf. Mixed endings in a single file fail.

OptionTypeRequiredDefaultDescription
targetone of lf | crlfyesRequired line ending style: lf or crlf. Mixed endings within a file also fail.

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

A source file with CRLF line endings under an LF policy

Section titled “A source file with CRLF line endings under an LF policy”

The rule fires on this repository:

src/
src/has_crlf.rs
src/pure_lf.rs
src/has_crlf.rs
fn c() {}<U+000D>
fn d() {}
src/pure_lf.rs
fn a() {}
fn b() {}

With this .alint.yml:

version: 1
rules:
- id: lf-only
kind: line_endings
paths: "src/**/*.rs"
target: lf
level: error

alint check reports:

Terminal window
--- src/has_crlf.rs ------------------------------------------------------------
x error lf-only
1:1 line 1 does not use lf line endings
Summary (1 violation):
x 1 error
0 passing * 1 failing

This repository is compliant:

src/
src/a.rs
src/b.rs
src/a.rs
fn a() {}
fn b() {}
src/b.rs
fn c() {}

With this .alint.yml:

version: 1
rules:
- id: lf-only
kind: line_endings
paths: "src/**/*.rs"
target: lf
level: error

alint check reports:

Terminal window
v All 1 rule(s) passed.