repomatic.lint_repo.context moduleΒΆ
What the repository checks read, resolved once per run.
LintContext is the one context that lint-repo and setup-guide
both read, so the two commands cannot disagree on a gate. It holds what the
command alone knows (the repository it names, which secrets exist), the facts
pyproject.toml states, and the [tool.repomatic] configuration.
Every remote read is a cached property: a check that never asks for one makes no call, and two checks asking for the same one share a single call.
- repomatic.lint_repo.context.DOCS_URL_KEYS = ('documentation', 'docs')ΒΆ
Keys in
[project.urls]naming the published documentation site.Checked in priority order, and looked up in a lowercased index of the projectβs own keys: PEP 621 leaves the spelling to the project, so
Documentation,documentationandDocsall occur in the wild. Mirrors the same convention_SOURCE_URL_KEYSinrepomatic.pypiapplies to the PyPI copy of the same mapping.
- repomatic.lint_repo.context.WRANGLER_TOML = PosixPath('wrangler.toml')ΒΆ
The root-level Wrangler configuration a Cloudflare Pages project may commit.
- repomatic.lint_repo.context.documentation_url(project_urls)[source]ΒΆ
The documentation site a project declares in
[project.urls].
- class repomatic.lint_repo.context.LintContext(config=<factory>, repo=None, repo_name=None, package_name=None, is_package=False, is_sphinx=False, has_changelog=False, project_description=None, docs_url=None, keywords=None, tool_table=<factory>, nuitka_active=False, has_pat=False, has_virustotal_key=False, has_cloudflare_api_token=False, has_cloudflare_r2_keys=False, has_notifications_pat=False)[source]ΒΆ
Bases:
objectEverything the repository checks and the setup guide read.
Build it with
from_project(), which reads the checkout the way the CLI does, or directly for a hand-assembled probe. The fields hold what is known before any check runs. The cached properties hold what a check reads on demand: a GitHub API call, a walk of the working tree, or a parse of the workflows.- repo: str | None = NoneΒΆ
Repository in
owner/repoformat.Noneturns off every check that reads the GitHub API.
- is_package: bool = FalseΒΆ
Whether the project builds a distributable package.
Per
repomatic.pyproject.is_python_package(). Gates the checks that only make sense for something actually published to PyPI.
- has_changelog: bool = FalseΒΆ
Whether the configured changelog exists.
The release workflow publishes a GitHub release for each release commit, and only
prepare-releasewrites one, from the changelog. So this is also whether the repository publishes GitHub releases, which is what the immutable releases setting protects.
- docs_url: str | None = NoneΒΆ
Documentation site declared in
[project.urls], perDOCS_URL_KEYS.
- has_cloudflare_r2_keys: bool = FalseΒΆ
Whether
CLOUDFLARE_R2_ACCESS_KEY_IDandCLOUDFLARE_R2_SECRET_ACCESS_KEYare both configured.
- property slug: strΒΆ
repo, for a check that runs only when it is set.- Raises:
ValueError β When no repository is named. A check reading the GitHub API declares that it needs one, so reaching this error means the check ran without its gate.
- deploys_to(target)[source]ΒΆ
Whether this repository publishes its site to target.
Routes through
repomatic.config.deploys_to(): one hostβs prerequisite is the otherβs noise, and exactly one of them applies.- Return type:
- property repo_object: dict[str, Any] | None[source]ΒΆ
The repository object of the GitHub REST API, read once.
One
GET /repos/{repo}answers the description, the website field, the topics, the fork flag and the owner type, which four checks and the setup guide read.Nonewhen no repository is named or the read failed, which each reader reports as skipped rather than failed.
- property rulesets: list[dict[str, Any]] | None[source]ΒΆ
The repositoryβs rulesets, the ones inherited from a parent included.
One endpoint serves the two ruleset checks, which filter the same payload on different
targetvalues. A failed read is kept too: both checks then report the same unreadable API instead of asking twice.- Returns:
The ruleset list, or
Nonewhen the API could not be read.
- property declared_labels: frozenset[str] | None[source]ΒΆ
Every label name the configured sources declare, per
sync-labels.Read here rather than inside the check so the check reads its expectation from the same place the sync writes it. Reading it fetches the
labels.extra-filesdefinitions.Nonewhen a label definition could not be fetched or read: the set is unknown rather than short, and the check reports skipped.
- property pat_permissions: PatPermissionResults | None[source]ΒΆ
The results of the PAT permission probes, or
Nonewithout a PAT.Both
lint-repoand the setup guide read them, so they run once.
- property pat_scope: CheckResult | None[source]ΒΆ
The result of the PAT repository-scope probe, or
Nonewithout a PAT.
- property files: FileInventoryΒΆ
What the repository holds on disk,
.gitignoreapplied.The inventory of the
Metadatasingleton, so the checks share one walk of the tree with every other reader of the run.
- property redirects_files: list[Path][source]ΒΆ
Committed Cloudflare Pages
_redirectsfiles,.gitignorehonoured.The gitignore filter is what keeps a generated site tree (an
output/ordocs/_build/copy of the same file) out of the audit: the engine replica must read the source of truth, not a build artifact of it.
- property oversized_files: list[Path][source]ΒΆ
Tracked files over the Cloudflare Pages limit,
.gitignorehonoured.Built trees stay out, like the
_redirectsinventory above: the deploy step reads those, and it names each file it moves or drops. The size rule is the one the deploy applies, fromoversized_files().
- property workflow_texts: dict[Path, str][source]ΒΆ
Every workflow fileβs raw text, read once for the whole run.
Some checks match the files as written, others parse them. Reading once here spares each check its own walk of
.github/workflows/.
- classmethod from_project(config, *, repo=None, repo_name=None, has_pat=False, has_virustotal_key=False, has_cloudflare_api_token=False, has_cloudflare_r2_keys=False, has_notifications_pat=False)[source]ΒΆ
Resolve the project facts from the current checkout.
Everything
pyproject.toml, theMetadatasingleton and the configuration can answer is read here, so a command hands over only what it alone knows: which repository it names, and which secrets exist.- Parameters:
config (
Config) β The resolved[tool.repomatic]configuration.repo (
str|None) β Repository inowner/repoformat, orNone.repo_name (
str|None) β Repository name; derived from repo when omitted.has_pat (
bool) β WhetherREPOMATIC_PATis configured.has_virustotal_key (
bool) β WhetherVIRUSTOTAL_API_KEYis configured.has_cloudflare_api_token (
bool) β WhetherCLOUDFLARE_API_TOKENis configured.has_cloudflare_r2_keys (
bool) β Whether both R2 upload secrets are configured.has_notifications_pat (
bool) β WhetherREPOMATIC_NOTIFICATIONS_PATis configured.
- Return type: