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

Use a lower case for runner dialects in the error message #2881

Merged
merged 1 commit into from
Nov 11, 2021

Conversation

danicheg
Copy link
Contributor

@@ -97,7 +97,7 @@ object ScalafmtRunner {
known.find(_.value eq dialect).map(_.source)

def getUnknownError = {
val knownStr = known.map(_.source).mkString(",")
val knownStr = known.map(_.source.toLowerCase).mkString(",")
Copy link
Collaborator

Choose a reason for hiding this comment

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

this is the only change we should keep. why do we need the others?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Are you about the ordering of runner dialects?
It's quite natural to have an order of runner dialects for the Scala first and then for SBT, I suppose. Just as in docs.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Or if you are convinced that it's mindless, I doubtless will fix it :)

Copy link
Collaborator

Choose a reason for hiding this comment

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

you are worried about the presentation of dialects in some error message. therefore, take care of that and only that, don't change the internal list of dialects.

the reason is that next time someone adds a dialect, he will mess it up for you.

so you can lowercase it here, you can apply sorting etc. but don't change known.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok, now it's only lowercase here.

Copy link
Collaborator

Choose a reason for hiding this comment

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

you're correct. but it doesn't matter, it will help people do a mental binary search rather than a linear scan.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hmm, if we have the Seq[WithName] then calling the withName is redundant? Am I missing some things? Anyway, compilation succeeded without it.

Copy link
Collaborator

Choose a reason for hiding this comment

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

perhaps i misunderstood what you want to do in the first place. withName was taking a lowercase version of the name. did you NOT care about the lowercase name?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Wow, shame on me. I'm half asleep. You're 100% right!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hope, now all is ready to merge these two lines 😄

@danicheg danicheg force-pushed the runner-dialects-error-msg branch 2 times, most recently from 8486175 to 033305a Compare November 11, 2021 18:45
@danicheg danicheg force-pushed the runner-dialects-error-msg branch from 033305a to b250dd3 Compare November 11, 2021 18:58
@kitbellew kitbellew merged commit 4654a1b into scalameta:master Nov 11, 2021
@danicheg danicheg deleted the runner-dialects-error-msg branch November 12, 2021 07:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants