topmark.filetypes.checks ¶
Insert-checker utilities for TopMark file types.
This package provides file-type specific checks (InsertChecker instances)
that determine whether a TopMark header can be safely inserted into a given file.
Unlike content matchers (see topmark.filetypes.detectors), which classify
a file's type by examining its content, insert checkers focus on pre-insert
eligibility. For example, a checker may forbid inserting a header into a JSON
file that is actually JSON without comments, or into an XML document missing a
declaration.
Responsibilities
- Expose reusable, file-type specific
InsertCheckercallables. - Encapsulate constraints that go beyond syntax (e.g., semantic restrictions).
- Surface advisory reasons when insertion is not supported.
Relationship
topmark.filetypes.modeldefines theInsertCheckerprotocol and theFileTypedataclass property where these checkers can be attached.topmark.filetypes.detectorsprovides complementary content matchers for file type detection.