Skip to content

Conversation

@ntBre
Copy link
Contributor

@ntBre ntBre commented Jul 25, 2025

Summary

I looked at other uses of TextEmitter, and I think this should be the only one affected by this. The other integration tests must work properly since they're run with assert_cmd_snapshot!, which I assume triggers the SHOULD_COLORIZE case, and the cfg!(test) check will work for uses in ruff_linter.

fn default() -> Self {
Self {
flags: EmitterFlags::default(),
config: DisplayDiagnosticConfig::default()
.format(DiagnosticFormat::Concise)
.hide_severity(true)
.color(!cfg!(test) && colored::control::SHOULD_COLORIZE.should_colorize()),
}
}

Alternatively, we could probably move this to a CLI test instead.

Test Plan

cargo test -p ruff, which was failing on main with color codes in the output before this

…` test

Summary
--

I looked at other uses of `TextEmitter`, and I think this should be the only one
affected by this. The other integration tests must work properly since they're
run with `assert_cmd_snapshot!`, which I assume triggers the `SHOULD_COLORIZE`
case, and the `cfg!(test)` check will work for uses in `ruff_linter`.

https://github.com/astral-sh/ruff/blob/4a4dc38b5b5055601dcb8da4ad07720e47d451fa/crates/ruff_linter/src/message/text.rs#L36-L44

Test Plan
--

`cargo test -p ruff`, which was failing on `main` with color codes in the output
before this
@ntBre ntBre added the testing Related to testing Ruff itself label Jul 25, 2025
@github-actions
Copy link
Contributor

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

✅ ecosystem check detected no linter changes.

@ntBre ntBre merged commit 165091a into main Jul 25, 2025
36 checks passed
@ntBre ntBre deleted the brent/fix-e902-colors branch July 25, 2025 19:47
dcreager added a commit that referenced this pull request Jul 25, 2025
* main:
  [ty] Added support for "document symbols" and "workspace symbols" (#19521)
  Add `TextEmitter::with_color` and disable colors in `unreadable_files` test (#19562)
  [ty] Added support for document highlights in playground. (#19540)
  [`refurb`] Ignore decorated functions for `FURB118` (#19339)
  [ty] Add workflow to comment diagnostic diff for conformance tests (#19556)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

testing Related to testing Ruff itself

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants