-
Notifications
You must be signed in to change notification settings - Fork 37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
lint/rpt: Handle no-color ttys #1213
Conversation
7fac2f6
to
2523f6e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Excellent, thanks!
pkg/reporter/reporter.go
Outdated
// if there is no support for color, then we show the level in addition | ||
// so that the level of the violation is still clear | ||
if color.NoColor { | ||
table.Append([]string{yellow("Level:"), violation.Level}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Feels a little odd to use yellow()
here, doesn't it? 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
😬 hmm indeed!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have updated this now
This fixes StyraInc#1211 by supporting the NO_COLOR environment variable and checking if the output is a tty before using color. The color.NoColor global is used as described here: https://github.com/fatih/color?tab=readme-ov-file#disableenable-color Signed-off-by: Charlie Egan <charlie@styra.com>
2523f6e
to
95a5fbf
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
This fixes #1211 by supporting the NO_COLOR environment variable and checking if the output is a tty before using color.
The color.NoColor global is used as described here: https://github.com/fatih/color?tab=readme-ov-file#disableenable-color