(prefix: Prefix, version: str)
| 84 | |
| 85 | |
| 86 | def 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 |
nothing calls this directly
no test coverage detected