Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug_report.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ body:

- type: input
attributes:
label: "Version (current: 0.5.2)"
label: "Version (current: 0.5.1)"
description: What version of prek are you using? (see `prek -V`)
placeholder: e.g., prek 0.2.3 (7fe75a86d 2025-09-29)
validations:
Expand Down
12 changes: 0 additions & 12 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,5 @@
# Changelog

## 0.5.2

Released on 2026-09-01.

### Bug fixes

- Revert unsupported YAML tag rejection in `check-yaml`, fixing validation failures for MkDocs configurations that use application-specific tags such as `!!python/object/apply:pymdownx.slugs.slugify` ([#2670](https://github.com/j178/prek/pull/2670))

### Contributors

- @j178

## 0.5.1

Released on 2026-09-01.
Expand Down
8 changes: 4 additions & 4 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@ members = ["crates/*"]
resolver = "3"

[workspace.package]
version = "0.5.2"
version = "0.5.1"
Comment thread
j178 marked this conversation as resolved.
Resolved
edition = "2024"
rust-version = "1.96"
repository = "https://github.com/j178/prek"
homepage = "https://prek.j178.dev/"
license = "MIT"

[workspace.dependencies]
prek-consts = { path = "crates/prek-consts", version = "0.5.2" }
prek-identify = { path = "crates/prek-identify", version = "0.5.2" }
prek-pty = { path = "crates/prek-pty", version = "0.5.2" }
prek-consts = { path = "crates/prek-consts", version = "0.5.1" }
prek-identify = { path = "crates/prek-identify", version = "0.5.1" }
prek-pty = { path = "crates/prek-pty", version = "0.5.1" }

aho-corasick = { version = "1.1.4" }
annotate-snippets = { version = "0.12.13" }
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ On Linux and macOS:
<!-- --8<-- [start: linux-standalone-install] -->

```bash
curl --proto '=https' --tlsv1.2 -LsSf https://github.com/j178/prek/releases/download/v0.5.2/prek-installer.sh | sh
curl --proto '=https' --tlsv1.2 -LsSf https://github.com/j178/prek/releases/download/v0.5.1/prek-installer.sh | sh
```

<!-- --8<-- [end: linux-standalone-install] -->
Expand All @@ -69,7 +69,7 @@ On Windows:
<!-- --8<-- [start: windows-standalone-install] -->

```powershell
powershell -ExecutionPolicy ByPass -c "irm https://github.com/j178/prek/releases/download/v0.5.2/prek-installer.ps1 | iex"
powershell -ExecutionPolicy ByPass -c "irm https://github.com/j178/prek/releases/download/v0.5.1/prek-installer.ps1 | iex"
```

<!-- --8<-- [end: windows-standalone-install] -->
Expand Down
21 changes: 19 additions & 2 deletions crates/prek/src/hooks/pre_commit_hooks/check_yaml.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,11 @@ fn check_loaded(filename: &Path, content: &[u8], allow_multi_docs: bool) -> Hook
emit_comments: false,
// Do not require `!!binary` scalars to decode as UTF-8. See #1102.
ignore_binary_tag_for_string: true,
// A YAML tag identifies a node's type or application-specific semantics.
// `%TAG` directives map tag handles to prefixes. The predefined `!!`
// handle expands to `tag:yaml.org,2002:`, while `!` is the local tag handle.
// Match ruamel.yaml's safe loader by rejecting tags without constructors. See #2604.
reject_unsupported_tags: true,
Comment thread
j178 marked this conversation as resolved.
Resolved
// The scalar values are discarded, so only validate whether they are
// legal YAML, not whether an untyped data model can represent them. See #2544.
reject_non_finite_typeless_float: false,
Expand All @@ -87,10 +92,9 @@ fn check_loaded(filename: &Path, content: &[u8], allow_multi_docs: bool) -> Hook
match result {
Ok(()) => HookOutput::unchanged(0, Vec::new()),
Err(e) => {
let formatter = &serde_saphyr::UserMessageFormatter;
let err = e.render_with_options(serde_saphyr::render_options! {
snippets: serde_saphyr::SnippetMode::Off,
formatter: formatter,
formatter: &serde_saphyr::UserMessageFormatter,
});
let error_message = format!("{}: Failed to yaml decode ({err})\n", filename.display());
HookOutput::unchanged(1, error_message.into_bytes())
Expand Down Expand Up @@ -311,6 +315,19 @@ key2: value2
Ok(())
}

#[test]
fn test_unknown_yaml_tag_requires_unsafe() {
let filename = Path::new("tagged.yaml");
let content = b"foo: !reference [.bar, script]\n";

let result = check_loaded(filename, content, false);
assert_eq!(result.exit_status, 1);
insta::assert_snapshot!(String::from_utf8_lossy(&result.output), @"tagged.yaml: Failed to yaml decode (unsupported tag `!reference` at line 1, column 17)");
Comment thread
j178 marked this conversation as resolved.
Resolved

let result = check_syntax(filename, content);
assert_eq!((result.exit_status, result.output), (0, Vec::new()));
}

#[tokio::test]
async fn test_yaml_with_binary_scalar() -> Result<()> {
let dir = tempdir()?;
Expand Down
8 changes: 4 additions & 4 deletions docs/integrations.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,21 +28,21 @@ A common pattern is to copy the binary into your own image:

```dockerfile
FROM debian:bookworm-slim
COPY --from=ghcr.io/j178/prek:0.5.2 /prek /usr/local/bin/prek
COPY --from=ghcr.io/j178/prek:0.5.1 /prek /usr/local/bin/prek
```

If you prefer, you can also run the distroless image directly:

```bash
docker run --rm ghcr.io/j178/prek:0.5.2 --version
docker run --rm ghcr.io/j178/prek:0.5.1 --version
```

### Alpine

The Alpine variant includes `prek`, Git, CA certificates, a shell, and the Alpine package manager.

```bash
docker run --rm ghcr.io/j178/prek:0.5.2-alpine --version
docker run --rm ghcr.io/j178/prek:0.5.1-alpine --version
```

Use `X.Y.Z-alpine3.24` to pin both the prek and Alpine versions, or `alpine3.24` to pin only the
Expand All @@ -69,7 +69,7 @@ Loaded 1 attestation from GitHub API

!!! tip

Use a specific version tag (e.g., `ghcr.io/j178/prek:0.5.2`) or image
Use a specific version tag (e.g., `ghcr.io/j178/prek:0.5.1`) or image
digest rather than `latest` for verification.

## GitHub Actions
Expand Down
2 changes: 1 addition & 1 deletion prek.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ repo = "builtin"
hooks = [
{ id = "trailing-whitespace", exclude = { glob = "CHANGELOG.md" } },
{ id = "mixed-line-ending" },
# { id = "check-yaml" }, # disabled temporarily
{ id = "check-yaml", args = ["--unsafe"] },
Comment thread
j178 marked this conversation as resolved.
Resolved
{ id = "check-toml" },
{ id = "end-of-file-fixer" },
]
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "maturin"

[project]
name = "prek"
version = "0.5.2"
version = "0.5.1"
description = "A fast Git hook manager written in Rust, designed as a drop-in alternative to pre-commit, reimagined."
authors = [{ name = "j178", email = "hi@j178.dev" }]
requires-python = ">=3.8"
Expand Down
2 changes: 1 addition & 1 deletion uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading