Expand description
Parse CODEOWNERS files into structured lines, with or without positions.
Two parse entry points:
parse_codeowners_file_with_positions— retains character offsets for every pattern, owner span, and inline comment. Use this for editor tooling.parse_codeowners_file— drops positions, returns only the logical content. Use this for CLI-style tools that only need to inspect or rewrite rules.
Structs§
- Parsed
Line - A parsed CODEOWNERS line with character offsets for editor tooling.
Enums§
- Codeowners
Line - The logical content of a CODEOWNERS line.
Functions§
- find_
inline_ comment_ start - Find the char offset of an inline comment on a rule line.
An inline comment starts with
#that is preceded by whitespace. - find_
insertion_ point - Find the best insertion point for a new pattern Uses heuristics to find a sensible location:
- find_
insertion_ point_ with_ owner - Find the best insertion point considering both path and owner
- find_
owner_ at_ position - Find the @owner at a given character position in a line
- format_
codeowners - Format a CODEOWNERS file: normalize rule spacing, preserve comments exactly
- parse_
codeowners_ file - Parse a CODEOWNERS file into structured lines (without positions)
- parse_
codeowners_ file_ with_ positions - Parse a CODEOWNERS file into structured lines with position info
- serialize_
codeowners - Write parsed lines back to a string