Skip to main content

write_format_validate

Function write_format_validate 

Source
pub fn write_format_validate(
    path: &Path,
    content: &str,
    config: &Config,
    params: &Value,
) -> Result<WriteResult, AftError>
Expand description

Write content to disk, auto-format, then validate syntax.

This is the shared tail for all mutation commands. The pipeline order is:

  1. fs::write — persist content
  2. auto_format — run the project formatter (reads the written file, writes back)
  3. validate_syntax — parse the (potentially formatted) file
  4. validate_full — run type checker if params.validate == "full"

The params argument carries the original request parameters. When it contains "validate": "full", the project’s type checker is invoked after syntax validation and the results are included in WriteResult.