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

fix up & touch up user facing messages #468

Merged
merged 1 commit into from
Jul 24, 2024
Merged

fix up & touch up user facing messages #468

merged 1 commit into from
Jul 24, 2024

Conversation

cfbao
Copy link
Member

@cfbao cfbao commented Jul 24, 2024

Noticed some minor issues with user-facing messages.

https://desire2learn.atlassian.net/browse/VUL-403

.GroupBy( o => $"{o.AccountName}.${o.RoleName}", ( _, entries ) =>
.GroupBy( o => (o.AccountName, o.RoleName), ( _, entries ) =>
Copy link
Member Author

Choose a reason for hiding this comment

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

Somewhat unrelated - this isn't a user-facing message, but it's also a string-related issue.

  • Value tuples are preferred when we want to use multiple values as a single key. Converting them to a single string is unnecessary and has more overhead.
  • Even if we do want to use a string here, it should've been
    -$"{o.AccountName}.${o.RoleName}"
    +$"{o.AccountName}.{o.RoleName}"
    A common mistake when using C# interpolated strings.

Comment on lines -21 to +25
Console.Error.Write( $"WARNING: Failed to load the global config file {configFileName}." );
consoleWriter.WriteWarning( $"WARNING: Failed to load the global config file {configFileName}." );
Copy link
Member Author

Choose a reason for hiding this comment

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

It's hard to reproduce such a failure scenario so it's never manifested, but Console.Error.Write (without a newline) would've never worked nicely.

Comment on lines -91 to +94
throw new BmxException(
$"Okta authentication for user '{username}' in org '{org}'"
+ "failed. Check if org, user, and password is correct" );
throw new BmxException( $"""
Okta authentication for user '{username}' in org '{org}' failed.
Check if org, user, and password is correct.
""" );
Copy link
Member Author

@cfbao cfbao Jul 24, 2024

Choose a reason for hiding this comment

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

This one was missing a space before "failed", and the usage of period was inconsistent:
image

Easier (and clearer, I think) to use a raw string literal with multiple lines instead.
image

@cfbao cfbao marked this pull request as ready for review July 24, 2024 16:49
@cfbao cfbao requested a review from a team as a code owner July 24, 2024 16:49
@cfbao cfbao changed the title fix up & touch up user messages fix up & touch up user facing messages Jul 24, 2024
@cfbao cfbao merged commit 8786ab3 into main Jul 24, 2024
9 checks passed
@cfbao cfbao deleted the fix-strings branch July 24, 2024 16:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants