On this page
Shared helpers for check modules.
#rlsbl.checks._common
#rlsbl.checks._common
Shared helpers for rlsbl check modules: version and tag resolution, changelog context loading, and sibling project directory exclusion.
#_resolve_version_and_tag
def _resolve_version_and_tag(ctx)Detect version and tag from project targets rooted at ctx.
In explicit releasable mode, uses the releasable's version file and tag_format instead of the per-target version and tag format.
Returns (version, tag); either may be None.
#_get_changelog_context
def _get_changelog_context(ctx)Resolve changes_dir, tag_glob, project, and entries for changelog checks.
Returns (changes_dir, tag_glob, project, entries) or None when the changes directory does not exist (caller should return skip).
The project value depends on mode:
- Standalone (no workspace):
None. - Implicit monorepo (no
[[releasables]]): a single WorkspaceProject
dict with path and watch keys for scoping.
- Explicit monorepo (
[[releasables]]present): a list of
WorkspaceProject instances representing all member projects of the releasable. Callers that pass project to validation functions handle both single-project and list-of-projects via filter_commits_for_releasable.
In explicit mode, changes_dir points to the releasable's changes directory (.rlsbl-monorepo/releasables/{name}/changes/) and tag_glob is derived from the releasable's tag_format.
#_get_all_changelog_contexts
def _get_all_changelog_contexts(ctx)Return changelog contexts for ALL releasables when CWD is the workspace root.
When CWD is inside a specific project, delegates to _get_changelog_context and wraps the result in a list. When CWD is the workspace root in an explicit-mode workspace, iterates all releasables and returns a context tuple for each one that has a changes directory.
Returns a list of (changes_dir, tag_glob, project, entries) tuples, or an empty list when no contexts are available (caller should skip).
#_sibling_exclude_dirs
def _sibling_exclude_dirs(root, project_path, all_projects)Compute sibling project directories to exclude from a scan.
For a project at project_path, returns a list of other workspace project directories that are subdirectories of this project's path. This prevents walk_source_files from descending into sibling projects when the current project is at a parent path (e.g. path = ".").
#_build_dep_import_cache
def _build_dep_import_cache(ctx)Build per-project import scan cache for dependency checks.
Returns a dict mapping project name to (lib_imports, test_imports, guarded_imports). All dep checks (unused, undeclared, runtime-test-only, dev-in-lib) share one scan pass via this cache. The result is memoized on the context object so that multiple checks in the same run reuse a single scan instead of re-walking every project's source tree.