# Copyright 2026 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

# Autogenerated by pycargoebuild 0.15.1

EAPI=8

CRATES="
"

RUST_MIN_VER="1.92.0"

inherit cargo

DESCRIPTION="Better \`pre-commit\`, re-engineered in Rust"
HOMEPAGE="https://prek.j178.dev/"
SRC_URI="
	${CARGO_CRATE_URIS}
	https://github.com/j178/prek/archive/refs/tags/v${PV}.tar.gz -> ${P}.tar.gz
"
if [[ ${PKGBUMPING} != ${PVR} ]]; then
	SRC_URI+="
		mirror://gentoo/${P}-crates.tar.xz
	"
fi

LICENSE="MIT"
# Dependent crate licenses
LICENSE+="
	Apache-2.0 Apache-2.0-with-LLVM-exceptions BSD CDDL
	CDLA-Permissive-2.0 ISC MIT Unicode-3.0 ZLIB
"
SLOT="0"
KEYWORDS="~amd64"

DOCS=(
	CONTRIBUTING.md
	README.md
	CHANGELOG.md
	docs/
)

src_test() {
	local -a skip_tests=(
		# tests that require network access
		check_useless_excludes_remote
		deno::additional_dependencies
		deno::remote_hook
		deno::remote_hook_with_additional_dependencies
		deno::remote_hook_with_local_file_additional_dependency
		http::tests::test_native_tls
		install_hooks_only
		install_with_hooks

		# tests that don't work in sandbox
		cache_gc_removes_unreferenced_entries

		# tests that require extra dependencies
		bun::additional_dependencies
		bun::basic_bun
		deno::without_system_deno
		docker::docker
		docker::workspace_docker
		docker_image::docker_image
		docker_image::docker_image_does_not_resolve_entry
		golang::local_additional_deps
		golang::remote_go_mod_metadata_sets_language_version
		golang::remote_hook
		haskell::additional_dependencies
		haskell::local_hook
		haskell::remote_hook
		julia::additional_dependencies
		julia::local_hook
		julia::project_toml
		julia::remote_hook
		julia::script_file
		lua::additional_dependencies
		lua::health_check
		lua::hook_stderr
		lua::lua_environment
		lua::remote_hook
		lua::script_with_files
		node::additional_dependencies
		node::additional_dependencies_without_system_node
		node::npm_version
		python::additional_dependencies
		python::additional_dependencies_in_remote_repo
		python::git_env_vars_not_leaked_to_pip_install
		python::pep723_script
		reuse_env
		ruby::additional_gem_dependencies
		ruby::environment_isolation
		ruby::language_version_default
		ruby::multiple_gemspecs
		ruby::native_gem_dependency
		ruby::prebuilt_vs_compiled_gems
		ruby::specific_ruby_available
		ruby::specific_ruby_unavailable
		ruby::system_ruby
		run_basic
		run_in_non_git_repo
		run_last_commit
		rust::additional_dependencies_cli
		rust::remote_hook_non_workspace
		rust::remote_hooks
		rust::remote_hooks_with_lib_deps
		rust::rustup_installer
		same_repo
		script::unix::script_run
		try_repo_relative_path
		try_repo_specific_hook
		try_repo_specific_rev
	)

	cargo_src_test -- \
		$(printf -- '--skip %s\n' "${skip_tests[@]}")
}

src_install() {
	pushd crates/prek &>/dev/null || die
	cargo_src_install
	popd &>/dev/null || die

	dodoc -r "${DOCS[@]}"
}