repomatic.lint_repo.tool_config module¶
Checks of the tool configurations repomatic init writes into pyproject.toml.
A section init seeds once and never revisits misses the knobs its template
gains later. A section synced on every run can keep a bare entry beside the
anchored form that replaced it.
- repomatic.lint_repo.tool_config.missing_template_entries(template, local, prefix='')[source]¶
Yield the dotted paths a seeded tool section does not carry.
Absence is the only thing reported. A scalar the repository tuned is its own answer, a key it added is none of the template’s business, and a comment it rewrote is invisible here: all three are what
BOOTSTRAPhands over on the first write. What that contract cannot express is a knob the template gained afterwards, which reaches nobody becauseinitnever revisits the section.A list is compared by membership, not by equality. An ignore list or a select list grows one entry at a time and its order carries no meaning, so equality would report every local addition as drift.
- Parameters:
- Return type:
- Returns:
(path, None)per missing key,(path, member)per missing list member, named bytemplate_member_name().
- repomatic.lint_repo.tool_config.template_member_name(member)[source]¶
Name one member of a template list the way a
lint-repoline reads it.A scalar is its own name. A table has no text of its own, so its name is the inline table that writes it, like
{ fruit = "apple", ripe = true }. That is the text a maintainer copies into the section, or quotes as the key of adeclinedentry.
- repomatic.lint_repo.tool_config.check_bootstrap_config_drift(ctx)[source]¶
Report bundled knobs a seeded tool section never received.
initwrites the template of aBOOTSTRAPcomponent once and hands the section over, so the repository owns every value from then on. That is deliberate, and this check does not argue with it. The gap it closes is narrower: a template that gains a knob after the seeding has no route into the repository and nothing that mentions the difference, so the section silently stops being the configuration repomatic ships.Advisory, and deliberately so. A repository may have dropped a template rule on purpose, and only its maintainer can tell that from a section left behind.
The maintainer records that answer in
declined. A declined entry is reported as skipped, with its reason: the decision stays in the report and the warning stops. The record is checked like the section it speaks for. An entry that declines nothing is reported, since the next gap at its path would otherwise arrive already declined.A section keeping its keys in the component’s
legacy_tableis measured there, and the finding names that sub-table. An entry is declined at its path below the tool either way, without the sub-table.- Return type:
- Returns:
One result per declined entry and one per adopted BOOTSTRAP section, then one per recorded entry that declines nothing.
- repomatic.lint_repo.tool_config.anchored_exclude_core(pattern)[source]¶
Return the bare host pattern an anchored exclude entry supersedes.
^https://(www\.)?x\.com(/.*)?$answersx\.com. Anything else answersNone: an entry not anchored on both ends replaced no bare form, and one carrying a path between the host and the closing anchor (^https://www\.npmjs\.com/package/.*$) has no bare form that was ever bundled on its own.
- repomatic.lint_repo.tool_config.check_superseded_local_excludes(ctx)[source]¶
Report a local exclude entry the bundled template has since anchored.
An ongoing sync rebuilds a section from its template and grafts local-only content back on, and for an array the graft is a union by value: an item the template does not carry is appended after the ones it does. That is what keeps a repository’s own entries alive across a sync, and it has no inverse. When the template replaces an entry instead of adding one, the old form becomes local-only by the next sync, so it is grafted back beside its own replacement and nothing ever retires it.
Anchoring a bare host pattern is exactly that replacement, and the stale copy is not inert: lychee reads these entries as substring matches, so a bare
x\.comkept beside^https://(www\.)?x\.com(/.*)?$goes on excluding every domain ending inx.com,cloudlinux.comamong them, which is what the anchored form was written to stop doing.The fix depends on what sits beside the stale entry. Where the anchored form is present, dropping the bare one is the whole fix. A section no sync reaches holds the bare form alone: lychee is an awesome-only component, so another repository keeps a copy nothing rebuilds unless
[tool.repomatic] includeopts it in. Dropping the entry there would stop excluding the host itself, so the result names the anchored form to write in its place.Advisory. Only the maintainer can separate a bare entry the template superseded from one the repository narrowed on purpose.
Note
The test is deliberately narrow: it recognises the anchored/bare pair by string equality against the head and tail above, so it catches a template that anchored a host pattern and nothing else. A local entry broadened in some other way is not reported. Widening it means inverting a regex to compare match sets, which is not worth a dependency for one signature that already reached every repository the bundled
lychee.tomldeploys to.- Return type:
- Returns:
One result per synced tool config holding exclude patterns.