editorconfig_conforms
Enforce selected formatting properties from the repository's own .editorconfig files without repeating those values in .alint.yml.
The rule discovers only .editorconfig files between each selected file and the lint root; a developer's parent-directory policy can never affect the result. It follows EditorConfig section order, nested-file precedence, root = true, unset, slash-relative globs, */**/?, literal character classes (including the specification's non-separator treatment of / inside a complete class), brace alternatives, and ascending numeric ranges. Policy files follow the EditorConfig grammar: UTF-8 with LF or CRLF separators, = property delimiters, and ignored non-root preamble pairs. Every finding points back to the declaration that supplied its effective policy. An unreadable or malformed policy file and an invalid value for a supported property are resource_read or resource_parse analysis failures rather than silent passes.
Supported properties are indent_style (plus numeric indent_size / tab_width), end_of_line (lf, crlf, or cr), charset (latin1, utf-8, utf-8-bom, utf-16be, or utf-16le), trim_trailing_whitespace, insert_final_newline, and positive-integer max_line_length (off disables it). Space indentation enforces numeric indent_size; tab indentation uses as many tabs as the effective tab width permits and allows only the remaining sub-tab-width spaces. Target-file text checks recognize LF, CRLF, and CR as physical line endings. A false trim_trailing_whitespace imposes no prohibition; insert_final_newline: false requires a non-empty file not to end in a line break. Unknown section properties remain available to other EditorConfig plugins and are ignored. Check-only: a policy-derived multi-operation repair needs the later transactional edit-plan surface.
Options
Section titled "Options"This rule takes no kind-specific options.
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.
Example
Section titled "Example"Files that violate their EditorConfig policy are reported
Section titled "Files that violate their EditorConfig policy are reported"The rule fires on this repository:
- .editorconfig✓
- bad.txt
✗ error editor-policy
1:1 line 1 does not use EditorConfig space indentation related: EditorConfig `indent_style` policy: .editorconfig:4:1-4:21
✗ error editor-policy
1:14 line 1 has trailing whitespace related: EditorConfig `trim_trailing_whitespace` policy: .editorconfig:6:1-6:32
✗ error editor-policy
1:17 file does not end with a newline related: EditorConfig `insert_final_newline` policy: .editorconfig:7:1-7:28
root = true
[*.txt]indent_style = spaceindent_size = 2trim_trailing_whitespace = trueinsert_final_newline = true bad trailingWith this .alint.yml:
version: 1rules: - id: editor-policy kind: editorconfig_conforms paths: "**/*.txt" level: erroralint check reports:
--- bad.txt -------------------------------------------------------------------- x error editor-policy 1:1 line 1 does not use EditorConfig space indentation related: EditorConfig `indent_style` policy: .editorconfig:4:1-4:21 x error editor-policy 1:14 line 1 has trailing whitespace related: EditorConfig `trim_trailing_whitespace` policy: .editorconfig:6:1-6:32 x error editor-policy 1:17 file does not end with a newline related: EditorConfig `insert_final_newline` policy: .editorconfig:7:1-7:28
Summary (3 violations): x 3 errors 0 passing * 1 failingNested EditorConfig sections merge and unset inherited policy
Section titled "Nested EditorConfig sections merge and unset inherited policy"This repository is compliant:
- .editorconfig✓
- docs/
- docs/.editorconfig✓
- docs/guide.txt✓
root = true
[*.txt]indent_style = spaceindent_size = 2trim_trailing_whitespace = trueinsert_final_newline = true[*.txt]trim_trailing_whitespace = unset aligned trailing spacesWith this .alint.yml:
version: 1rules: - id: editor-policy kind: editorconfig_conforms paths: "**/*.txt" level: erroralint check reports:
v All 1 rule(s) passed.