Skip to main content

parse_blocks

Function parse_blocks 

Source
pub fn parse_blocks(
    line_changes_by_file: &HashMap<RepoPath, Vec<LineChange>>,
    scan_mode: ScanMode,
    file_system: &impl FileSystem,
    path_checker: &impl PathChecker,
    parsers: &LanguageParsers,
    extra_file_extensions: &HashMap<OsString, OsString>,
) -> Result<ParsedBlocks>
Expand description

Parses source files into the blocks a run should consider, together with the counts of files it looked at.

  • line_changes_by_file maps file paths to sorted line changes.
  • scan_mode chooses which set of files is read; see ScanMode.
  • file_system provides access to file contents within a root path.
  • parsers maps file extensions to language-specific block parsers.
  • extra_file_extensions allows remapping unknown extensions to supported ones (e.g., “cxx” -> “cpp”).

In either mode a file is read only if it passes the allow globs and is not ignored.

Fails if line_changes_by_file is invalid, e.g. it refers to files that do not exist.