Skip to main content

Module edit_check

Module edit_check 

Source
Expand description

The post-edit check: which symbols changed shape against a base revision, and which sites of each the diff did not reach.

The base symbols come from a scan of the base revision of the changed files into a side index under <root>/.code-kb/check/<pid>/, which is removed when the check ends. The current symbols and the sites come from the main index, after the changed files are refreshed in it.

Structs§

BlockedSite
A site that a Stop hook listed: the hash of its trimmed line text and how many lines of its file had that text. An edit above a site moves it, so the next Stop counts lines, not places.
EditCheck
The answer of one check. diff_hash names the state of the changed files, so a caller can tell a repeated check of the same diff.
EditLimits
The cuts that bound one check.
EditSite
One site of a changed symbol: where it is, the function that holds it, and a note on the argument count it passes.
PendingCheck
A check up to its diff hash: the base, the changed files, and the hash of their content, with no scan of the base. A caller that remembers the hash of an earlier check can drop a repeat before PendingCheck::run pays for the scan and the report.
SessionLock
The lock of one session. Dropping it removes the lock file.
SessionState
What the hooks remember about one session.
ShapeChange
A symbol whose shape changed, with its sites sorted by whether the diff reached them.

Enums§

BaseRequest
The revision a check compares the working tree with.
BaseSource
Where the base revision of a check comes from.
EditCheckError

Functions§

any_site_edited
True when an edit changed a marked site: its file now has fewer lines with its text.
head_commit
The commit HEAD names in the repository that holds root: None outside a repository and before the first commit.
is_session_id
True for a session id that is safe in a file name: letters, digits, _ and - only.
latest_session_base
The base of the session file written last within the past day, for a caller that has no session id.
lock_session
Takes the lock of a session by creating {session_id}.lock exclusively, polling for up to wait. None when the lock stays held, or the id or the folder is unusable. A lock file older than the hook timeout belongs to a hook that died, and the next caller takes it over.
mark_sites
Marks each (path, line) site with the text of its line in the working tree. A site whose line cannot be read gets no mark.
prune_sessions
Removes the session files that no session can still use.
read_session
record_session_base
Records head as the base of a session whose file has none, and keeps the other fields of the file. A session that has a base keeps it, so a resume or a compaction does not move it. The caller holds the session lock, because a Stop hook rewrites the whole file.
write_session