diff --git a/src/repoma/check_dev_files/deprecated.py b/src/repoma/check_dev_files/deprecated.py index 099bb7ec..01e170a9 100644 --- a/src/repoma/check_dev_files/deprecated.py +++ b/src/repoma/check_dev_files/deprecated.py @@ -1,5 +1,8 @@ """Remove deprecated linters and formatters.""" +import os + +from repoma.errors import PrecommitError from repoma.utilities import remove_configs, remove_from_gitignore from repoma.utilities.executor import Executor from repoma.utilities.precommit import remove_precommit_hook @@ -11,6 +14,8 @@ def remove_deprecated_tools(keep_issue_templates: bool) -> None: if not keep_issue_templates: executor(_remove_github_issue_templates) executor(_remove_markdownlint) + for directory in ["docs", "doc"]: + executor(_remove_relink_references, directory) executor.finalize() @@ -35,3 +40,14 @@ def _remove_markdownlint() -> None: ) executor(remove_precommit_hook, "markdownlint") executor.finalize() + + +def _remove_relink_references(directory: str) -> None: + path = f"{directory}/_relink_references.py" + if not os.path.exists(path): + return + msg = ( + f"Please remove {path!r} and use https://pypi.org/project/sphinx-api-relink" + " instead." + ) + raise PrecommitError(msg)