MCPcopy Index your code
hub / github.com/pre-commit/pre-commit / health_check

Function health_check

pre_commit/languages/r.py:86–107  ·  view source on GitHub ↗
(prefix: Prefix, version: str)

Source from the content-addressed store, hash-verified

84
85
86def health_check(prefix: Prefix, version: str) -> str | None:
87 envdir = lang_base.environment_dir(prefix, ENVIRONMENT_DIR, version)
88
89 r_version_installation = _read_installed_version(
90 envdir=envdir, prefix=prefix, version=version,
91 )
92 r_version_current_executable = _read_executable_version(
93 envdir=envdir, prefix=prefix, version=version,
94 )
95 if r_version_installation in {'NULL', ''}:
96 return (
97 f'Hooks were installed with an unknown R version. R version for '
98 f'hook repo now set to {r_version_current_executable}'
99 )
100 elif r_version_installation != r_version_current_executable:
101 return (
102 f'Hooks were installed for R version {r_version_installation}, '
103 f'but current R executable has version '
104 f'{r_version_current_executable}'
105 )
106
107 return None
108
109
110@contextlib.contextmanager

Callers

nothing calls this directly

Calls 2

_read_installed_versionFunction · 0.85
_read_executable_versionFunction · 0.85

Tested by

no test coverage detected