We have a pattern which occurs a lot on the codebase, which I noticed in #1601
PreCommitConfig.from_single_repo(
pre_commit_schema.LocalRepo(
repo="local",
hooks=[
pre_commit_schema.HookDefinition(
id="import-linter",
name="import-linter",
pass_filenames=False,
entry=f"uv run {tool_name}",
language=get_system_language(),
require_serial=True,
always_run=True,
)
],
),
requires_venv=True,
inform_how_to_use_on_migrate=False,
)
For some tool_name, and using a backend-dependent logic to choose the entry= string. We should probably search for this pattern in the codebase, and introduce a new method on PreCommitConfig for generating this pattern from the tool name. This should make things more concise by reducing the cases of if-else branches
checking on the backend in the src/usethis/_tool/impl/spec layer and elsewhere
We have a pattern which occurs a lot on the codebase, which I noticed in #1601
For some
tool_name, and using a backend-dependent logic to choose theentry=string. We should probably search for this pattern in the codebase, and introduce a new method onPreCommitConfigfor generating this pattern from the tool name. This should make things more concise by reducing the cases of if-else brancheschecking on the backend in the
src/usethis/_tool/impl/speclayer and elsewhere