rich icon indicating copy to clipboard operation
rich copied to clipboard

[BUG] Typing of highlighter needs improvement

Open maltevesper opened this issue 3 months ago • 2 comments

The type annotation of Highlighter.highlights should be ClassVar[tuple[str | re.pattern[str],...]] rather than implicit.

Otherwise linters (rightfully) complain that it is bad to use a mutable type (list) for a class variable (https://docs.astral.sh/ruff/rules/mutable-class-default/). Furthermore, mypy treates the variable as an instance variable and complains about it being overwritten, so it would be nice to make it a ClassVar

maltevesper avatar Nov 17 '25 08:11 maltevesper

Thank you for your issue. Give us a little time to review it.

PS. You might want to check the FAQ if you haven't done so already.

Rich was created by Will McGugan. Consider sponsoring Will's work on Rich.

This is an automated reply, generated by FAQtory

github-actions[bot] avatar Nov 17 '25 08:11 github-actions[bot]

I am williing to create a PR if there is traction, with 98 open PRs I am reluctant to preemptivly create one.

maltevesper avatar Nov 17 '25 08:11 maltevesper