pylint-dev / pylint

It's not just a linter that annoys you!
https://pylint.readthedocs.io/en/latest/
GNU General Public License v2.0
5.31k stars 1.14k forks source link

Dynamic color mapping for "fail-on" messages/categories in ColorizedTextReporter #9898

Open felixp98 opened 2 months ago

felixp98 commented 2 months ago

Current problem

The ColorizedTextReporter (--output-format=colorized) makes it easy in CI jobs to find the failure causing pylint errors quickly. Especially when there are more than a few unfixed pylint findings. But if the configuration for fail-on differs from the default value, e.g. additional message types have been added to fail-on, these are not highlighted in red and are therefore more difficult to find in the CI log.

Desired solution

I suggest more dynamic message coloring for custom fail-on configs. For example if a whole category or single message type is configured as fail-on, then color it the same as Error or Failure message category. Or perhaps a completely new color (e.g. red inverse) that represents all fail-on messages/categories?

Additional context

My current workaround is a custom reporter class. But since the reporter class currently has no access to the linter variable self.fail_on_symbols, only hardcoded color codes for extra message types are possible.

Pierre-Sassoulas commented 2 months ago

Sounds good, do you want to adapt your custom checker inside pylint ?