Skip to content

No color in hook output #1561

@tyilo

Description

@tyilo

Summary

Using prek instead of pre-commit the output of the hook doesn't have any color.

$ prek --version
prek 0.3.1 (d42b733b6 2026-02-04)
$ pre-commit --version
pre-commit 4.5.1
Image

Reproduction:

$ cd /tmp
$ cargo new foo
$ cd foo
$ cat > .pre-commit-config.yaml
repos:
  - repo: https://github.com/FeryET/pre-commit-rust
    rev: v1.2.1
    hooks:
    - id: clippy
      args: ["--tests", "--", "-D", "warnings"]
^D
$ cat > src/main.rs
fn main() {
    let unused = 1;
    println!("Hello, world!");
}
^D
$ git add .
$ prek run --all-files
clippy...................................................................Failed
- hook id: clippy
- exit code: 101

  Checking foo v0.1.0 (/tmp/foo)
  error: unused variable: `unused`
   --> src/main.rs:2:9
    |
  2 |     let unused = 1;
    |         ^^^^^^ help: if this is intentional, prefix it with an underscore: `_unused`
    |
    = note: `-D unused-variables` implied by `-D warnings`
    = help: to override `-D warnings` add `#[allow(unused_variables)]`

  error: could not compile `foo` (bin "foo" test) due to 1 previous error
$ pre-commit run --all-files
clippy...................................................................Failed
- hook id: clippy
- exit code: 101

    Checking foo v0.1.0 (/tmp/foo)
error: unused variable: `unused`
 --> src/main.rs:2:9
  |
2 |     let unused = 1;
  |         ^^^^^^ help: if this is intentional, prefix it with an underscore: `_unused`
  |
  = note: `-D unused-variables` implied by `-D warnings`
  = help: to override `-D warnings` add `#[allow(unused_variables)]`

error: could not compile `foo` (bin "foo" test) due to 1 previous error

Platform

Linux 6.18.7-arch1-1 x86_64 GNU/Linux

Version

prek 0.3.1 (d42b733 2026-02-04)

.pre-commit-config.yaml

repos:
  - repo: https://github.com/FeryET/pre-commit-rust
    rev: v1.2.1
    hooks:
    - id: clippy
      args: ["--tests", "--", "-D", "warnings"]

Log file

2026-02-04T10:45:43.555179Z DEBUG prek: 0.3.1 (d42b733b6 2026-02-04)
2026-02-04T10:45:43.555238Z DEBUG Args: ["prek", "run", "--all-files"]
2026-02-04T10:45:43.558766Z TRACE get_root: close time.busy=3.49ms time.idle=4.95µs
2026-02-04T10:45:43.558820Z DEBUG Git root: /tmp/foo
2026-02-04T10:45:43.558860Z DEBUG Found workspace root at `/tmp/foo`
2026-02-04T10:45:43.558877Z TRACE Include selectors: ``
2026-02-04T10:45:43.558889Z TRACE Skip selectors: ``
2026-02-04T10:45:43.558978Z DEBUG discover{root="/tmp/foo" config=None refresh=false}: Loaded workspace from cache
2026-02-04T10:45:43.559021Z DEBUG discover{root="/tmp/foo" config=None refresh=false}: Loading project configuration path=.pre-commit-config.yaml
2026-02-04T10:45:43.559264Z TRACE discover{root="/tmp/foo" config=None refresh=false}: close time.busy=352µs time.idle=2.92µs
2026-02-04T10:45:43.559806Z TRACE Checking lock resource="store" path=/home/tyilo/.cache/prek/.lock
2026-02-04T10:45:43.559835Z DEBUG Acquired lock resource="store"
2026-02-04T10:45:43.562149Z DEBUG Hooks going to run: ["clippy"]
2026-02-04T10:45:43.562476Z DEBUG Hook `clippy` does not need installation
2026-02-04T10:45:43.562577Z TRACE Released lock path=/home/tyilo/.cache/prek/.lock
2026-02-04T10:45:43.562641Z TRACE collect_files:ls_files{cwd="/tmp/foo" path="/tmp/foo"}: Executing `cd /tmp/foo && /usr/bin/git ls-files -z -- /tmp/foo`
2026-02-04T10:45:43.565580Z TRACE collect_files:ls_files{cwd="/tmp/foo" path="/tmp/foo"}: close time.busy=447µs time.idle=2.50ms
2026-02-04T10:45:43.565627Z DEBUG collect_files: All files in the workspace: 5
2026-02-04T10:45:43.565641Z TRACE collect_files: close time.busy=536µs time.idle=2.50ms
2026-02-04T10:45:43.565759Z TRACE for_project{project=.}: close time.busy=2.68µs time.idle=1.21µs
2026-02-04T10:45:43.565775Z TRACE Files for project `.` after filtered: 5
2026-02-04T10:45:43.565789Z TRACE get_diff{path="/tmp/foo"}: Executing `/usr/bin/git diff -- /tmp/foo`
2026-02-04T10:45:43.568172Z TRACE get_diff{path="/tmp/foo"}: close time.busy=358µs time.idle=2.03ms
2026-02-04T10:45:43.568213Z DEBUG Running priority group with priority 0 with concurrency 8: ["clippy"]
2026-02-04T10:45:43.569373Z TRACE for_hook{hook="clippy"}: close time.busy=1.13ms time.idle=2.21µs
2026-02-04T10:45:43.569439Z TRACE Files for hook `clippy` after filtered: 3
2026-02-04T10:45:43.569798Z TRACE run{hook_id=clippy language=system}: Resolved command: /usr/bin/cargo
2026-02-04T10:45:43.569967Z TRACE run{hook_id=clippy language=system}: Running clippy total_files=0 concurrency=8
2026-02-04T10:45:43.570088Z TRACE run{hook_id=clippy language=system}: Executing `cd /tmp/foo && /usr/bin/cargo clippy --tests -- -D warnings`
2026-02-04T10:45:43.712386Z TRACE run{hook_id=clippy language=system}: close time.busy=2.27ms time.idle=141ms
2026-02-04T10:45:43.712430Z TRACE get_diff{path="/tmp/foo"}: Executing `/usr/bin/git diff -- /tmp/foo`
2026-02-04T10:45:43.714011Z TRACE get_diff{path="/tmp/foo"}: close time.busy=330µs time.idle=1.26ms

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions