Mix.Statifier.Corpus.Files (Statifier v2.6.0)

Copy Markdown View Source

The corpus emitter's file reads and writes, in one place, each returning a sentence naming the file instead of raising.

Mix task support, run under mix on a developer's machine against paths in this repository or its gitignored scratch tree: no path here is attacker-controlled, and nothing under lib/mix/ is in the released package (mix.exs's package files list). That is the justification for the @sobelow_skip on each function below; every other Sobelow check stays live on the module.

Summary

Functions

Reads path, or returns a sentence naming it.

Writes content to path, creating its directory, or returns a sentence naming it.

Functions

read(path)

@spec read(path :: Path.t()) :: {:ok, binary()} | {:error, String.t()}

Reads path, or returns a sentence naming it.

write(path, content)

@spec write(path :: Path.t(), content :: iodata()) :: :ok | {:error, String.t()}

Writes content to path, creating its directory, or returns a sentence naming it.