devops.cpp.state
State persistence for incremental C++ checks.
Functions
|
Return True if any file in |
|
Return a hash of the raw contents of the TOML config file. |
|
Return only the files from |
|
Load per-file check state from a JSON file. |
|
Return True if |
|
Write the state dict to a JSON file. |
|
Record the result for a single file in the state dict. |
- devops.cpp.state.compute_config_hash(config_file)[source]
Return a hash of the raw contents of the TOML config file.
- Parameters:
config_file (Path | None) – Path to the TOML config file, or
Noneif none is in use.- Returns:
str | None – Hex SHA-256 digest, or
Noneif there is no (readable) config file.- Return type:
str | None
- devops.cpp.state.load_state(state_file, config_hash=None)[source]
Load per-file check state from a JSON file.
The state is invalidated (an empty state is returned) when the config hash it was saved with differs from
config_hash, i.e. whenever the TOML config file changed, appeared or disappeared since the last run.- Parameters:
state_file (Path) – Path to the state file. Returns an empty dict if the file does not exist or cannot be parsed.
config_hash (str | None) – Hash of the current config file as returned by
compute_config_hash. The returned state carries it so thatsave_statepersists it.
- Returns:
dict[str, dict] – Mapping of file path string to
{"mtime": float, "result": str}.- Return type:
- devops.cpp.state.needs_check(path, state)[source]
Return True if
pathshould be re-checked.A file needs checking when it is new (not in state), previously failed, or its modification time differs from the stored value.
- devops.cpp.state.filter_incremental(files, state)[source]
Return only the files from
filesthat need checking.