Skip to content

auto-update --freeze adds 2 spaces before # frozen: comment, causing prettier hook to fail #1941

@deadnews

Description

@deadnews

Summary

prek auto-update --freeze adds 2 spaces before the # frozen: comment. prettier enforces a single space before inline # comments in yaml, so the subsequent prek run -a reformats the modified lines and reports the run as failed.

Reproduction

prek run -a                  # passes, prettier formats file with 1 space
prek auto-update --freeze    # updates revs, adds 2 spaces before # frozen:
prek run -a                  # prettier hook rewrites the lines → hook fails

Example output of auto-update --freeze

- repo: https://github.com/rbubley/mirrors-prettier
  rev: b25652612a4a3c1da8caccfca9af661db56b2c07  # frozen: v3.8.2
#                                              ^^

Expected

rev: b25652612a4a3c1da8caccfca9af661db56b2c07 # frozen: v3.8.2

Suggested fix

Use a single space when appending the frozen comment.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions