Skip to content
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

Add Severity#color #311

Merged
merged 1 commit into from
Nov 28, 2022
Merged

Add Severity#color #311

merged 1 commit into from
Nov 28, 2022

Conversation

Sija
Copy link
Member

@Sija Sija commented Nov 28, 2022

This PR aims to improve the DX by colouring issue messages with unique color assigned to issue severity.

image

@Sija Sija added this to the 1.4.0 milestone Nov 28, 2022
@Sija Sija requested a review from veelenga November 28, 2022 05:10
@Sija Sija self-assigned this Nov 28, 2022
def color : Colorize::Color
case self
in Error then Colorize::ColorANSI::Red
in Warning then Colorize::ColorANSI::Red
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what about yellow for warning?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That was also my choice at the beginning, and by this we come to the interesting topic - do our severities are adequate? I mean - we have just a single rule with :error severity, and the rest of the rules is using either of the remaining two. So, in majority of the cases we gonna have kinda-Ukrainian flag on the CLI (yellow/blue) :P not that it bothers me, but in my eyes what Credo does looks way more adequate:

Credo

Refactoring this + the output was going to be (one of) my next PRs actually ;)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, that makes sense. My latest suggestion is to do Red for Error and LightRed for Warning. If you still think that's a bad idea, let's follow current implementation.

Copy link
Member Author

@Sija Sija Nov 28, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I still do ;)

  • light red looks kinda odd
  • we'd use the weaker of the two for majority of the issues
  • we'd break BC even more
  • refactoring is on the way anyway

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a small observation: I think ameba shouldn't have an error severity. Everything that's clearly an actual error should be rejected by the compiler. A linter doesn't need to handle that (except for automatic fixing maybe?).
So Rule::Lint::Syntax is the only error severity rule because it catches syntax errors from the parser. I would expect that to stay the only one for said reason.

@Sija Sija merged commit 20935ae into master Nov 28, 2022
@Sija Sija deleted the Sija/add-severity-color branch November 28, 2022 10:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants