Skip to main content

Module parser

Module parser 

Source
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§

ParsedLine
A parsed CODEOWNERS line with character offsets for editor tooling.

Enums§

CodeownersLine
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